From 2dabfc1bb488f84ec00f19a51aba144b7f71e45d Mon Sep 17 00:00:00 2001 From: kirankumarb07 Date: Wed, 29 Mar 2023 11:19:31 +0530 Subject: Add session timeout in Policies page This patchset will provide the option to configure the session timeout for the WebUI. The functionality will provide the below timeout options to configure. 1. 30 minutes 2. 1 hour 3. 2 hours 4. 4 hours 5. 8 hours 6. 1 Day For the API, redfish is having the following resource. URL - /redfish/v1/SessionService Method - GET (to get the configured timeout) - PATCH (to configure the timeout value) Property - { "SessionTimeout": 1800 } When the user idles up until the configured session timeout, after that any API call from this session will get 401 status and the web UI will gets logged out. Change-Id: Ic7c6b4817e560ca4ceb983dc5e2af51f3ae08cf5 Signed-off-by: Kirankumar Ballapalli --- src/views/SecurityAndAccess/Policies/Policies.vue | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src/views') diff --git a/src/views/SecurityAndAccess/Policies/Policies.vue b/src/views/SecurityAndAccess/Policies/Policies.vue index 1dc197c7..3ebfee4e 100644 --- a/src/views/SecurityAndAccess/Policies/Policies.vue +++ b/src/views/SecurityAndAccess/Policies/Policies.vue @@ -103,6 +103,30 @@ + + +
+
{{ $t('pagePolicies.webSessionTimeOut') }}
+
+ {{ $t('pagePolicies.webSessionTimeOutDescription') }} +
+
+
+ + + + + +
@@ -126,6 +150,14 @@ export default { return { modifySSHPolicyDisabled: process.env.VUE_APP_MODIFY_SSH_POLICY_DISABLED === 'true', + sessionTimeOutOptions: [ + { value: 1800, text: this.$t('pagePolicies.options.30minutes') }, + { value: 3600, text: this.$t('pagePolicies.options.1hour') }, + { value: 7200, text: this.$t('pagePolicies.options.2hours') }, + { value: 14400, text: this.$t('pagePolicies.options.4hours') }, + { value: 28800, text: this.$t('pagePolicies.options.8hours') }, + { value: 86400, text: this.$t('pagePolicies.options.1day') }, + ], }; }, computed: { @@ -169,12 +201,21 @@ export default { return newValue; }, }, + sessionTimeoutState: { + get() { + return this.$store.getters['policies/getSessionTimeoutValue']; + }, + set(newValue) { + return newValue; + }, + }, }, created() { this.startLoader(); Promise.all([ this.$store.dispatch('policies/getBiosStatus'), this.$store.dispatch('policies/getNetworkProtocolStatus'), + this.$store.dispatch('policies/getSessionTimeout'), ]).finally(() => this.endLoader()); }, methods: { @@ -202,6 +243,12 @@ export default { .then((message) => this.successToast(message)) .catch(({ message }) => this.errorToast(message)); }, + saveSessionTimeoutValue(sessionTimeoutState) { + this.$store + .dispatch('policies/saveSessionTimeoutValue', sessionTimeoutState) + .then((message) => this.successToast(message)) + .catch(({ message }) => this.errorToast(message)); + }, }, }; @@ -210,4 +257,7 @@ export default { .setting-section { border-bottom: 1px solid gray('300'); } +.session-timeout { + align-self: center; +} -- cgit v1.2.3