Skip to content

Commit

Permalink
refactor: 💡 clean-up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
lisbet-alvarez committed Dec 27, 2024
1 parent 3716bd6 commit 27f3fd2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
10 changes: 1 addition & 9 deletions addons/auth/addon/authenticators/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ export default class BaseAuthenticator extends SimpleAuthBaseAuthenticator {
// The `attributes` field exists on the Go side for its convenience but is
// unnecessary here.
Object.assign(data, data.attributes);
console.log('NormalizeData function ---------------------');
console.log(data);
console.log(username);
console.log('---------------------------------------------');
// Add booleans indicated the scope type
data.isGlobal = data?.scope?.type === 'global';
data.isOrg = data?.scope?.type === 'org';
Expand All @@ -127,18 +123,14 @@ export default class BaseAuthenticator extends SimpleAuthBaseAuthenticator {
async invalidate(options) {
const { token } = options;
const deauthEndpointURL = this.buildDeauthEndpointURL(options);
const response = await waitForPromise(
await waitForPromise(
fetch(deauthEndpointURL, {
method: 'delete',
headers: { Authorization: `Bearer ${token}` },
}).catch(() => {
/* no op */
}),
);
// await response.json();
const contentType = response.headers.get('content-type');
console.log('TESTING LOGGING OUT (invalidate)', response, contentType);

return super.invalidate(...arguments);
}
}
2 changes: 1 addition & 1 deletion addons/auth/addon/authenticators/oidc.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default class OIDCAuthenticator extends BaseAuthenticator {
// Note: Always consume response object in order to avoid memory leaks.
// visit https://undici.nodejs.org/#/?id=garbage-collection for more info.
const json = await response.json();
console.log('attempt fetch token response: ', response);

if (response.status === 202) {
// The token isn't ready yet, keep trying.
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ export default class ScopesScopeAuthenticateMethodIndexController extends Contro
// TODO: delegate this call from the session service so that we don't have
// to look up the authenticator directly
const json = await oidc.startAuthentication(options);
console.log('startOIDC -----------------------------');
console.log(json);

await this.openExternalOIDCFlow(json.attributes.auth_url);
console.log('open external done!');
console.log('------------------------------------');
}

/**
Expand Down Expand Up @@ -80,7 +75,6 @@ export default class ScopesScopeAuthenticateMethodIndexController extends Contro
authMethod,
});
this.router.transitionTo('scopes.scope.authenticate.method.oidc');
console.log('route transition called');
break;
}
}
Expand Down

0 comments on commit 27f3fd2

Please sign in to comment.