UI OIDC auth type saved in localStorage not sessionStorage (#16170)
* Remove new instances of sessionStorage after localStorage change * Add changelog
This commit is contained in:
parent
75eedf1b97
commit
29cae725ce
3
changelog/16170.txt
Normal file
3
changelog/16170.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: OIDC login type uses localStorage instead of sessionStorage
|
||||||
|
```
|
|
@ -377,8 +377,8 @@ export default Service.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
async authSuccess(options, response) {
|
async authSuccess(options, response) {
|
||||||
// persist selectedAuth to sessionStorage to rehydrate auth form on logout
|
// persist selectedAuth to localStorage to rehydrate auth form on logout
|
||||||
sessionStorage.setItem('selectedAuth', options.selectedAuth);
|
localStorage.setItem('selectedAuth', options.selectedAuth);
|
||||||
const authData = await this.persistAuthData(options, response, this.namespaceService.path);
|
const authData = await this.persistAuthData(options, response, this.namespaceService.path);
|
||||||
await this.permissions.getPaths.perform();
|
await this.permissions.getPaths.perform();
|
||||||
return authData;
|
return authData;
|
||||||
|
@ -397,8 +397,8 @@ export default Service.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
getAuthType() {
|
getAuthType() {
|
||||||
// check sessionStorage first
|
// check localStorage first
|
||||||
const selectedAuth = sessionStorage.getItem('selectedAuth');
|
const selectedAuth = localStorage.getItem('selectedAuth');
|
||||||
if (selectedAuth) return selectedAuth;
|
if (selectedAuth) return selectedAuth;
|
||||||
// fallback to authData which discerns backend type from token
|
// fallback to authData which discerns backend type from token
|
||||||
return this.authData ? this.authData.backend.type : null;
|
return this.authData ? this.authData.backend.type : null;
|
||||||
|
|
|
@ -19,7 +19,7 @@ module('Acceptance | oidc auth method', function (hooks) {
|
||||||
auth: { client_token: 'root' },
|
auth: { client_token: 'root' },
|
||||||
}));
|
}));
|
||||||
// ensure clean state
|
// ensure clean state
|
||||||
sessionStorage.removeItem('selectedAuth');
|
localStorage.removeItem('selectedAuth');
|
||||||
});
|
});
|
||||||
hooks.afterEach(function () {
|
hooks.afterEach(function () {
|
||||||
this.openStub.restore();
|
this.openStub.restore();
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default create({
|
||||||
await this.logout();
|
await this.logout();
|
||||||
await settled();
|
await settled();
|
||||||
// clear session storage to ensure we have a clean state
|
// clear session storage to ensure we have a clean state
|
||||||
window.sessionStorage.clear();
|
window.localStorage.clear();
|
||||||
await this.visit({ with: 'token' });
|
await this.visit({ with: 'token' });
|
||||||
await settled();
|
await settled();
|
||||||
if (token) {
|
if (token) {
|
||||||
|
@ -31,8 +31,8 @@ export default create({
|
||||||
// make sure we're always logged out and logged back in
|
// make sure we're always logged out and logged back in
|
||||||
await this.logout();
|
await this.logout();
|
||||||
await settled();
|
await settled();
|
||||||
// clear session storage to ensure we have a clean state
|
// clear local storage to ensure we have a clean state
|
||||||
window.sessionStorage.clear();
|
window.localStorage.clear();
|
||||||
await this.visit({ with: 'username' });
|
await this.visit({ with: 'username' });
|
||||||
await settled();
|
await settled();
|
||||||
await this.usernameInput(username);
|
await this.usernameInput(username);
|
||||||
|
|
Loading…
Reference in a new issue