Logout with wrapped token (#14329)
* fixes issue passing wrapped_token query param to logout route * adds changelog entry
This commit is contained in:
parent
d3b579d850
commit
01738c8a0f
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: Fixes issue logging out with wrapped token query parameter
|
||||||
|
```
|
|
@ -11,14 +11,14 @@ export default Route.extend(ModelBoundaryRoute, {
|
||||||
console: service(),
|
console: service(),
|
||||||
permissions: service(),
|
permissions: service(),
|
||||||
namespaceService: service('namespace'),
|
namespaceService: service('namespace'),
|
||||||
|
router: service(),
|
||||||
|
|
||||||
modelTypes: computed(function () {
|
modelTypes: computed(function () {
|
||||||
return ['secret', 'secret-engine'];
|
return ['secret', 'secret-engine'];
|
||||||
}),
|
}),
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel({ to: { queryParams } }) {
|
||||||
const authType = this.auth.getAuthType();
|
const authType = this.auth.getAuthType();
|
||||||
const baseUrl = window.location.origin;
|
|
||||||
const ns = this.namespaceService.path;
|
const ns = this.namespaceService.path;
|
||||||
this.auth.deleteCurrentToken();
|
this.auth.deleteCurrentToken();
|
||||||
this.controlGroup.deleteTokens();
|
this.controlGroup.deleteTokens();
|
||||||
|
@ -27,15 +27,17 @@ export default Route.extend(ModelBoundaryRoute, {
|
||||||
this.console.clearLog(true);
|
this.console.clearLog(true);
|
||||||
this.flashMessages.clearMessages();
|
this.flashMessages.clearMessages();
|
||||||
this.permissions.reset();
|
this.permissions.reset();
|
||||||
|
|
||||||
|
queryParams.with = authType;
|
||||||
|
if (ns) {
|
||||||
|
queryParams.namespace = ns;
|
||||||
|
}
|
||||||
if (Ember.testing) {
|
if (Ember.testing) {
|
||||||
// Don't redirect on the test
|
// Don't redirect on the test
|
||||||
this.replaceWith('vault.cluster.auth', { queryParams: { with: authType } });
|
this.replaceWith('vault.cluster.auth', { queryParams });
|
||||||
} else {
|
} else {
|
||||||
let params = `?with=${authType}`;
|
const { cluster_name } = this.paramsFor('vault.cluster');
|
||||||
if (ns) {
|
location.assign(this.router.urlFor('vault.cluster.auth', cluster_name, { queryParams }));
|
||||||
params = `${params}&namespace=${ns}`;
|
|
||||||
}
|
|
||||||
location.assign(`${baseUrl}/ui/vault/auth${params}`);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue