mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
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:
@@ -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()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user