Skip to content

Commit

Permalink
fixes issue passing wrapped_token query param to logout route
Browse files Browse the repository at this point in the history
  • Loading branch information
zofskeez committed Mar 1, 2022
1 parent ef3dca9 commit eaf5f1a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ui/app/routes/vault/cluster/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 }));
}
},
});

0 comments on commit eaf5f1a

Please sign in to comment.