diff --git a/changelog/16170.txt b/changelog/16170.txt new file mode 100644 index 000000000000..04707ced7f4c --- /dev/null +++ b/changelog/16170.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: OIDC login type uses localStorage instead of sessionStorage +``` diff --git a/ui/app/services/auth.js b/ui/app/services/auth.js index 1857d0c1414f..95cf6b88dc36 100644 --- a/ui/app/services/auth.js +++ b/ui/app/services/auth.js @@ -377,8 +377,8 @@ export default Service.extend({ }, async authSuccess(options, response) { - // persist selectedAuth to sessionStorage to rehydrate auth form on logout - sessionStorage.setItem('selectedAuth', options.selectedAuth); + // persist selectedAuth to localStorage to rehydrate auth form on logout + localStorage.setItem('selectedAuth', options.selectedAuth); const authData = await this.persistAuthData(options, response, this.namespaceService.path); await this.permissions.getPaths.perform(); return authData; @@ -397,8 +397,8 @@ export default Service.extend({ }, getAuthType() { - // check sessionStorage first - const selectedAuth = sessionStorage.getItem('selectedAuth'); + // check localStorage first + const selectedAuth = localStorage.getItem('selectedAuth'); if (selectedAuth) return selectedAuth; // fallback to authData which discerns backend type from token return this.authData ? this.authData.backend.type : null; diff --git a/ui/tests/acceptance/oidc-auth-method-test.js b/ui/tests/acceptance/oidc-auth-method-test.js index 59c79e59820a..56732178831f 100644 --- a/ui/tests/acceptance/oidc-auth-method-test.js +++ b/ui/tests/acceptance/oidc-auth-method-test.js @@ -19,7 +19,7 @@ module('Acceptance | oidc auth method', function (hooks) { auth: { client_token: 'root' }, })); // ensure clean state - sessionStorage.removeItem('selectedAuth'); + localStorage.removeItem('selectedAuth'); }); hooks.afterEach(function () { this.openStub.restore(); diff --git a/ui/tests/pages/auth.js b/ui/tests/pages/auth.js index bc4ba11e1b2f..99515e9afb12 100644 --- a/ui/tests/pages/auth.js +++ b/ui/tests/pages/auth.js @@ -16,7 +16,7 @@ export default create({ await this.logout(); await settled(); // clear session storage to ensure we have a clean state - window.sessionStorage.clear(); + window.localStorage.clear(); await this.visit({ with: 'token' }); await settled(); if (token) { @@ -31,8 +31,8 @@ export default create({ // make sure we're always logged out and logged back in await this.logout(); await settled(); - // clear session storage to ensure we have a clean state - window.sessionStorage.clear(); + // clear local storage to ensure we have a clean state + window.localStorage.clear(); await this.visit({ with: 'username' }); await settled(); await this.usernameInput(username);