Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of UI Remove recent instances of sessionStorage into release/1.11.x #16171

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/16170.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: OIDC login type uses localStorage instead of sessionStorage
```
8 changes: 4 additions & 4 deletions ui/app/services/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/oidc-auth-method-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions ui/tests/pages/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down