OIDC Logout Bug (#14545)

* fixes issue with token auth selected after logging out from oidc or jwt methods

* adds changelog entry

* reverts backendType var name change in auth-form authenticate method
This commit is contained in:
Jordan Reimer
2022-03-18 09:40:17 -06:00
committed by GitHub
parent 3fdb221aa6
commit d8128eaa5a
8 changed files with 121 additions and 77 deletions

View File

@@ -111,6 +111,18 @@ export default Component.extend(DEFAULTS, {
this.setProperties(DEFAULTS);
},
getAuthBackend(type) {
const { wrappedToken, methods, selectedAuth, selectedAuthIsPath: keyIsPath } = this;
const selected = type || selectedAuth;
if (!methods && !wrappedToken) {
return {};
}
if (keyIsPath) {
return methods.findBy('path', selected);
}
return BACKENDS.findBy('type', selected);
},
selectedAuthIsPath: match('selectedAuth', /\/$/),
selectedAuthBackend: computed(
'wrappedToken',
@@ -119,14 +131,7 @@ export default Component.extend(DEFAULTS, {
'selectedAuth',
'selectedAuthIsPath',
function () {
let { wrappedToken, methods, selectedAuth, selectedAuthIsPath: keyIsPath } = this;
if (!methods && !wrappedToken) {
return {};
}
if (keyIsPath) {
return methods.findBy('path', selectedAuth);
}
return BACKENDS.findBy('type', selectedAuth);
return this.getAuthBackend();
}
),
@@ -208,10 +213,18 @@ export default Component.extend(DEFAULTS, {
authenticate: task(
waitFor(function* (backendType, data) {
let clusterId = this.cluster.id;
const {
selectedAuth,
cluster: { id: clusterId },
} = this;
try {
this.delayAuthMessageReminder.perform();
const authResponse = yield this.auth.authenticate({ clusterId, backend: backendType, data });
const authResponse = yield this.auth.authenticate({
clusterId,
backend: backendType,
data,
selectedAuth,
});
this.onSuccess(authResponse, backendType, data);
} catch (e) {
this.set('loading', false);
@@ -246,7 +259,10 @@ export default Component.extend(DEFAULTS, {
this.setProperties({
error: null,
});
let backend = this.selectedAuthBackend || {};
// if callback from oidc or jwt we have a token at this point
let backend = ['oidc', 'jwt'].includes(this.selectedAuth)
? this.getAuthBackend('token')
: this.selectedAuthBackend || {};
let backendMeta = BACKENDS.find(
(b) => (b.type || '').toLowerCase() === (backend.type || '').toLowerCase()
);