From e9c297b1cfd43b3d8dce899b76e5ab83647029a9 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 26 Feb 2021 10:42:19 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20update=20token=20endpoi?= =?UTF-8?q?nt=20to=20match=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/mirage/route-handlers/auth.js | 2 +- addons/auth/addon/authenticators/oidc.js | 4 ++-- addons/core/addon/authenticators/oidc.js | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/api/mirage/route-handlers/auth.js b/addons/api/mirage/route-handlers/auth.js index bc2deb61c..59a2f896e 100644 --- a/addons/api/mirage/route-handlers/auth.js +++ b/addons/api/mirage/route-handlers/auth.js @@ -69,7 +69,7 @@ const methodHandlers = { token_request_id: 'token_request_1234', state: 'base_58_encoded_string' }), - authenticate: (_, scopeAttrs) => { + 'authenticate:token': (_, scopeAttrs) => { oidcAttemptCounter++; if (oidcAttemptCounter < oidcRequiredAttempts) { return new Response(100); diff --git a/addons/auth/addon/authenticators/oidc.js b/addons/auth/addon/authenticators/oidc.js index 4554a9357..ae6e4fbcd 100644 --- a/addons/auth/addon/authenticators/oidc.js +++ b/addons/auth/addon/authenticators/oidc.js @@ -22,7 +22,7 @@ export default class OIDCAuthenticator extends BaseAuthenticator { * @param {string} options.authMethod.id * @return {string} */ - buildAuthEndpointURL(/* { + buildTokenAuthEndpointURL(/* { scope: { id: scopeID }, authMethod: { id: authMethodID }, } */) { } @@ -79,7 +79,7 @@ export default class OIDCAuthenticator extends BaseAuthenticator { * */ async attemptOIDCAuthentication(options) { - const url = this.buildAuthEndpointURL(options); + const url = this.buildTokenAuthEndpointURL(options); const body = JSON.stringify({ state: this.session.get('data.pending.oidc.state'), token_request_id: this.session.get('data.pending.oidc.token_request_id') diff --git a/addons/core/addon/authenticators/oidc.js b/addons/core/addon/authenticators/oidc.js index 4df2735f9..964818720 100644 --- a/addons/core/addon/authenticators/oidc.js +++ b/addons/core/addon/authenticators/oidc.js @@ -35,19 +35,21 @@ export default class OIDCAuthenticator extends BaseOIDCAuthenticator { } /** - * Generates an auth method URL with which to authenticate. + * Generates a URL from which to obtain a ready Boundary token, after the + * OIDC authentication flow is completed. This endpoint may be polled by the + * client until the token becomes available. * @override * @param {object} options * @param {string} options.scope.scope_id * @param {string} options.authMethod.id * @return {string} */ - buildAuthEndpointURL({ + buildTokenAuthEndpointURL({ scope: { id: scopeID }, authMethod: { id: authMethodID }, }) { const adapter = this.store.adapterFor('application'); - const options = { adapterOptions: { scopeID, method: 'authenticate' } }; + const options = { adapterOptions: { scopeID, method: 'authenticate:token' } }; return adapter.buildURL('auth-method', authMethodID, options, 'findRecord'); }