Logout with wrapped token (#14329)

* fixes issue passing wrapped_token query param to logout route

* adds changelog entry
This commit is contained in:
Jordan Reimer 2022-03-02 09:45:53 -07:00 committed by GitHub
parent d3b579d850
commit 01738c8a0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

3
changelog/14329.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Fixes issue logging out with wrapped token query parameter
```

View File

@ -11,14 +11,14 @@ export default Route.extend(ModelBoundaryRoute, {
console: service(),
permissions: service(),
namespaceService: service('namespace'),
router: service(),
modelTypes: computed(function () {
return ['secret', 'secret-engine'];
}),
beforeModel() {
beforeModel({ to: { queryParams } }) {
const authType = this.auth.getAuthType();
const baseUrl = window.location.origin;
const ns = this.namespaceService.path;
this.auth.deleteCurrentToken();
this.controlGroup.deleteTokens();
@ -27,15 +27,17 @@ export default Route.extend(ModelBoundaryRoute, {
this.console.clearLog(true);
this.flashMessages.clearMessages();
this.permissions.reset();
queryParams.with = authType;
if (ns) {
queryParams.namespace = ns;
}
if (Ember.testing) {
// Don't redirect on the test
this.replaceWith('vault.cluster.auth', { queryParams: { with: authType } });
this.replaceWith('vault.cluster.auth', { queryParams });
} else {
let params = `?with=${authType}`;
if (ns) {
params = `${params}&namespace=${ns}`;
}
location.assign(`${baseUrl}/ui/vault/auth${params}`);
const { cluster_name } = this.paramsFor('vault.cluster');
location.assign(this.router.urlFor('vault.cluster.auth', cluster_name, { queryParams }));
}
},
});