Skip to content

Commit

Permalink
test: fixes authentication test
Browse files Browse the repository at this point in the history
  • Loading branch information
austingebauer committed May 7, 2020
1 parent d9888b4 commit 6a98c3f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 1 addition & 5 deletions ui/app/components/auth-jwt.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default Component.extend({
onNamespace() {},

didReceiveAttrs() {
console.log(`didReceiveAttrs: ${this.errorMessage}`);
let { oldSelectedAuthPath, selectedAuthPath } = this;
let shouldDebounce = !oldSelectedAuthPath && !selectedAuthPath;
if (oldSelectedAuthPath !== selectedAuthPath) {
Expand All @@ -45,7 +44,6 @@ export default Component.extend({
// Assumes authentication using OIDC until it's known that the mount is
// configured for JWT authentication via static keys, JWKS, or OIDC discovery.
isOIDC: computed('errorMessage', function() {
console.log(`isOIDC: ${this.errorMessage}`);
return this.errorMessage !== ERROR_JWT_LOGIN;
}),

Expand Down Expand Up @@ -159,12 +157,10 @@ export default Component.extend({
if (e && e.preventDefault) {
e.preventDefault();
}
if (!this.isOIDC) {
if (!this.isOIDC || !this.role || !this.role.authUrl) {
return;
}

console.log(`Role: ${this.role}`);

await this.fetchRole.perform(this.roleName, { debounce: false });
let win = this.getWindow();

Expand Down
2 changes: 0 additions & 2 deletions ui/tests/acceptance/auth-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ module('Acceptance | auth', function(hooks) {
await component.token('token');
}
if (backend.type === 'jwt' || backend.type === 'oidc') {
await jwtComponent.jwt('1');
await jwtComponent.role('test');
}
await component.login();
Expand All @@ -81,7 +80,6 @@ module('Acceptance | auth', function(hooks) {
} else if (backend.type === 'jwt' || backend.type === 'oidc') {
let authReq = this.server.passthroughRequests[this.server.passthroughRequests.length - 2];
body = JSON.parse(authReq.requestBody);
assert.ok(Object.keys(body).includes('jwt'), `${backend.type} includes jwt`);
assert.ok(Object.keys(body).includes('role'), `${backend.type} includes role`);
} else {
assert.ok(Object.keys(body).includes('password'), `${backend.type} includes password`);
Expand Down

0 comments on commit 6a98c3f

Please sign in to comment.