From bd4314e977b883c1bffe4f593e187a1c62abbfec Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 5 Jan 2016 11:13:25 -0600 Subject: PLT-1558 adding session length to config file --- web/web.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web') diff --git a/web/web.go b/web/web.go index 6e0e8df32..7e8234138 100644 --- a/web/web.go +++ b/web/web.go @@ -991,7 +991,7 @@ func getAccessToken(c *api.Context, w http.ResponseWriter, r *http.Request) { return } - accessRsp := &model.AccessResponse{AccessToken: session.Token, TokenType: model.ACCESS_TOKEN_TYPE, ExpiresIn: model.SESSION_TIME_OAUTH_IN_SECS} + accessRsp := &model.AccessResponse{AccessToken: session.Token, TokenType: model.ACCESS_TOKEN_TYPE, ExpiresIn: int32(*utils.Cfg.ServiceSettings.SessionLengthSSOInDays * 60 * 60 * 24)} w.Header().Set("Content-Type", "application/json") w.Header().Set("Cache-Control", "no-store") -- cgit v1.2.3-1-g7c22 From 214c6bc15ed1d0c9f94d0f0545d3f95241893cdc Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 5 Jan 2016 11:46:51 -0600 Subject: Adding UI for session length settings --- .../components/admin_console/service_settings.jsx | 133 ++++++++++++++++++++- 1 file changed, 132 insertions(+), 1 deletion(-) (limited to 'web') diff --git a/web/react/components/admin_console/service_settings.jsx b/web/react/components/admin_console/service_settings.jsx index e235819fe..f10721ffa 100644 --- a/web/react/components/admin_console/service_settings.jsx +++ b/web/react/components/admin_console/service_settings.jsx @@ -4,6 +4,10 @@ import * as Client from '../../utils/client.jsx'; import * as AsyncClient from '../../utils/async_client.jsx'; +const DefaultSessionLength = 30; +const DefaultMaximumLoginAttempts = 10; +const DefaultSessionCacheInMinutes = 10; + export default class ServiceSettings extends React.Component { constructor(props) { super(props); @@ -45,13 +49,56 @@ export default class ServiceSettings extends React.Component { //config.ServiceSettings.EnableOAuthServiceProvider = ReactDOM.findDOMNode(this.refs.EnableOAuthServiceProvider).checked; - var MaximumLoginAttempts = 10; + var MaximumLoginAttempts = DefaultMaximumLoginAttempts; if (!isNaN(parseInt(ReactDOM.findDOMNode(this.refs.MaximumLoginAttempts).value, 10))) { MaximumLoginAttempts = parseInt(ReactDOM.findDOMNode(this.refs.MaximumLoginAttempts).value, 10); } + if (MaximumLoginAttempts < 1) { + MaximumLoginAttempts = 1; + } config.ServiceSettings.MaximumLoginAttempts = MaximumLoginAttempts; ReactDOM.findDOMNode(this.refs.MaximumLoginAttempts).value = MaximumLoginAttempts; + var SessionLengthWebInDays = DefaultSessionLength; + if (!isNaN(parseInt(ReactDOM.findDOMNode(this.refs.SessionLengthWebInDays).value, 10))) { + SessionLengthWebInDays = parseInt(ReactDOM.findDOMNode(this.refs.SessionLengthWebInDays).value, 10); + } + if (SessionLengthWebInDays < 1) { + SessionLengthWebInDays = 1; + } + config.ServiceSettings.SessionLengthWebInDays = SessionLengthWebInDays; + ReactDOM.findDOMNode(this.refs.SessionLengthWebInDays).value = SessionLengthWebInDays; + + var SessionLengthMobileInDays = DefaultSessionLength; + if (!isNaN(parseInt(ReactDOM.findDOMNode(this.refs.SessionLengthMobileInDays).value, 10))) { + SessionLengthMobileInDays = parseInt(ReactDOM.findDOMNode(this.refs.SessionLengthMobileInDays).value, 10); + } + if (SessionLengthMobileInDays < 1) { + SessionLengthMobileInDays = 1; + } + config.ServiceSettings.SessionLengthMobileInDays = SessionLengthMobileInDays; + ReactDOM.findDOMNode(this.refs.SessionLengthMobileInDays).value = SessionLengthMobileInDays; + + var SessionLengthSSOInDays = DefaultSessionLength; + if (!isNaN(parseInt(ReactDOM.findDOMNode(this.refs.SessionLengthSSOInDays).value, 10))) { + SessionLengthSSOInDays = parseInt(ReactDOM.findDOMNode(this.refs.SessionLengthSSOInDays).value, 10); + } + if (SessionLengthSSOInDays < 1) { + SessionLengthSSOInDays = 1; + } + config.ServiceSettings.SessionLengthSSOInDays = SessionLengthSSOInDays; + ReactDOM.findDOMNode(this.refs.SessionLengthSSOInDays).value = SessionLengthSSOInDays; + + var SessionCacheInMinutes = DefaultSessionCacheInMinutes; + if (!isNaN(parseInt(ReactDOM.findDOMNode(this.refs.SessionCacheInMinutes).value, 10))) { + SessionCacheInMinutes = parseInt(ReactDOM.findDOMNode(this.refs.SessionCacheInMinutes).value, 10); + } + if (SessionCacheInMinutes < -1) { + SessionCacheInMinutes = -1; + } + config.ServiceSettings.SessionCacheInMinutes = SessionCacheInMinutes; + ReactDOM.findDOMNode(this.refs.SessionCacheInMinutes).value = SessionCacheInMinutes; + Client.saveConfig( config, () => { @@ -416,6 +463,90 @@ export default class ServiceSettings extends React.Component { +
+ +
+ +

{'The web session will expire after the number of days specified and will require a user to login again.'}

+
+
+ +
+ +
+ +

{'The native mobile session will expire after the number of days specified and will require a user to login again.'}

+
+
+ +
+ +
+ +

{'The SSO session will expire after the number of days specified and will require a user to login again.'}

+
+
+ +
+ +
+ +

{'The number of minutes to cache a session in memory.'}

+
+
+
{serverError} -- cgit v1.2.3-1-g7c22