From 4855c3512fa762f5134f0c3fb7861932c6910708 Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Tue, 7 Sep 2021 11:16:09 +0430 Subject: [PATCH 01/13] Add base class for auth & end session requests --- src/authorization_management_request.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/authorization_management_request.ts diff --git a/src/authorization_management_request.ts b/src/authorization_management_request.ts new file mode 100644 index 0000000..1066fd9 --- /dev/null +++ b/src/authorization_management_request.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ + +export abstract class AuthorizationManagementRequest { + public abstract state: string; + + /* + * Serializes the request object to a JavaScript object + */ + public abstract toJson(): Promise; +} From 8e5a5b2996e4812d18b75d03829194ddc361e69d Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Tue, 7 Sep 2021 11:18:32 +0430 Subject: [PATCH 02/13] Add end session request and authorization request --- src/authorization_request.ts | 4 +- src/endsession_request.ts | 76 ++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/endsession_request.ts diff --git a/src/authorization_request.ts b/src/authorization_request.ts index 775edf0..e3b83cb 100644 --- a/src/authorization_request.ts +++ b/src/authorization_request.ts @@ -12,6 +12,7 @@ * limitations under the License. */ +import {AuthorizationManagementRequest} from './authorization_management_request' import {Crypto, DefaultCrypto} from './crypto_utils'; import {log} from './logger'; import {StringMap} from './types'; @@ -42,7 +43,7 @@ const newState = function(crypto: Crypto): string { * For more information look at * https://tools.ietf.org/html/rfc6749#section-4.1.1 */ -export class AuthorizationRequest { +export class AuthorizationRequest extends AuthorizationManagementRequest { static RESPONSE_TYPE_TOKEN = 'token'; static RESPONSE_TYPE_CODE = 'code'; @@ -66,6 +67,7 @@ export class AuthorizationRequest { request: AuthorizationRequestJson, private crypto: Crypto = new DefaultCrypto(), private usePkce: boolean = true) { + super(); this.clientId = request.client_id; this.redirectUri = request.redirect_uri; this.scope = request.scope; diff --git a/src/endsession_request.ts b/src/endsession_request.ts new file mode 100644 index 0000000..17fc2d7 --- /dev/null +++ b/src/endsession_request.ts @@ -0,0 +1,76 @@ +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {AuthorizationManagementRequest} from './authorization_management_request' +import {Crypto, DefaultCrypto} from './crypto_utils'; +import {StringMap} from './types'; + +/** + * Represents an EndSessionRequest as JSON. + */ +export interface EndSessionRequestJson { + id_token_hint: string; + post_logout_redirect_uri: string; + state?: string; + extras?: StringMap; +} + +/** + * Generates a cryptographically random new state. Useful for CSRF protection. + */ +const SIZE = 10; // 10 bytes +const newState = function(crypto: Crypto): string { + return crypto.generateRandom(SIZE); +}; + +/** + * Represents the EndSessionRequest. + * For more information look at + * http://openid.net/specs/openid-connect-session-1_0.html + */ +export class EndSessionRequest extends AuthorizationManagementRequest { + // NOTE: + // Both post_logout_redirect_uri and state are actually optional. + // However AppAuth is more opionionated, and requires you to use both. + + idTokenHint: string; + postLogoutRedirectUri: string; + state: string; + extras?: StringMap; + + /** + * Constructs a new EndSessionRequest. + * Use a `undefined` value for the `state` parameter, to generate a random + * state for CSRF protection. + */ + constructor(request: EndSessionRequestJson, private crypto: Crypto = new DefaultCrypto()) { + super(); + this.idTokenHint = request.id_token_hint; + this.postLogoutRedirectUri = request.post_logout_redirect_uri; + this.state = request.state || newState(crypto); + this.extras = request.extras; + } + + /** + * Serializes the EndSessionRequest to a JavaScript Object. + */ + toJson(): Promise { + return Promise.resolve({ + id_token_hint: this.idTokenHint, + post_logout_redirect_uri: this.postLogoutRedirectUri, + state: this.state, + extras: this.extras + }); + } +} \ No newline at end of file From 59e7d52d038e87d632350d7ebafedda1fe5da166 Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Tue, 7 Sep 2021 11:23:05 +0430 Subject: [PATCH 03/13] Fix naming --- src/{endsession_request.ts => end_session_request.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{endsession_request.ts => end_session_request.ts} (100%) diff --git a/src/endsession_request.ts b/src/end_session_request.ts similarity index 100% rename from src/endsession_request.ts rename to src/end_session_request.ts From d785c682c1df0e8111e46165a3a6c06d3dec5614 Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Tue, 7 Sep 2021 11:34:27 +0430 Subject: [PATCH 04/13] Add end_session_response file. first refactor all redirect based responses to use a generic base class then create EndSession responses and AuthorizationResponse to use this class --- src/authorization_management_response.ts | 56 ++++++++++++++++++++++++ src/authorization_response.ts | 45 +++---------------- src/end_session_response.ts | 40 +++++++++++++++++ 3 files changed, 101 insertions(+), 40 deletions(-) create mode 100644 src/authorization_management_response.ts create mode 100644 src/end_session_response.ts diff --git a/src/authorization_management_response.ts b/src/authorization_management_response.ts new file mode 100644 index 0000000..94c7b9c --- /dev/null +++ b/src/authorization_management_response.ts @@ -0,0 +1,56 @@ +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Represents the AuthorizationError as a JSON object. + */ +export interface AuthorizationErrorJson { + error: string; + error_description?: string; + error_uri?: string; + state?: string; +} + +export abstract class AuthorizationManagementResponse { + abstract state: string; + public abstract toJson(): object; +} + +/** + * Represents the Authorization error response. + * For more information look at: + * https://tools.ietf.org/html/rfc6749#section-4.1.2.1 + */ +export class AuthorizationError { + error: string; + errorDescription?: string; + errorUri?: string; + state?: string; + + constructor(error: AuthorizationErrorJson) { + this.error = error.error; + this.errorDescription = error.error_description; + this.errorUri = error.error_uri; + this.state = error.state; + } + + toJson(): AuthorizationErrorJson { + return { + error: this.error, + error_description: this.errorDescription, + error_uri: this.errorUri, + state: this.state, + }; + } +} diff --git a/src/authorization_response.ts b/src/authorization_response.ts index 733061e..394d0ac 100644 --- a/src/authorization_response.ts +++ b/src/authorization_response.ts @@ -12,6 +12,8 @@ * limitations under the License. */ +import {AuthorizationManagementResponse} from './authorization_management_response' + /** * Represents the AuthorizationResponse as a JSON object. */ @@ -20,26 +22,17 @@ export interface AuthorizationResponseJson { state: string; } -/** - * Represents the AuthorizationError as a JSON object. - */ -export interface AuthorizationErrorJson { - error: string; - error_description?: string; - error_uri?: string; - state?: string; -} - /** * Represents the Authorization Response type. * For more information look at * https://tools.ietf.org/html/rfc6749#section-4.1.2 */ -export class AuthorizationResponse { +export class AuthorizationResponse extends AuthorizationManagementResponse{ code: string; state: string; constructor(response: AuthorizationResponseJson) { + super(); this.code = response.code; this.state = response.state; } @@ -47,32 +40,4 @@ export class AuthorizationResponse { toJson(): AuthorizationResponseJson { return {code: this.code, state: this.state}; } -} - -/** - * Represents the Authorization error response. - * For more information look at: - * https://tools.ietf.org/html/rfc6749#section-4.1.2.1 - */ -export class AuthorizationError { - error: string; - errorDescription?: string; - errorUri?: string; - state?: string; - - constructor(error: AuthorizationErrorJson) { - this.error = error.error; - this.errorDescription = error.error_description; - this.errorUri = error.error_uri; - this.state = error.state; - } - - toJson(): AuthorizationErrorJson { - return { - error: this.error, - error_description: this.errorDescription, - error_uri: this.errorUri, - state: this.state - }; - } -} +} \ No newline at end of file diff --git a/src/end_session_response.ts b/src/end_session_response.ts new file mode 100644 index 0000000..de2fa68 --- /dev/null +++ b/src/end_session_response.ts @@ -0,0 +1,40 @@ +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {AuthorizationManagementResponse} from './authorization_management_response' + +/** + * Represents the EndSessionResponse as a JSON object. + */ + export interface EndSessionResponseJson { + state: string; +} + +/** + * Represents the EndSession Response type. + * For more information look at + * http://openid.net/specs/openid-connect-session-1_0.html + */ +export class EndSessionResponse extends AuthorizationManagementResponse { + state: string; + + constructor(response: EndSessionResponseJson) { + super(); + this.state = response.state; + } + + toJson(): EndSessionResponseJson { + return {state: this.state}; + } +} \ No newline at end of file From a787bccb88a952a6d1cd82d0fb38d6ea4a1ef987 Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Thu, 9 Sep 2021 09:19:09 +0430 Subject: [PATCH 05/13] Add endSession redirect_based_handler --- src/authorization_management_request.ts | 4 + src/authorization_request.ts | 46 +++++-- src/authorization_request_handler.ts | 45 ++----- src/end_session_redirect_based_handler.ts | 145 ++++++++++++++++++++++ src/end_session_request.ts | 28 +++++ src/redirect_based_handler.ts | 3 +- 6 files changed, 229 insertions(+), 42 deletions(-) create mode 100644 src/end_session_redirect_based_handler.ts diff --git a/src/authorization_management_request.ts b/src/authorization_management_request.ts index 1066fd9..b826157 100644 --- a/src/authorization_management_request.ts +++ b/src/authorization_management_request.ts @@ -12,6 +12,8 @@ * limitations under the License. */ +import {StringMap} from "./types"; + export abstract class AuthorizationManagementRequest { public abstract state: string; @@ -19,4 +21,6 @@ export abstract class AuthorizationManagementRequest { * Serializes the request object to a JavaScript object */ public abstract toJson(): Promise; + + public abstract toRequestMap(): StringMap; } diff --git a/src/authorization_request.ts b/src/authorization_request.ts index e3b83cb..eb25bd2 100644 --- a/src/authorization_request.ts +++ b/src/authorization_request.ts @@ -12,11 +12,17 @@ * limitations under the License. */ -import {AuthorizationManagementRequest} from './authorization_management_request' +import {AuthorizationManagementRequest} from './authorization_management_request'; import {Crypto, DefaultCrypto} from './crypto_utils'; import {log} from './logger'; import {StringMap} from './types'; + + +// TODO(rahulrav@): add more built in parameters. +/* built in parameters. */ +export const BUILT_IN_PARAMETERS = ['redirect_uri', 'client_id', 'response_type', 'state', 'scope']; + /** * Represents an AuthorizationRequest as JSON. */ @@ -33,7 +39,7 @@ export interface AuthorizationRequestJson { /** * Generates a cryptographically random new state. Useful for CSRF protection. */ -const SIZE = 10; // 10 bytes +const SIZE = 10; // 10 bytes const newState = function(crypto: Crypto): string { return crypto.generateRandom(SIZE); }; @@ -64,9 +70,9 @@ export class AuthorizationRequest extends AuthorizationManagementRequest { * state for CSRF protection. */ constructor( - request: AuthorizationRequestJson, - private crypto: Crypto = new DefaultCrypto(), - private usePkce: boolean = true) { + request: AuthorizationRequestJson, + private crypto: Crypto = new DefaultCrypto(), + private usePkce: boolean = true) { super(); this.clientId = request.client_id; this.redirectUri = request.redirect_uri; @@ -85,9 +91,9 @@ export class AuthorizationRequest extends AuthorizationManagementRequest { const codeVerifier = this.crypto.generateRandom(128); const challenge: Promise = this.crypto.deriveChallenge(codeVerifier).catch(error => { - log('Unable to generate PKCE challenge. Not using PKCE', error); - return undefined; - }); + log('Unable to generate PKCE challenge. Not using PKCE', error); + return undefined; + }); return challenge.then(result => { if (result) { // keep track of the code used. @@ -119,4 +125,28 @@ export class AuthorizationRequest extends AuthorizationManagementRequest { }; }); } + toRequestMap(): StringMap { + // build the query string + // coerce to any type for convenience + let requestMap: StringMap = { + redirect_uri: this.redirectUri, + client_id: this.clientId, + response_type: this.responseType, + state: this.state, + scope: this.scope, + }; + + // copy over extras + if (this.extras) { + for (let extra in this.extras) { + if (this.extras.hasOwnProperty(extra)) { + // check before inserting to requestMap + if (BUILT_IN_PARAMETERS.indexOf(extra) < 0) { + requestMap[extra] = this.extras[extra]; + } + } + } + } + return requestMap + } } diff --git a/src/authorization_request_handler.ts b/src/authorization_request_handler.ts index 1739718..a299ba1 100644 --- a/src/authorization_request_handler.ts +++ b/src/authorization_request_handler.ts @@ -12,8 +12,9 @@ * limitations under the License. */ -import {AuthorizationRequest} from './authorization_request'; -import {AuthorizationError, AuthorizationResponse} from './authorization_response'; +import {AuthorizationManagementRequest} from './authorization_management_request'; +import {AuthorizationManagementResponse} from './authorization_management_response'; +import {AuthorizationError} from './authorization_management_response'; import {AuthorizationServiceConfiguration} from './authorization_service_configuration'; import {Crypto} from './crypto_utils'; import {log} from './logger'; @@ -26,16 +27,16 @@ import {StringMap} from './types'; * and an AuthorizationResponse as arguments. */ export type AuthorizationListener = - (request: AuthorizationRequest, - response: AuthorizationResponse|null, + (request: AuthorizationManagementRequest, + response: AuthorizationManagementResponse|null, error: AuthorizationError|null) => void; /** * Represents a structural type holding both authorization request and response. */ export interface AuthorizationRequestResponse { - request: AuthorizationRequest; - response: AuthorizationResponse|null; + request: AuthorizationManagementRequest; + response: AuthorizationManagementResponse|null; error: AuthorizationError|null; } @@ -54,8 +55,8 @@ export class AuthorizationNotifier { * The authorization complete callback. */ onAuthorizationComplete( - request: AuthorizationRequest, - response: AuthorizationResponse|null, + request: AuthorizationManagementRequest, + response: AuthorizationManagementResponse|null, error: AuthorizationError|null): void { if (this.listener) { // complete authorization request @@ -64,9 +65,6 @@ export class AuthorizationNotifier { } } -// TODO(rahulrav@): add more built in parameters. -/* built in parameters. */ -export const BUILT_IN_PARAMETERS = ['redirect_uri', 'client_id', 'response_type', 'state', 'scope']; /** * Defines the interface which is capable of handling an authorization request @@ -83,29 +81,10 @@ export abstract class AuthorizationRequestHandler { */ protected buildRequestUrl( configuration: AuthorizationServiceConfiguration, - request: AuthorizationRequest) { + request: AuthorizationManagementRequest) { // build the query string // coerce to any type for convenience - let requestMap: StringMap = { - 'redirect_uri': request.redirectUri, - 'client_id': request.clientId, - 'response_type': request.responseType, - 'state': request.state, - 'scope': request.scope - }; - - // copy over extras - if (request.extras) { - for (let extra in request.extras) { - if (request.extras.hasOwnProperty(extra)) { - // check before inserting to requestMap - if (BUILT_IN_PARAMETERS.indexOf(extra) < 0) { - requestMap[extra] = request.extras[extra]; - } - } - } - } - + let requestMap: StringMap = request.toRequestMap() let query = this.utils.stringify(requestMap); let baseUrl = configuration.authorizationEndpoint; let url = `${baseUrl}?${query}`; @@ -146,7 +125,7 @@ export abstract class AuthorizationRequestHandler { */ abstract performAuthorizationRequest( configuration: AuthorizationServiceConfiguration, - request: AuthorizationRequest): void; + request: AuthorizationManagementRequest): void; /** * Checks if an authorization flow can be completed, and completes it. diff --git a/src/end_session_redirect_based_handler.ts b/src/end_session_redirect_based_handler.ts new file mode 100644 index 0000000..06a3087 --- /dev/null +++ b/src/end_session_redirect_based_handler.ts @@ -0,0 +1,145 @@ +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {AuthorizationServiceConfiguration} from './authorization_service_configuration'; +import {Crypto, DefaultCrypto} from './crypto_utils'; +import {EndSessionRequest} from './end_session_request'; +import {AuthorizationRequestHandler, AuthorizationRequestResponse} from './authorization_request_handler'; +import {EndSessionResponse} from './end_session_response' +import { AuthorizationError } from './authorization_management_response'; +import {log} from './logger'; +import {BasicQueryStringUtils} from './query_string_utils'; +import {LocalStorageBackend, StorageBackend} from './storage'; +import {LocationLike} from './types'; + + +/** key for endsession request. */ +const endSessionRequestKey = + (handle: string) => { + return `${handle}_appauth_endsession_request`; + } + +/** key for authorization service configuration */ +const authorizationServiceConfigurationKey = + (handle: string) => { + return `${handle}_appauth_authorization_service_configuration`; + } + +/** key in local storage which represents the current endsession request. */ +const ENDSESSION_REQUEST_HANDLE_KEY = 'appauth_current_endsession_request'; + +/** + * Represents an EndSessionRequestHandler which uses a standard + * redirect based code flow. + */ +export class EndSessionRedirectRequestHandler extends AuthorizationRequestHandler { + constructor( + // use the provided storage backend + // or initialize local storage with the default storage backend which + // uses window.localStorage + public storageBackend: StorageBackend = new LocalStorageBackend(), + utils = new BasicQueryStringUtils(), + public locationLike: LocationLike = window.location, + crypto: Crypto = new DefaultCrypto()) { + super(utils, crypto); + } + + performAuthorizationRequest( + configuration: AuthorizationServiceConfiguration, + request: EndSessionRequest) { + const handle = this.crypto.generateRandom(10); + // before you make request, persist all request related data in local storage. + let persisted = Promise.all([ + this.storageBackend.setItem(ENDSESSION_REQUEST_HANDLE_KEY, handle), + request.toJson().then( + result => + this.storageBackend.setItem(endSessionRequestKey(handle), JSON.stringify(result))), + this.storageBackend.setItem( + authorizationServiceConfigurationKey(handle), JSON.stringify(configuration.toJson())), + ]); + + persisted.then(() => { + // make the redirect request + let url = this.buildRequestUrl(configuration, request); + log('Making a request to ', request, url); + this.locationLike.assign(url); + }); + } + + /** + * Attempts to introspect the contents of storage backend and completes the + * request. + */ + protected completeAuthorizationRequest(): Promise { + // TODO(rahulrav@): handle endsession errors. + return this.storageBackend.getItem(ENDSESSION_REQUEST_HANDLE_KEY).then(handle => { + if (handle) { + // we have a pending request. + // fetch endsession request, and check state + return this.storageBackend + .getItem(endSessionRequestKey(handle)) + // requires a corresponding instance of result + // TODO(rahulrav@): check for inconsitent state here + .then(result => JSON.parse(result!)) + .then(json => new EndSessionRequest(json)) + .then(request => { + // check redirect_uri and state + let currentUri = `${this.locationLike.origin}${this.locationLike.pathname}`; + let queryParams = this.utils.parse(this.locationLike, true /* use hash */); + let state: string|undefined = queryParams['state']; + let error: string|undefined = queryParams['error']; + log('Potential endsession request ', currentUri, queryParams, state, error); + let shouldNotify = state === request.state; + let endSessionResponse: EndSessionResponse|null = null; + let endSessionError: AuthorizationError|null = null; + if (shouldNotify) { + if (error) { + // get additional optional info. + let errorUri = queryParams['error_uri']; + let errorDescription = queryParams['error_description']; + endSessionError = new AuthorizationError({ + error: error, + error_description: errorDescription, + error_uri: errorUri, + state: state + }); + } else { + endSessionResponse = new EndSessionResponse({state: state}); + } + // cleanup state + return Promise + .all([ + this.storageBackend.removeItem(ENDSESSION_REQUEST_HANDLE_KEY), + this.storageBackend.removeItem(endSessionRequestKey(handle)), + this.storageBackend.removeItem(authorizationServiceConfigurationKey(handle)) + ]) + .then(() => { + log('Delivering endsession response'); + return { + request: request, + response: endSessionResponse, + error: endSessionError + } as AuthorizationRequestResponse; + }); + } else { + log('Mismatched request (state and request_uri) dont match.'); + return Promise.resolve(null); + } + }); + } else { + return null; + } + }); + } +} \ No newline at end of file diff --git a/src/end_session_request.ts b/src/end_session_request.ts index 17fc2d7..dbe444d 100644 --- a/src/end_session_request.ts +++ b/src/end_session_request.ts @@ -34,6 +34,11 @@ const newState = function(crypto: Crypto): string { return crypto.generateRandom(SIZE); }; +// TODO(rahulrav@): add more built in parameters. +/* built in parameters. */ +export const ENDSESSION_BUILT_IN_PARAMETERS = + ['id_token_hint', 'post_logout_redirect_uri', 'state']; + /** * Represents the EndSessionRequest. * For more information look at @@ -73,4 +78,27 @@ export class EndSessionRequest extends AuthorizationManagementRequest { extras: this.extras }); } + + toRequestMap(): StringMap { + // build the query string + // coerce to any type for convenience + let requestMap: StringMap = { + 'id_token_hint': this.idTokenHint, + 'post_logout_redirect_uri': this.postLogoutRedirectUri, + 'state': this.state + }; + + // copy over extras + if (this.extras) { + for (let extra in this.extras) { + if (this.extras.hasOwnProperty(extra)) { + // check before inserting to requestMap + if (ENDSESSION_BUILT_IN_PARAMETERS.indexOf(extra) < 0) { + requestMap[extra] = this.extras[extra]; + } + } + } + } + return requestMap; + } } \ No newline at end of file diff --git a/src/redirect_based_handler.ts b/src/redirect_based_handler.ts index 7a5f7ea..7f08a7e 100644 --- a/src/redirect_based_handler.ts +++ b/src/redirect_based_handler.ts @@ -14,7 +14,8 @@ import {AuthorizationRequest} from './authorization_request'; import {AuthorizationRequestHandler, AuthorizationRequestResponse} from './authorization_request_handler'; -import {AuthorizationError, AuthorizationResponse} from './authorization_response' +import {AuthorizationResponse} from './authorization_response' +import {AuthorizationError} from './authorization_management_response'; import {AuthorizationServiceConfiguration} from './authorization_service_configuration'; import {Crypto, DefaultCrypto} from './crypto_utils'; import {log} from './logger'; From 13a219e6d2a1fafb0a162545cc4df09974f4991b Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Thu, 9 Sep 2021 09:55:26 +0430 Subject: [PATCH 06/13] Fix typing and code formatting issues --- src/app/index.ts | 2 +- src/authorization_management_request.ts | 2 +- src/authorization_request.ts | 14 +++++++------- src/authorization_response.ts | 2 +- src/end_session_redirect_based_handler.ts | 4 ++-- src/end_session_request.ts | 2 +- src/end_session_response.ts | 2 +- src/node_app/index.ts | 2 +- src/node_support/node_request_handler.ts | 3 ++- src/redirect_based_handler.ts | 2 +- 10 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/app/index.ts b/src/app/index.ts index a4a8d41..3060ddb 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -74,7 +74,7 @@ export class App { // set a listener to listen for authorization responses this.notifier.setAuthorizationListener((request, response, error) => { log('Authorization request complete ', request, response, error); - if (response) { + if (response && response instanceof AuthorizationResponse && request instanceof AuthorizationRequest) { this.request = request; this.response = response; this.code = response.code; diff --git a/src/authorization_management_request.ts b/src/authorization_management_request.ts index b826157..ee16825 100644 --- a/src/authorization_management_request.ts +++ b/src/authorization_management_request.ts @@ -12,7 +12,7 @@ * limitations under the License. */ -import {StringMap} from "./types"; +import {StringMap} from './types'; export abstract class AuthorizationManagementRequest { public abstract state: string; diff --git a/src/authorization_request.ts b/src/authorization_request.ts index eb25bd2..bf3f829 100644 --- a/src/authorization_request.ts +++ b/src/authorization_request.ts @@ -39,7 +39,7 @@ export interface AuthorizationRequestJson { /** * Generates a cryptographically random new state. Useful for CSRF protection. */ -const SIZE = 10; // 10 bytes +const SIZE = 10; // 10 bytes const newState = function(crypto: Crypto): string { return crypto.generateRandom(SIZE); }; @@ -70,9 +70,9 @@ export class AuthorizationRequest extends AuthorizationManagementRequest { * state for CSRF protection. */ constructor( - request: AuthorizationRequestJson, - private crypto: Crypto = new DefaultCrypto(), - private usePkce: boolean = true) { + request: AuthorizationRequestJson, + private crypto: Crypto = new DefaultCrypto(), + private usePkce: boolean = true) { super(); this.clientId = request.client_id; this.redirectUri = request.redirect_uri; @@ -91,9 +91,9 @@ export class AuthorizationRequest extends AuthorizationManagementRequest { const codeVerifier = this.crypto.generateRandom(128); const challenge: Promise = this.crypto.deriveChallenge(codeVerifier).catch(error => { - log('Unable to generate PKCE challenge. Not using PKCE', error); - return undefined; - }); + log('Unable to generate PKCE challenge. Not using PKCE', error); + return undefined; + }); return challenge.then(result => { if (result) { // keep track of the code used. diff --git a/src/authorization_response.ts b/src/authorization_response.ts index 394d0ac..d413e8f 100644 --- a/src/authorization_response.ts +++ b/src/authorization_response.ts @@ -27,7 +27,7 @@ export interface AuthorizationResponseJson { * For more information look at * https://tools.ietf.org/html/rfc6749#section-4.1.2 */ -export class AuthorizationResponse extends AuthorizationManagementResponse{ +export class AuthorizationResponse extends AuthorizationManagementResponse { code: string; state: string; diff --git a/src/end_session_redirect_based_handler.ts b/src/end_session_redirect_based_handler.ts index 06a3087..8fbec64 100644 --- a/src/end_session_redirect_based_handler.ts +++ b/src/end_session_redirect_based_handler.ts @@ -12,12 +12,12 @@ * limitations under the License. */ +import {AuthorizationError} from './authorization_management_response'; +import {AuthorizationRequestHandler, AuthorizationRequestResponse} from './authorization_request_handler'; import {AuthorizationServiceConfiguration} from './authorization_service_configuration'; import {Crypto, DefaultCrypto} from './crypto_utils'; import {EndSessionRequest} from './end_session_request'; -import {AuthorizationRequestHandler, AuthorizationRequestResponse} from './authorization_request_handler'; import {EndSessionResponse} from './end_session_response' -import { AuthorizationError } from './authorization_management_response'; import {log} from './logger'; import {BasicQueryStringUtils} from './query_string_utils'; import {LocalStorageBackend, StorageBackend} from './storage'; diff --git a/src/end_session_request.ts b/src/end_session_request.ts index dbe444d..2ad04f3 100644 --- a/src/end_session_request.ts +++ b/src/end_session_request.ts @@ -79,7 +79,7 @@ export class EndSessionRequest extends AuthorizationManagementRequest { }); } - toRequestMap(): StringMap { + toRequestMap(): StringMap { // build the query string // coerce to any type for convenience let requestMap: StringMap = { diff --git a/src/end_session_response.ts b/src/end_session_response.ts index de2fa68..22c7e7b 100644 --- a/src/end_session_response.ts +++ b/src/end_session_response.ts @@ -17,7 +17,7 @@ import {AuthorizationManagementResponse} from './authorization_management_respon /** * Represents the EndSessionResponse as a JSON object. */ - export interface EndSessionResponseJson { +export interface EndSessionResponseJson { state: string; } diff --git a/src/node_app/index.ts b/src/node_app/index.ts index d0f2fe7..368195f 100644 --- a/src/node_app/index.ts +++ b/src/node_app/index.ts @@ -59,7 +59,7 @@ export class App { this.notifier.setAuthorizationListener((request, response, error) => { log('Authorization request complete ', request, response, error); if (response) { - this.makeRefreshTokenRequest(this.configuration!, request, response) + this.makeRefreshTokenRequest(this.configuration!, request as AuthorizationRequest, response as AuthorizationResponse) .then(result => this.makeAccessTokenRequest(this.configuration!, result.refreshToken!)) .then(() => log('All done.')); } diff --git a/src/node_support/node_request_handler.ts b/src/node_support/node_request_handler.ts index 9349558..d6ff270 100644 --- a/src/node_support/node_request_handler.ts +++ b/src/node_support/node_request_handler.ts @@ -17,7 +17,8 @@ import * as Http from 'http'; import * as Url from 'url'; import {AuthorizationRequest} from '../authorization_request'; import {AuthorizationRequestHandler, AuthorizationRequestResponse} from '../authorization_request_handler'; -import {AuthorizationError, AuthorizationResponse} from '../authorization_response'; +import {AuthorizationResponse} from '../authorization_response'; +import {AuthorizationError} from '../authorization_management_response'; import {AuthorizationServiceConfiguration} from '../authorization_service_configuration'; import {Crypto} from '../crypto_utils'; import {log} from '../logger'; diff --git a/src/redirect_based_handler.ts b/src/redirect_based_handler.ts index 7f08a7e..514248e 100644 --- a/src/redirect_based_handler.ts +++ b/src/redirect_based_handler.ts @@ -12,10 +12,10 @@ * limitations under the License. */ +import {AuthorizationError} from './authorization_management_response'; import {AuthorizationRequest} from './authorization_request'; import {AuthorizationRequestHandler, AuthorizationRequestResponse} from './authorization_request_handler'; import {AuthorizationResponse} from './authorization_response' -import {AuthorizationError} from './authorization_management_response'; import {AuthorizationServiceConfiguration} from './authorization_service_configuration'; import {Crypto, DefaultCrypto} from './crypto_utils'; import {log} from './logger'; From 0881ff3d082aa2e738290674e743fee0f025c42e Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Thu, 9 Sep 2021 11:17:36 +0430 Subject: [PATCH 07/13] Refactor RedirectRequestHandler to handle end session Redirect RequestHandler should handler both endsession and authorization flow --- built/authorization_management_request.d.ts | 6 + built/authorization_management_request.js | 23 +++ built/authorization_management_response.d.ts | 26 ++++ built/authorization_management_response.js | 46 ++++++ built/authorization_request.d.ts | 5 +- built/authorization_request.js | 71 +++++++-- built/authorization_request_handler.d.ts | 18 +-- built/authorization_request_handler.js | 26 +--- built/authorization_response.d.ts | 25 +--- built/authorization_response.js | 54 ++++--- built/end_session_request.d.ts | 36 +++++ built/end_session_request.js | 101 +++++++++++++ built/end_session_response.d.ts | 17 +++ built/end_session_response.js | 51 +++++++ built/node_support/node_request_handler.js | 5 +- built/redirect_based_handler.d.ts | 15 +- built/redirect_based_handler.js | 81 ++++++++--- src/app/index.ts | 1 + src/end_session_redirect_based_handler.ts | 145 ------------------- src/redirect_based_handler.ts | 95 +++++++++--- 20 files changed, 560 insertions(+), 287 deletions(-) create mode 100644 built/authorization_management_request.d.ts create mode 100644 built/authorization_management_request.js create mode 100644 built/authorization_management_response.d.ts create mode 100644 built/authorization_management_response.js create mode 100644 built/end_session_request.d.ts create mode 100644 built/end_session_request.js create mode 100644 built/end_session_response.d.ts create mode 100644 built/end_session_response.js delete mode 100644 src/end_session_redirect_based_handler.ts diff --git a/built/authorization_management_request.d.ts b/built/authorization_management_request.d.ts new file mode 100644 index 0000000..3d04ce5 --- /dev/null +++ b/built/authorization_management_request.d.ts @@ -0,0 +1,6 @@ +import { StringMap } from './types'; +export declare abstract class AuthorizationManagementRequest { + abstract state: string; + abstract toJson(): Promise; + abstract toRequestMap(): StringMap; +} diff --git a/built/authorization_management_request.js b/built/authorization_management_request.js new file mode 100644 index 0000000..c6012f8 --- /dev/null +++ b/built/authorization_management_request.js @@ -0,0 +1,23 @@ +"use strict"; +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AuthorizationManagementRequest = void 0; +var AuthorizationManagementRequest = /** @class */ (function () { + function AuthorizationManagementRequest() { + } + return AuthorizationManagementRequest; +}()); +exports.AuthorizationManagementRequest = AuthorizationManagementRequest; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbl9tYW5hZ2VtZW50X3JlcXVlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXV0aG9yaXphdGlvbl9tYW5hZ2VtZW50X3JlcXVlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7R0FZRzs7O0FBSUg7SUFBQTtJQVNBLENBQUM7SUFBRCx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AgKiBTZXJpYWxpemVzIHRoZSByZXF1ZXN0IG9iamVjdCB0byBhIEphdmFTY3JpcHQgb2JqZWN0XG4gICAqL1xuICBwdWJsaWMgYWJzdHJhY3QgdG9Kc29uKCk6IFByb21pc2U8b2JqZWN0PjtcblxuICBwdWJsaWMgYWJzdHJhY3QgdG9SZXF1ZXN0TWFwKCk6IFN0cmluZ01hcDtcbn1cbiJdfQ== \ No newline at end of file diff --git a/built/authorization_management_response.d.ts b/built/authorization_management_response.d.ts new file mode 100644 index 0000000..719147f --- /dev/null +++ b/built/authorization_management_response.d.ts @@ -0,0 +1,26 @@ +/** + * Represents the AuthorizationError as a JSON object. + */ +export interface AuthorizationErrorJson { + error: string; + error_description?: string; + error_uri?: string; + state?: string; +} +export declare abstract class AuthorizationManagementResponse { + abstract state: string; + abstract toJson(): object; +} +/** + * Represents the Authorization error response. + * For more information look at: + * https://tools.ietf.org/html/rfc6749#section-4.1.2.1 + */ +export declare class AuthorizationError { + error: string; + errorDescription?: string; + errorUri?: string; + state?: string; + constructor(error: AuthorizationErrorJson); + toJson(): AuthorizationErrorJson; +} diff --git a/built/authorization_management_response.js b/built/authorization_management_response.js new file mode 100644 index 0000000..f7ff99f --- /dev/null +++ b/built/authorization_management_response.js @@ -0,0 +1,46 @@ +"use strict"; +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AuthorizationError = exports.AuthorizationManagementResponse = void 0; +var AuthorizationManagementResponse = /** @class */ (function () { + function AuthorizationManagementResponse() { + } + return AuthorizationManagementResponse; +}()); +exports.AuthorizationManagementResponse = AuthorizationManagementResponse; +/** + * Represents the Authorization error response. + * For more information look at: + * https://tools.ietf.org/html/rfc6749#section-4.1.2.1 + */ +var AuthorizationError = /** @class */ (function () { + function AuthorizationError(error) { + this.error = error.error; + this.errorDescription = error.error_description; + this.errorUri = error.error_uri; + this.state = error.state; + } + AuthorizationError.prototype.toJson = function () { + return { + error: this.error, + error_description: this.errorDescription, + error_uri: this.errorUri, + state: this.state, + }; + }; + return AuthorizationError; +}()); +exports.AuthorizationError = AuthorizationError; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbl9tYW5hZ2VtZW50X3Jlc3BvbnNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2F1dGhvcml6YXRpb25fbWFuYWdlbWVudF9yZXNwb25zZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7OztHQVlHOzs7QUFZSDtJQUFBO0lBR0EsQ0FBQztJQUFELHNDQUFDO0FBQUQsQ0FBQyxBQUhELElBR0M7QUFIcUIsMEVBQStCO0FBS3JEOzs7O0dBSUc7QUFDSDtJQU1FLDRCQUFZLEtBQTZCO1FBQ3ZDLElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQztRQUN6QixJQUFJLENBQUMsZ0JBQWdCLEdBQUcsS0FBSyxDQUFDLGlCQUFpQixDQUFDO1FBQ2hELElBQUksQ0FBQyxRQUFRLEdBQUcsS0FBSyxDQUFDLFNBQVMsQ0FBQztRQUNoQyxJQUFJLENBQUMsS0FBSyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUM7SUFDM0IsQ0FBQztJQUVELG1DQUFNLEdBQU47UUFDRSxPQUFPO1lBQ0wsS0FBSyxFQUFFLElBQUksQ0FBQyxLQUFLO1lBQ2pCLGlCQUFpQixFQUFFLElBQUksQ0FBQyxnQkFBZ0I7WUFDeEMsU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ICAgZXJyb3I6IHRoaXMuZXJyb3IsXG4gICAgICBlcnJvcl9kZXNjcmlwdGlvbjogdGhpcy5lcnJvckRlc2NyaXB0aW9uLFxuICAgICAgZXJyb3JfdXJpOiB0aGlzLmVycm9yVXJpLFxuICAgICAgc3RhdGU6IHRoaXMuc3RhdGUsXG4gICAgfTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/built/authorization_request.d.ts b/built/authorization_request.d.ts index f77739a..447e34a 100644 --- a/built/authorization_request.d.ts +++ b/built/authorization_request.d.ts @@ -1,5 +1,7 @@ +import { AuthorizationManagementRequest } from './authorization_management_request'; import { Crypto } from './crypto_utils'; import { StringMap } from './types'; +export declare const BUILT_IN_PARAMETERS: string[]; /** * Represents an AuthorizationRequest as JSON. */ @@ -17,7 +19,7 @@ export interface AuthorizationRequestJson { * For more information look at * https://tools.ietf.org/html/rfc6749#section-4.1.1 */ -export declare class AuthorizationRequest { +export declare class AuthorizationRequest extends AuthorizationManagementRequest { private crypto; private usePkce; static RESPONSE_TYPE_TOKEN: string; @@ -40,4 +42,5 @@ export declare class AuthorizationRequest { * Serializes the AuthorizationRequest to a JavaScript Object. */ toJson(): Promise; + toRequestMap(): StringMap; } diff --git a/built/authorization_request.js b/built/authorization_request.js index b9764ff..268d922 100644 --- a/built/authorization_request.js +++ b/built/authorization_request.js @@ -12,10 +12,29 @@ * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuthorizationRequest = void 0; +exports.AuthorizationRequest = exports.BUILT_IN_PARAMETERS = void 0; +var authorization_management_request_1 = require("./authorization_management_request"); var crypto_utils_1 = require("./crypto_utils"); var logger_1 = require("./logger"); +// TODO(rahulrav@): add more built in parameters. +/* built in parameters. */ +exports.BUILT_IN_PARAMETERS = ['redirect_uri', 'client_id', 'response_type', 'state', 'scope']; /** * Generates a cryptographically random new state. Useful for CSRF protection. */ @@ -28,7 +47,8 @@ var newState = function (crypto) { * For more information look at * https://tools.ietf.org/html/rfc6749#section-4.1.1 */ -var AuthorizationRequest = /** @class */ (function () { +var AuthorizationRequest = /** @class */ (function (_super) { + __extends(AuthorizationRequest, _super); /** * Constructs a new AuthorizationRequest. * Use a `undefined` value for the `state` parameter, to generate a random @@ -37,16 +57,18 @@ var AuthorizationRequest = /** @class */ (function () { function AuthorizationRequest(request, crypto, usePkce) { if (crypto === void 0) { crypto = new crypto_utils_1.DefaultCrypto(); } if (usePkce === void 0) { usePkce = true; } - this.crypto = crypto; - this.usePkce = usePkce; - this.clientId = request.client_id; - this.redirectUri = request.redirect_uri; - this.scope = request.scope; - this.responseType = request.response_type || AuthorizationRequest.RESPONSE_TYPE_CODE; - this.state = request.state || newState(crypto); - this.extras = request.extras; + var _this = _super.call(this) || this; + _this.crypto = crypto; + _this.usePkce = usePkce; + _this.clientId = request.client_id; + _this.redirectUri = request.redirect_uri; + _this.scope = request.scope; + _this.responseType = request.response_type || AuthorizationRequest.RESPONSE_TYPE_CODE; + _this.state = request.state || newState(crypto); + _this.extras = request.extras; // read internal properties if available - this.internal = request.internal; + _this.internal = request.internal; + return _this; } AuthorizationRequest.prototype.setupCodeVerifier = function () { var _this = this; @@ -90,9 +112,32 @@ var AuthorizationRequest = /** @class */ (function () { }; }); }; + AuthorizationRequest.prototype.toRequestMap = function () { + // build the query string + // coerce to any type for convenience + var requestMap = { + redirect_uri: this.redirectUri, + client_id: this.clientId, + response_type: this.responseType, + state: this.state, + scope: this.scope, + }; + // copy over extras + if (this.extras) { + for (var extra in this.extras) { + if (this.extras.hasOwnProperty(extra)) { + // check before inserting to requestMap + if (exports.BUILT_IN_PARAMETERS.indexOf(extra) < 0) { + requestMap[extra] = this.extras[extra]; + } + } + } + } + return requestMap; + }; AuthorizationRequest.RESPONSE_TYPE_TOKEN = 'token'; AuthorizationRequest.RESPONSE_TYPE_CODE = 'code'; return AuthorizationRequest; -}()); +}(authorization_management_request_1.AuthorizationManagementRequest)); exports.AuthorizationRequest = AuthorizationRequest; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbl9yZXF1ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2F1dGhvcml6YXRpb25fcmVxdWVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7OztHQVlHOzs7QUFFSCwrQ0FBcUQ7QUFDckQsbUNBQTZCO0FBZ0I3Qjs7R0FFRztBQUNILElBQU0sSUFBSSxHQUFHLEVBQUUsQ0FBQyxDQUFFLFdBQVc7QUFDN0IsSUFBTSxRQUFRLEdBQUcsVUFBUyxNQUFjO0lBQ3RDLE9BQU8sTUFBTSxDQUFDLGNBQWMsQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUNyQyxDQUFDLENBQUM7QUFFRjs7OztHQUlHO0FBQ0g7SUFlRTs7OztPQUlHO0lBQ0gsOEJBQ0ksT0FBaUMsRUFDekIsTUFBb0MsRUFDcEMsT0FBdUI7UUFEdkIsdUJBQUEsRUFBQSxhQUFxQiw0QkFBYSxFQUFFO1FBQ3BDLHdCQUFBLEVBQUEsY0FBdUI7UUFEdkIsV0FBTSxHQUFOLE1BQU0sQ0FBOEI7UUFDcEMsWUFBTyxHQUFQLE9BQU8sQ0FBZ0I7UUFDakMsSUFBSSxDQUFDLFFBQVEsR0FBRyxPQUFP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Y2hhbGxlbmdlJ10gPSByZXN1bHQ7XG4gICAgICAgICAgLy8gV2UgYWx3YXlzIHVzZSBTMjU2LiBQbGFpbiBpcyBub3QgZ29vZCBlbm91Z2guXG4gICAgICAgICAgdGhpcy5leHRyYXNbJ2NvZGVfY2hhbGxlbmdlX21ldGhvZCddID0gJ1MyNTYnO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9XG4gIH1cblxuICAvKipcbiAgICogU2VyaWFsaXplcyB0aGUgQXV0aG9yaXphdGlvblJlcXVlc3QgdG8gYSBKYXZhU2NyaXB0IE9iamVjdC5cbiAgICovXG4gIHRvSnNvbigpOiBQcm9taXNlPEF1dGhvcml6YXRpb25SZXF1ZXN0SnNvbj4ge1xuICAgIC8vIEFsd2F5cyBtYWtlIHN1cmUgdGhhdCB0aGUgY29kZSB2ZXJpZmllciBpcyBzZXR1cCB3aGVuIHRvSnNvbigpIGlzIGNhbGxlZC5cbiAgICByZXR1cm4gdGhpcy5zZXR1cENvZGVWZXJpZmllcigpLnRoZW4oKCkgPT4ge1xuICAgICAgcmV0dXJuIHtcbiAgICAgICAgcmVzcG9uc2VfdHlwZTogdGhpcy5yZXNwb25zZVR5cGUsXG4gICAgICAgIGNsaWVudF9pZDogdGhpcy5jbGllbnRJZCxcbiAgICAgICAgcmVkaXJlY3RfdXJpOiB0aGlzLnJlZGlyZWN0VXJpLFxuICAgICAgICBzY29wZTogdGhpcy5zY29wZSxcbiAgICAgICAgc3RhdGU6IHRoaXMuc3RhdGUsXG4gICAgICAgIGV4dHJhczogdGhpcy5leHRyYXMsXG4gICAgICAgIGludGVybmFsOiB0aGlzLmludGVybmFsXG4gICAgICB9O1xuICAgIH0pO1xuICB9XG59XG4iXX0= \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbl9yZXF1ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2F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aW5nTWFwID0ge1xuICAgICAgcmVkaXJlY3RfdXJpOiB0aGlzLnJlZGlyZWN0VXJpLFxuICAgICAgY2xpZW50X2lkOiB0aGlzLmNsaWVudElkLFxuICAgICAgcmVzcG9uc2VfdHlwZTogdGhpcy5yZXNwb25zZVR5cGUsXG4gICAgICBzdGF0ZTogdGhpcy5zdGF0ZSxcbiAgICAgIHNjb3BlOiB0aGlzLnNjb3BlLFxuICAgIH07XG5cbiAgICAvLyBjb3B5IG92ZXIgZXh0cmFzXG4gICAgaWYgKHRoaXMuZXh0cmFzKSB7XG4gICAgICBmb3IgKGxldCBleHRyYSBpbiB0aGlzLmV4dHJhcykge1xuICAgICAgICBpZiAodGhpcy5leHRyYXMuaGFzT3duUHJvcGVydHkoZXh0cmEpKSB7XG4gICAgICAgICAgLy8gY2hlY2sgYmVmb3JlIGluc2VydGluZyB0byByZXF1ZXN0TWFwXG4gICAgICAgICAgaWYgKEJVSUxUX0lOX1BBUkFNRVRFUlMuaW5kZXhPZihleHRyYSkgPCAwKSB7XG4gICAgICAgICAgICByZXF1ZXN0TWFwW2V4dHJhXSA9IHRoaXMuZXh0cmFzW2V4dHJhXTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIHJlcXVlc3RNYXBcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/built/authorization_request_handler.d.ts b/built/authorization_request_handler.d.ts index 9d42238..ffe5d80 100644 --- a/built/authorization_request_handler.d.ts +++ b/built/authorization_request_handler.d.ts @@ -1,5 +1,6 @@ -import { AuthorizationRequest } from './authorization_request'; -import { AuthorizationError, AuthorizationResponse } from './authorization_response'; +import { AuthorizationManagementRequest } from './authorization_management_request'; +import { AuthorizationManagementResponse } from './authorization_management_response'; +import { AuthorizationError } from './authorization_management_response'; import { AuthorizationServiceConfiguration } from './authorization_service_configuration'; import { Crypto } from './crypto_utils'; import { QueryStringUtils } from './query_string_utils'; @@ -7,13 +8,13 @@ import { QueryStringUtils } from './query_string_utils'; * This type represents a lambda that can take an AuthorizationRequest, * and an AuthorizationResponse as arguments. */ -export declare type AuthorizationListener = (request: AuthorizationRequest, response: AuthorizationResponse | null, error: AuthorizationError | null) => void; +export declare type AuthorizationListener = (request: AuthorizationManagementRequest, response: AuthorizationManagementResponse | null, error: AuthorizationError | null) => void; /** * Represents a structural type holding both authorization request and response. */ export interface AuthorizationRequestResponse { - request: AuthorizationRequest; - response: AuthorizationResponse | null; + request: AuthorizationManagementRequest; + response: AuthorizationManagementResponse | null; error: AuthorizationError | null; } /** @@ -26,9 +27,8 @@ export declare class AuthorizationNotifier { /** * The authorization complete callback. */ - onAuthorizationComplete(request: AuthorizationRequest, response: AuthorizationResponse | null, error: AuthorizationError | null): void; + onAuthorizationComplete(request: AuthorizationManagementRequest, response: AuthorizationManagementResponse | null, error: AuthorizationError | null): void; } -export declare const BUILT_IN_PARAMETERS: string[]; /** * Defines the interface which is capable of handling an authorization request * using various methods (iframe / popup / different process etc.). @@ -41,7 +41,7 @@ export declare abstract class AuthorizationRequestHandler { /** * A utility method to be able to build the authorization request URL. */ - protected buildRequestUrl(configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest): string; + protected buildRequestUrl(configuration: AuthorizationServiceConfiguration, request: AuthorizationManagementRequest): string; /** * Completes the authorization request if necessary & when possible. */ @@ -53,7 +53,7 @@ export declare abstract class AuthorizationRequestHandler { /** * Makes an authorization request. */ - abstract performAuthorizationRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest): void; + abstract performAuthorizationRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationManagementRequest): void; /** * Checks if an authorization flow can be completed, and completes it. * The handler returns a `Promise` if ready, or a `Promise` diff --git a/built/authorization_request_handler.js b/built/authorization_request_handler.js index 01e6dea..2fe8fe7 100644 --- a/built/authorization_request_handler.js +++ b/built/authorization_request_handler.js @@ -13,7 +13,7 @@ * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuthorizationRequestHandler = exports.BUILT_IN_PARAMETERS = exports.AuthorizationNotifier = void 0; +exports.AuthorizationRequestHandler = exports.AuthorizationNotifier = void 0; var logger_1 = require("./logger"); /** * Authorization Service notifier. @@ -38,9 +38,6 @@ var AuthorizationNotifier = /** @class */ (function () { return AuthorizationNotifier; }()); exports.AuthorizationNotifier = AuthorizationNotifier; -// TODO(rahulrav@): add more built in parameters. -/* built in parameters. */ -exports.BUILT_IN_PARAMETERS = ['redirect_uri', 'client_id', 'response_type', 'state', 'scope']; /** * Defines the interface which is capable of handling an authorization request * using various methods (iframe / popup / different process etc.). @@ -58,24 +55,7 @@ var AuthorizationRequestHandler = /** @class */ (function () { AuthorizationRequestHandler.prototype.buildRequestUrl = function (configuration, request) { // build the query string // coerce to any type for convenience - var requestMap = { - 'redirect_uri': request.redirectUri, - 'client_id': request.clientId, - 'response_type': request.responseType, - 'state': request.state, - 'scope': request.scope - }; - // copy over extras - if (request.extras) { - for (var extra in request.extras) { - if (request.extras.hasOwnProperty(extra)) { - // check before inserting to requestMap - if (exports.BUILT_IN_PARAMETERS.indexOf(extra) < 0) { - requestMap[extra] = request.extras[extra]; - } - } - } - } + var requestMap = request.toRequestMap(); var query = this.utils.stringify(requestMap); var baseUrl = configuration.authorizationEndpoint; var url = baseUrl + "?" + query; @@ -112,4 +92,4 @@ var AuthorizationRequestHandler = /** @class */ (function () { return AuthorizationRequestHandler; }()); exports.AuthorizationRequestHandler = AuthorizationRequestHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbl9yZXF1ZXN0X2hhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXV0aG9yaXphdGlvbl9yZXF1ZXN0X2hhbmRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7R0FZRzs7O0FBTUgsbUNBQTZCO0FBdUI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cGxldGVkLCBhbmQgY29tcGxldGVzIGl0LlxuICAgKiBUaGUgaGFuZGxlciByZXR1cm5zIGEgYFByb21pc2U8QXV0aG9yaXphdGlvblJlcXVlc3RSZXNwb25zZT5gIGlmIHJlYWR5LCBvciBhIGBQcm9taXNlPG51bGw+YFxuICAgKiBpZiBub3QgcmVhZHkuXG4gICAqL1xuICBwcm90ZWN0ZWQgYWJzdHJhY3QgY29tcGxldGVBdXRob3JpemF0aW9uUmVxdWVzdCgpOiBQcm9taXNlPEF1dGhvcml6YXRpb25SZXF1ZXN0UmVzcG9uc2V8bnVsbD47XG59XG4iXX0= \ No newline at end of file diff --git a/built/authorization_response.d.ts b/built/authorization_response.d.ts index 9cece73..176593d 100644 --- a/built/authorization_response.d.ts +++ b/built/authorization_response.d.ts @@ -1,3 +1,4 @@ +import { AuthorizationManagementResponse } from './authorization_management_response'; /** * Represents the AuthorizationResponse as a JSON object. */ @@ -5,36 +6,14 @@ export interface AuthorizationResponseJson { code: string; state: string; } -/** - * Represents the AuthorizationError as a JSON object. - */ -export interface AuthorizationErrorJson { - error: string; - error_description?: string; - error_uri?: string; - state?: string; -} /** * Represents the Authorization Response type. * For more information look at * https://tools.ietf.org/html/rfc6749#section-4.1.2 */ -export declare class AuthorizationResponse { +export declare class AuthorizationResponse extends AuthorizationManagementResponse { code: string; state: string; constructor(response: AuthorizationResponseJson); toJson(): AuthorizationResponseJson; } -/** - * Represents the Authorization error response. - * For more information look at: - * https://tools.ietf.org/html/rfc6749#section-4.1.2.1 - */ -export declare class AuthorizationError { - error: string; - errorDescription?: string; - errorUri?: string; - state?: string; - constructor(error: AuthorizationErrorJson); - toJson(): AuthorizationErrorJson; -} diff --git a/built/authorization_response.js b/built/authorization_response.js index 17b5321..ed5bf89 100644 --- a/built/authorization_response.js +++ b/built/authorization_response.js @@ -12,45 +12,41 @@ * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -exports.AuthorizationError = exports.AuthorizationResponse = void 0; +exports.AuthorizationResponse = void 0; +var authorization_management_response_1 = require("./authorization_management_response"); /** * Represents the Authorization Response type. * For more information look at * https://tools.ietf.org/html/rfc6749#section-4.1.2 */ -var AuthorizationResponse = /** @class */ (function () { +var AuthorizationResponse = /** @class */ (function (_super) { + __extends(AuthorizationResponse, _super); function AuthorizationResponse(response) { - this.code = response.code; - this.state = response.state; + var _this = _super.call(this) || this; + _this.code = response.code; + _this.state = response.state; + return _this; } AuthorizationResponse.prototype.toJson = function () { return { code: this.code, state: this.state }; }; return AuthorizationResponse; -}()); +}(authorization_management_response_1.AuthorizationManagementResponse)); exports.AuthorizationResponse = AuthorizationResponse; -/** - * Represents the Authorization error response. - * For more information look at: - * https://tools.ietf.org/html/rfc6749#section-4.1.2.1 - */ -var AuthorizationError = /** @class */ (function () { - function AuthorizationError(error) { - this.error = error.error; - this.errorDescription = error.error_description; - this.errorUri = error.error_uri; - this.state = error.state; - } - AuthorizationError.prototype.toJson = function () { - return { - error: this.error, - error_description: this.errorDescription, - error_uri: this.errorUri, - state: this.state - }; - }; - return AuthorizationError; -}()); -exports.AuthorizationError = AuthorizationError; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbl9yZXNwb25zZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9hdXRob3JpemF0aW9uX3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YXRlOiB0aGlzLnN0YXRlfTtcbiAgfVxufSJdfQ== \ No newline at end of file diff --git a/built/end_session_request.d.ts b/built/end_session_request.d.ts new file mode 100644 index 0000000..bd079dd --- /dev/null +++ b/built/end_session_request.d.ts @@ -0,0 +1,36 @@ +import { AuthorizationManagementRequest } from './authorization_management_request'; +import { Crypto } from './crypto_utils'; +import { StringMap } from './types'; +/** + * Represents an EndSessionRequest as JSON. + */ +export interface EndSessionRequestJson { + id_token_hint: string; + post_logout_redirect_uri: string; + state?: string; + extras?: StringMap; +} +export declare const ENDSESSION_BUILT_IN_PARAMETERS: string[]; +/** + * Represents the EndSessionRequest. + * For more information look at + * http://openid.net/specs/openid-connect-session-1_0.html + */ +export declare class EndSessionRequest extends AuthorizationManagementRequest { + private crypto; + idTokenHint: string; + postLogoutRedirectUri: string; + state: string; + extras?: StringMap; + /** + * Constructs a new EndSessionRequest. + * Use a `undefined` value for the `state` parameter, to generate a random + * state for CSRF protection. + */ + constructor(request: EndSessionRequestJson, crypto?: Crypto); + /** + * Serializes the EndSessionRequest to a JavaScript Object. + */ + toJson(): Promise; + toRequestMap(): StringMap; +} diff --git a/built/end_session_request.js b/built/end_session_request.js new file mode 100644 index 0000000..8456d45 --- /dev/null +++ b/built/end_session_request.js @@ -0,0 +1,101 @@ +"use strict"; +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EndSessionRequest = exports.ENDSESSION_BUILT_IN_PARAMETERS = void 0; +var authorization_management_request_1 = require("./authorization_management_request"); +var crypto_utils_1 = require("./crypto_utils"); +/** + * Generates a cryptographically random new state. Useful for CSRF protection. + */ +var SIZE = 10; // 10 bytes +var newState = function (crypto) { + return crypto.generateRandom(SIZE); +}; +// TODO(rahulrav@): add more built in parameters. +/* built in parameters. */ +exports.ENDSESSION_BUILT_IN_PARAMETERS = ['id_token_hint', 'post_logout_redirect_uri', 'state']; +/** + * Represents the EndSessionRequest. + * For more information look at + * http://openid.net/specs/openid-connect-session-1_0.html + */ +var EndSessionRequest = /** @class */ (function (_super) { + __extends(EndSessionRequest, _super); + /** + * Constructs a new EndSessionRequest. + * Use a `undefined` value for the `state` parameter, to generate a random + * state for CSRF protection. + */ + function EndSessionRequest(request, crypto) { + if (crypto === void 0) { crypto = new crypto_utils_1.DefaultCrypto(); } + var _this = _super.call(this) || this; + _this.crypto = crypto; + _this.idTokenHint = request.id_token_hint; + _this.postLogoutRedirectUri = request.post_logout_redirect_uri; + _this.state = request.state || newState(crypto); + _this.extras = request.extras; + return _this; + } + /** + * Serializes the EndSessionRequest to a JavaScript Object. + */ + EndSessionRequest.prototype.toJson = function () { + return Promise.resolve({ + id_token_hint: this.idTokenHint, + post_logout_redirect_uri: this.postLogoutRedirectUri, + state: this.state, + extras: this.extras + }); + }; + EndSessionRequest.prototype.toRequestMap = function () { + // build the query string + // coerce to any type for convenience + var requestMap = { + 'id_token_hint': this.idTokenHint, + 'post_logout_redirect_uri': this.postLogoutRedirectUri, + 'state': this.state + }; + // copy over extras + if (this.extras) { + for (var extra in this.extras) { + if (this.extras.hasOwnProperty(extra)) { + // check before inserting to requestMap + if (exports.ENDSESSION_BUILT_IN_PARAMETERS.indexOf(extra) < 0) { + requestMap[extra] = this.extras[extra]; + } + } + } + } + return requestMap; + }; + return EndSessionRequest; +}(authorization_management_request_1.AuthorizationManagementRequest)); +exports.EndSessionRequest = EndSessionRequest; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW5kX3Nlc3Npb25fcmVxdWVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9lbmRfc2Vzc2lvbl9yZXF1ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7O0dBWUc7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUVILHVGQUFpRjtBQUNqRiwrQ0FBcUQ7QUFhckQ7O0dBRUc7QUFDSCxJQUFNLElBQUksR0FBRyxFQUFFLENBQUMsQ0FBRSxXQUFXO0FBQzdCLElBQU0sUUFBUSxHQUFHLFVBQVMsTUFBYztJQUN0QyxPQUFPLE1BQU0sQ0FBQyxjQUFjLENBQUMsSUFBSSxDQUFDLENBQUM7QUFDckMsQ0FBQyxDQUFDO0FBRUYsaURBQWlEO0FBQ2pELDBCQUEwQjtBQUNiLFFBQUEsOEJBQThCLEdBQ3ZDLENBQUMsZUFBZSxFQUFFLDBCQUEwQixFQUFFLE9BQU8sQ0FBQyxDQUFDO0FBRTNEOzs7O0dBSUc7QUFDSDtJQUF1QyxxQ0FBOEI7SUFVbkU7Ozs7T0FJRztJQUNILDJCQUFZLE9BQThCLEVBQVUsTUFBb0M7UUFBcEMsdUJBQUEsRUFBQSxhQUFxQiw0QkFBYSxFQUFFO1FBQXhGLFlBQ0UsaUJBQU8sU0FLUjtRQU5tRCxZQUFNLEdBQU4sTUFBTSxDQUE4QjtRQUV0RixLQUFJLENBQUMsV0FBVyxHQUFHLE9BQU8sQ0FBQ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gZXh0cmFzXG4gICAgaWYgKHRoaXMuZXh0cmFzKSB7XG4gICAgICBmb3IgKGxldCBleHRyYSBpbiB0aGlzLmV4dHJhcykge1xuICAgICAgICBpZiAodGhpcy5leHRyYXMuaGFzT3duUHJvcGVydHkoZXh0cmEpKSB7XG4gICAgICAgICAgLy8gY2hlY2sgYmVmb3JlIGluc2VydGluZyB0byByZXF1ZXN0TWFwXG4gICAgICAgICAgaWYgKEVORFNFU1NJT05fQlVJTFRfSU5fUEFSQU1FVEVSUy5pbmRleE9mKGV4dHJhKSA8IDApIHtcbiAgICAgICAgICAgIHJlcXVlc3RNYXBbZXh0cmFdID0gdGhpcy5leHRyYXNbZXh0cmFdO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gcmVxdWVzdE1hcDtcbiAgfVxufSJdfQ== \ No newline at end of file diff --git a/built/end_session_response.d.ts b/built/end_session_response.d.ts new file mode 100644 index 0000000..2162aa6 --- /dev/null +++ b/built/end_session_response.d.ts @@ -0,0 +1,17 @@ +import { AuthorizationManagementResponse } from './authorization_management_response'; +/** + * Represents the EndSessionResponse as a JSON object. + */ +export interface EndSessionResponseJson { + state: string; +} +/** + * Represents the EndSession Response type. + * For more information look at + * http://openid.net/specs/openid-connect-session-1_0.html + */ +export declare class EndSessionResponse extends AuthorizationManagementResponse { + state: string; + constructor(response: EndSessionResponseJson); + toJson(): EndSessionResponseJson; +} diff --git a/built/end_session_response.js b/built/end_session_response.js new file mode 100644 index 0000000..a3e42f2 --- /dev/null +++ b/built/end_session_response.js @@ -0,0 +1,51 @@ +"use strict"; +/* + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EndSessionResponse = void 0; +var authorization_management_response_1 = require("./authorization_management_response"); +/** + * Represents the EndSession Response type. + * For more information look at + * http://openid.net/specs/openid-connect-session-1_0.html + */ +var EndSessionResponse = /** @class */ (function (_super) { + __extends(EndSessionResponse, _super); + function EndSessionResponse(response) { + var _this = _super.call(this) || this; + _this.state = response.state; + return _this; + } + EndSessionResponse.prototype.toJson = function () { + return { state: this.state }; + }; + return EndSessionResponse; +}(authorization_management_response_1.AuthorizationManagementResponse)); +exports.EndSessionResponse = EndSessionResponse; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW5kX3Nlc3Npb25fcmVzcG9uc2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZW5kX3Nlc3Npb25fcmVzcG9uc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7R0FZRzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBRUgseUZBQW1GO0FBU25GOzs7O0dBSUc7QUFDSDtJQUF3QyxzQ0FBK0I7SUFHckUsNEJBQVksUUFBZ0M7UUFBNUMsWUFDRSxpQkFBTyxTQUVSO1FBREMsS0FBSSxDQUFDLEtBQUssR0FBRyxRQUFRLENBQUMsS0FBS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9uTWFuYWdlbWVudFJlc3BvbnNlfSBmcm9tICcuL2F1dGhvcml6YXRpb25fbWFuYWdlbWVudF9yZXNwb25zZSdcblxuLyoqXG4gKiBSZXByZXNlbnRzIHRoZSBFbmRTZXNzaW9uUmVzcG9uc2UgYXMgYSBKU09OIG9iamVjdC5cbiAqL1xuZXhwb3J0IGludGVyZmFjZSBFbmRTZXNzaW9uUmVzcG9uc2VKc29uIHtcbiAgc3RhdGU6IHN0cmluZztcbn1cblxuLyoqXG4gKiBSZXByZXNlbnRzIHRoZSBFbmRTZXNzaW9uIFJlc3BvbnNlIHR5cGUuXG4gKiBGb3IgbW9yZSBpbmZvcm1hdGlvbiBsb29rIGF0XG4gKiBodHRwOi8vb3BlbmlkLm5ldC9zcGVjcy9vcGVuaWQtY29ubmVjdC1zZXNzaW9uLTFfMC5odG1sXG4gKi9cbmV4cG9ydCBjbGFzcyBFbmRTZXNzaW9uUmVzcG9uc2UgZXh0ZW5kcyBBdXRob3JpemF0aW9uTWFuYWdlbWVudFJlc3BvbnNlIHtcbiAgc3RhdGU6IHN0cmluZztcblxuICBjb25zdHJ1Y3RvcihyZXNwb25zZTogRW5kU2Vzc2lvblJlc3BvbnNlSnNvbikge1xuICAgIHN1cGVyKCk7XG4gICAgdGhpcy5zdGF0ZSA9IHJlc3BvbnNlLnN0YXRlO1xuICB9XG5cbiAgdG9Kc29uKCk6IEVuZFNlc3Npb25SZXNwb25zZUpzb24ge1xuICAgIHJldHVybiB7c3RhdGU6IHRoaXMuc3RhdGV9O1xuICB9XG59Il19 \ No newline at end of file diff --git a/built/node_support/node_request_handler.js b/built/node_support/node_request_handler.js index 079980f..c26af31 100644 --- a/built/node_support/node_request_handler.js +++ b/built/node_support/node_request_handler.js @@ -34,6 +34,7 @@ var Http = require("http"); var Url = require("url"); var authorization_request_handler_1 = require("../authorization_request_handler"); var authorization_response_1 = require("../authorization_response"); +var authorization_management_response_1 = require("../authorization_management_response"); var logger_1 = require("../logger"); var query_string_utils_1 = require("../query_string_utils"); var crypto_utils_1 = require("./crypto_utils"); @@ -88,7 +89,7 @@ var NodeBasedHandler = /** @class */ (function (_super) { // get additional optional info. var errorUri = searchParams.get('error_uri') || undefined; var errorDescription = searchParams.get('error_description') || undefined; - authorizationError = new authorization_response_1.AuthorizationError({ error: error, error_description: errorDescription, error_uri: errorUri, state: state }); + authorizationError = new authorization_management_response_1.AuthorizationError({ error: error, error_description: errorDescription, error_uri: errorUri, state: state }); } else { authorizationResponse = new authorization_response_1.AuthorizationResponse({ code: code, state: state }); @@ -136,4 +137,4 @@ var NodeBasedHandler = /** @class */ (function (_super) { return NodeBasedHandler; }(authorization_request_handler_1.AuthorizationRequestHandler)); exports.NodeBasedHandler = NodeBasedHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZV9yZXF1ZXN0X2hhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbm9kZV9zdXBwb3J0L25vZGVfcmVxdWVzdF9oYW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7O0dBWUc7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUVILGlDQUFvQztBQUNwQywyQkFBNkI7QUFDN0IseUJBQTJCO0FBRTNCLGtGQUEyRztBQUMzRyxvRUFBb0Y7QUFHcEYsb0NBQThCO0FBQzlCLDREQUE4RTtBQUM5RSwrQ0FBMEM7QUFHMUMsaUZBQWlGO0FBQ2pGLCtCQUFrQztBQUVsQztJQUFrQyx1Q0FBWTtJQUE5Qzs7SUFHQSxDQUFDO0lBRlEsc0NBQWtCLEdBQUcsaUJBQWlCLENBQUM7SUFDdkMsNkNBQXlCLEdBQUcsd0JBQXdCLENBQUM7SUFDOUQsMEJBQUM7Q0FBQSxBQUhELENBQWtDLHFCQUFZLEdBRzdDO0FBRUQ7SUFBc0Msb0NBQTJCO0lBSS9EO0lB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2RlVmVyaWZpZXIoKVxuICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgc2VydmVyID0gSHR0cC5jcmVhdGVTZXJ2ZXIocmVxdWVzdEhhbmRsZXIpO1xuICAgICAgICAgIHNlcnZlci5saXN0ZW4odGhpcy5odHRwU2VydmVyUG9ydCk7XG4gICAgICAgICAgY29uc3QgdXJsID0gdGhpcy5idWlsZFJlcXVlc3RVcmwoY29uZmlndXJhdGlvbiwgcmVxdWVzdCk7XG4gICAgICAgICAgbG9nKCdNYWtpbmcgYSByZXF1ZXN0IHRvICcsIHJlcXVlc3QsIHVybCk7XG4gICAgICAgICAgb3BlbmVyKHVybCk7XG4gICAgICAgIH0pXG4gICAgICAgIC5jYXRjaCgoZXJyb3IpID0+IHtcbiAgICAgICAgICBsb2coJ1NvbWV0aGluZyBiYWQgaGFwcGVuZWQgJywgZXJyb3IpO1xuICAgICAgICAgIGVtaXR0ZXIuZW1pdChTZXJ2ZXJFdmVudHNFbWl0dGVyLk9OX1VOQUJMRV9UT19TVEFSVCk7XG4gICAgICAgIH0pO1xuICB9XG5cbiAgcHJvdGVjdGVkIGNvbXBsZXRlQXV0aG9yaXphdGlvblJlcXVlc3QoKTogUHJvbWlzZTxBdXRob3JpemF0aW9uUmVxdWVzdFJlc3BvbnNlfG51bGw+IHtcbiAgICBpZiAoIXRoaXMuYXV0aG9yaXphdGlvblByb21pc2UpIHtcbiAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChcbiAgICAgICAgICAnTm8gcGVuZGluZyBhdXRob3JpemF0aW9uIHJlcXVlc3QuIENhbGwgcGVyZm9ybUF1dGhvcml6YXRpb25SZXF1ZXN0KCkgPycpO1xuICAgIH1cblxuICAgIHJldHVybiB0aGlzLmF1dGhvcml6YXRpb25Qcm9taXNlO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/built/redirect_based_handler.d.ts b/built/redirect_based_handler.d.ts index 5fcdabc..4c3ecb0 100644 --- a/built/redirect_based_handler.d.ts +++ b/built/redirect_based_handler.d.ts @@ -2,6 +2,7 @@ import { AuthorizationRequest } from './authorization_request'; import { AuthorizationRequestHandler, AuthorizationRequestResponse } from './authorization_request_handler'; import { AuthorizationServiceConfiguration } from './authorization_service_configuration'; import { Crypto } from './crypto_utils'; +import { EndSessionRequest } from './end_session_request'; import { BasicQueryStringUtils } from './query_string_utils'; import { StorageBackend } from './storage'; import { LocationLike } from './types'; @@ -14,9 +15,21 @@ export declare class RedirectRequestHandler extends AuthorizationRequestHandler locationLike: LocationLike; constructor(storageBackend?: StorageBackend, utils?: BasicQueryStringUtils, locationLike?: LocationLike, crypto?: Crypto); performAuthorizationRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest): void; + performEndSessionRequest(configuration: AuthorizationServiceConfiguration, request: EndSessionRequest): void; + private performRequest; /** * Attempts to introspect the contents of storage backend and completes the - * request. + * authorization request. */ protected completeAuthorizationRequest(): Promise; + /** + * Attempts to introspect the contents of storage backend and completes the + * end session request. + */ + protected completeEndSessionRequest(): Promise; + /** + * Attempts to introspect the contents of storage backend and completes the + * request. + */ + private completeRequest; } diff --git a/built/redirect_based_handler.js b/built/redirect_based_handler.js index fc54f68..25001c5 100644 --- a/built/redirect_based_handler.js +++ b/built/redirect_based_handler.js @@ -29,23 +29,31 @@ var __extends = (this && this.__extends) || (function () { })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.RedirectRequestHandler = void 0; +var authorization_management_response_1 = require("./authorization_management_response"); var authorization_request_1 = require("./authorization_request"); var authorization_request_handler_1 = require("./authorization_request_handler"); var authorization_response_1 = require("./authorization_response"); var crypto_utils_1 = require("./crypto_utils"); +var end_session_request_1 = require("./end_session_request"); +var end_session_response_1 = require("./end_session_response"); var logger_1 = require("./logger"); var query_string_utils_1 = require("./query_string_utils"); var storage_1 = require("./storage"); +var RequestTypes; +(function (RequestTypes) { + RequestTypes["endSession"] = "end_session"; + RequestTypes["authorization"] = "authorization"; +})(RequestTypes || (RequestTypes = {})); /** key for authorization request. */ -var authorizationRequestKey = function (handle) { - return handle + "_appauth_authorization_request"; +var requestKey = function (handle, requestType) { + return handle + "_appauth_" + requestType + "_request"; }; /** key for authorization service configuration */ -var authorizationServiceConfigurationKey = function (handle) { - return handle + "_appauth_authorization_service_configuration"; +var serviceConfigurationKey = function (handle, requestType) { + return handle + "_appauth_" + requestType + "_service_configuration"; }; /** key in local storage which represents the current authorization request. */ -var AUTHORIZATION_REQUEST_HANDLE_KEY = 'appauth_current_authorization_request'; +var REQUEST_HANDLE_KEY = function (requestType) { return "appauth_current_" + requestType + "_request"; }; /** * Represents an AuthorizationRequestHandler which uses a standard * redirect based code flow. @@ -67,16 +75,23 @@ var RedirectRequestHandler = /** @class */ (function (_super) { return _this; } RedirectRequestHandler.prototype.performAuthorizationRequest = function (configuration, request) { + this.performRequest(configuration, request, RequestTypes.authorization); + }; + RedirectRequestHandler.prototype.performEndSessionRequest = function (configuration, request) { + this.performRequest(configuration, request, RequestTypes.endSession); + }; + RedirectRequestHandler.prototype.performRequest = function (configuration, request, requestType) { var _this = this; + if (requestType === void 0) { requestType = RequestTypes.authorization; } var handle = this.crypto.generateRandom(10); // before you make request, persist all request related data in local storage. var persisted = Promise.all([ - this.storageBackend.setItem(AUTHORIZATION_REQUEST_HANDLE_KEY, handle), + this.storageBackend.setItem(REQUEST_HANDLE_KEY(requestType), handle), // Calling toJson() adds in the code & challenge when possible request.toJson().then(function (result) { - return _this.storageBackend.setItem(authorizationRequestKey(handle), JSON.stringify(result)); + return _this.storageBackend.setItem(requestKey(handle, requestType), JSON.stringify(result)); }), - this.storageBackend.setItem(authorizationServiceConfigurationKey(handle), JSON.stringify(configuration.toJson())), + this.storageBackend.setItem(serviceConfigurationKey(handle, requestType), JSON.stringify(configuration.toJson())), ]); persisted.then(function () { // make the redirect request @@ -87,21 +102,37 @@ var RedirectRequestHandler = /** @class */ (function (_super) { }; /** * Attempts to introspect the contents of storage backend and completes the - * request. + * authorization request. */ RedirectRequestHandler.prototype.completeAuthorizationRequest = function () { + return this.completeRequest(RequestTypes.authorization); + }; + /** + * Attempts to introspect the contents of storage backend and completes the + * end session request. + */ + RedirectRequestHandler.prototype.completeEndSessionRequest = function () { + return this.completeRequest(RequestTypes.endSession); + }; + /** + * Attempts to introspect the contents of storage backend and completes the + * request. + */ + RedirectRequestHandler.prototype.completeRequest = function (requestType) { var _this = this; // TODO(rahulrav@): handle authorization errors. - return this.storageBackend.getItem(AUTHORIZATION_REQUEST_HANDLE_KEY).then(function (handle) { + return this.storageBackend.getItem(REQUEST_HANDLE_KEY(requestType)).then(function (handle) { if (handle) { // we have a pending request. // fetch authorization request, and check state return _this.storageBackend - .getItem(authorizationRequestKey(handle)) + .getItem(requestKey(handle, requestType)) // requires a corresponding instance of result - // TODO(rahulrav@): check for inconsitent state here + // TODO(rahulrav@): check for inconsistent state here .then(function (result) { return JSON.parse(result); }) - .then(function (json) { return new authorization_request_1.AuthorizationRequest(json); }) + .then(function (json) { return requestType === RequestTypes.authorization ? + new authorization_request_1.AuthorizationRequest(json) : + new end_session_request_1.EndSessionRequest(json); }) .then(function (request) { // check redirect_uri and state var currentUri = "" + _this.locationLike.origin + _this.locationLike.pathname; @@ -109,7 +140,12 @@ var RedirectRequestHandler = /** @class */ (function (_super) { var state = queryParams['state']; var code = queryParams['code']; var error = queryParams['error']; - logger_1.log('Potential authorization request ', currentUri, queryParams, state, code, error); + if (requestType === RequestTypes.authorization) { + logger_1.log('Potential authorization request ', currentUri, queryParams, state, code, error); + } + else { + logger_1.log('Potential end session request ', currentUri, queryParams, state, error); + } var shouldNotify = state === request.state; var authorizationResponse = null; var authorizationError = null; @@ -118,7 +154,7 @@ var RedirectRequestHandler = /** @class */ (function (_super) { // get additional optional info. var errorUri = queryParams['error_uri']; var errorDescription = queryParams['error_description']; - authorizationError = new authorization_response_1.AuthorizationError({ + authorizationError = new authorization_management_response_1.AuthorizationError({ error: error, error_description: errorDescription, error_uri: errorUri, @@ -126,14 +162,19 @@ var RedirectRequestHandler = /** @class */ (function (_super) { }); } else { - authorizationResponse = new authorization_response_1.AuthorizationResponse({ code: code, state: state }); + if (requestType === RequestTypes.authorization) { + authorizationResponse = new authorization_response_1.AuthorizationResponse({ code: code, state: state }); + } + else if (requestType === RequestTypes.endSession) { + authorizationResponse = new end_session_response_1.EndSessionResponse({ state: state }); + } } // cleanup state return Promise .all([ - _this.storageBackend.removeItem(AUTHORIZATION_REQUEST_HANDLE_KEY), - _this.storageBackend.removeItem(authorizationRequestKey(handle)), - _this.storageBackend.removeItem(authorizationServiceConfigurationKey(handle)) + _this.storageBackend.removeItem(REQUEST_HANDLE_KEY(requestType)), + _this.storageBackend.removeItem(requestKey(handle, requestType)), + _this.storageBackend.removeItem(serviceConfigurationKey(handle, requestType)) ]) .then(function () { logger_1.log('Delivering authorization response'); @@ -158,4 +199,4 @@ var RedirectRequestHandler = /** @class */ (function (_super) { return RedirectRequestHandler; }(authorization_request_handler_1.AuthorizationRequestHandler)); exports.RedirectRequestHandler = RedirectRequestHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVkaXJlY3RfYmFzZWRfaGFuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9yZWRpcmVjdF9iYXNlZF9oYW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7O0dBWUc7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUVILGlFQUE2RDtBQUM3RCxpRkFBMEc7QUFDMUcsbUVBQWtGO0FBRWxGLCtDQUFxRDtBQUNyRCxtQ0FBNkI7QUFDN0IsMkRBQTJEO0FBQzNELHFDQUE4RDtBQUk5RCxxQ0FBcUM7QUFDckMsSUFBTSx1QkFBdUIsR0FDekIsVUFBQyxNQUFjO0lBQ2IsT0FBVSxNQUFNLG1DQUFnQyxDQUFDO0FBQ25ELENBQUMsQ0FBQTtBQUVMLGtEQUF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0aW9uIHJlcXVlc3QgJywgY3VycmVudFVyaSwgcXVlcnlQYXJhbXMsIHN0YXRlLCBjb2RlLCBlcnJvcik7XG4gICAgICAgICAgICAgIGxldCBzaG91bGROb3RpZnkgPSBzdGF0ZSA9PT0gcmVxdWVzdC5zdGF0ZTtcbiAgICAgICAgICAgICAgbGV0IGF1dGhvcml6YXRpb25SZXNwb25zZTogQXV0aG9yaXphdGlvblJlc3BvbnNlfG51bGwgPSBudWxsO1xuICAgICAgICAgICAgICBsZXQgYXV0aG9yaXphdGlvbkVycm9yOiBBdXRob3JpemF0aW9uRXJyb3J8bnVsbCA9IG51bGw7XG4gICAgICAgICAgICAgIGlmIChzaG91bGROb3RpZnkpIHtcbiAgICAgICAgICAgICAgICBpZiAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgIC8vIGdldCBhZGRpdGlvbmFsIG9wdGlvbmFsIGluZm8uXG4gICAgICAgICAgICAgICAgICBsZXQgZXJyb3JVcmkgPSBxdWVyeVBhcmFtc1snZXJyb3JfdXJpJ107XG4gICAgICAgICAgICAgICAgICBsZXQgZXJyb3JEZXNjcmlwdGlvbiA9IHF1ZXJ5UGFyYW1zWydlcnJvcl9kZXNjcmlwdGlvbiddO1xuICAgICAgICAgICAgICAgICAgYXV0aG9yaXphdGlvbkVycm9yID0gbmV3IEF1dGhvcml6YXRpb25FcnJvcih7XG4gICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcnJvcixcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yRGVzY3JpcHRpb24sXG4gICAgICAgICAgICAgICAgICAgIGVycm9yX3VyaTogZXJyb3JVcmksXG4gICAgICAgICAgICAgICAgICAgIHN0YXRlOiBzdGF0ZVxuICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIGF1dGhvcml6YXRpb25SZXNwb25zZSA9IG5ldyBBdXRob3JpemF0aW9uUmVzcG9uc2Uoe2NvZGU6IGNvZGUsIHN0YXRlOiBzdGF0ZX0pO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBjbGVhbnVwIHN0YXRlXG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2VcbiAgICAgICAgICAgICAgICAgICAgLmFsbChbXG4gICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdG9yYWdlQmFja2VuZC5yZW1vdmVJdGVtKEFVVEhPUklaQVRJT05fUkVRVUVTVF9IQU5ETEVfS0VZKSxcbiAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0b3JhZ2VCYWNrZW5kLnJlbW92ZUl0ZW0oYXV0aG9yaXphdGlvblJlcXVlc3RLZXkoaGFuZGxlKSksXG4gICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdG9yYWdlQmFja2VuZC5yZW1vdmVJdGVtKGF1dGhvcml6YXRpb25TZXJ2aWNlQ29uZmlndXJhdGlvbktleShoYW5kbGUpKVxuICAgICAgICAgICAgICAgICAgICBdKVxuICAgICAgICAgICAgICAgICAgICAudGhlbigoKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgbG9nKCdEZWxpdmVyaW5nIGF1dGhvcml6YXRpb24gcmVzcG9uc2UnKTtcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdDogcmVxdWVzdCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlOiBhdXRob3JpemF0aW9uUmVzcG9uc2UsXG4gICAgICAgICAgICAgICAgICAgICAgICBlcnJvcjogYXV0aG9yaXphdGlvbkVycm9yXG4gICAgICAgICAgICAgICAgICAgICAgfSBhcyBBdXRob3JpemF0aW9uUmVxdWVzdFJlc3BvbnNlO1xuICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBsb2coJ01pc21hdGNoZW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bmRlZmluZWQgPSBxdWVyeVBhcmFtc1snY29kZSddO1xuICAgICAgICAgICAgICBsZXQgZXJyb3I6IHN0cmluZ3x1bmRlZmluZWQgPSBxdWVyeVBhcmFtc1snZXJyb3InXTtcbiAgICAgICAgICAgICAgaWYgKHJlcXVlc3RUeXBlID09PSBSZXF1ZXN0VHlwZXMuYXV0aG9yaXphdGlvbikge1xuICAgICAgICAgICAgICAgIGxvZygnUG90ZW50aWFsIGF1dGhvcml6YXRpb24gcmVxdWVzdCAnLFxuICAgICAgICAgICAgICAgICAgICBjdXJyZW50VXJpLFxuICAgICAgICAgICAgICAgICAgICBxdWVyeVBhcmFtcyxcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUsXG4gICAgICAgICAgICAgICAgICAgIGNvZGUsXG4gICAgICAgICAgICAgICAgICAgIGVycm9yKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBsb2coJ1BvdGVudGlhbCBlbmQgc2Vzc2lvbiByZXF1ZXN0ICcsIGN1cnJlbnRVcmksIHF1ZXJ5UGFyYW1zLCBzdGF0ZSwgZXJyb3IpXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgbGV0IHNob3VsZE5vdGlmeSA9IHN0YXRlID09PSByZXF1ZXN0LnN0YXRlO1xuICAgICAgICAgICAgICBsZXQgYXV0aG9yaXphdGlvblJlc3BvbnNlOiBFbmRTZXNzaW9uUmVzcG9uc2V8QXV0aG9yaXphdGlvblJlc3BvbnNlfG51bGwgPSBudWxsO1xuICAgICAgICAgICAgICBsZXQgYXV0aG9yaXphdGlvbkVycm9yOiBBdXRob3JpemF0aW9uRXJyb3J8bnVsbCA9IG51bGw7XG4gICAgICAgICAgICAgIGlmIChzaG91bGROb3RpZnkpIHtcbiAgICAgICAgICAgICAgICBpZiAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgIC8vIGdldCBhZGRpdGlvbmFsIG9wdGlvbmFsIGluZm8uXG4gICAgICAgICAgICAgICAgICBsZXQgZXJyb3JVcmkgPSBxdWVyeVBhcmFtc1snZXJyb3JfdXJpJ107XG4gICAgICAgICAgICAgICAgICBsZXQgZXJyb3JEZXNjcmlwdGlvbiA9IHF1ZXJ5UGFyYW1zWydlcnJvcl9kZXNjcmlwdGlvbiddO1xuICAgICAgICAgICAgICAgICAgYXV0aG9yaXphdGlvbkVycm9yID0gbmV3IEF1dGhvcml6YXRpb25FcnJvcih7XG4gICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcnJvcixcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yRGVzY3JpcHRpb24sXG4gICAgICAgICAgICAgICAgICAgIGVycm9yX3VyaTogZXJyb3JVcmksXG4gICAgICAgICAgICAgICAgICAgIHN0YXRlOiBzdGF0ZVxuICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIGlmIChyZXF1ZXN0VHlwZSA9PT0gUmVxdWVzdFR5cGVzLmF1dGhvcml6YXRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgYXV0aG9yaXphdGlvblJlc3BvbnNlID0gbmV3IEF1dGhvcml6YXRpb25SZXNwb25zZSh7Y29kZTogY29kZSwgc3RhdGU6IHN0YXRlfSk7XG4gICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHJlcXVlc3RUeXBlID09PSBSZXF1ZXN0VHlwZXMuZW5kU2Vzc2lvbikge1xuICAgICAgICAgICAgICAgICAgICBhdXRob3JpemF0aW9uUmVzcG9uc2UgPSBuZXcgRW5kU2Vzc2lvblJlc3BvbnNlKHtzdGF0ZTogc3RhdGV9KVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBjbGVhbnVwIHN0YXRlXG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2VcbiAgICAgICAgICAgICAgICAgICAgLmFsbChbXG4gICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdG9yYWdlQmFja2VuZC5yZW1vdmVJdGVtKFJFUVVFU1RfSEFORExFX0tFWShyZXF1ZXN0VHlwZSkpLFxuICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RvcmFnZUJhY2tlbmQucmVtb3ZlSXRlbShyZXF1ZXN0S2V5KGhhbmRsZSwgcmVxdWVzdFR5cGUpKSxcbiAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0b3JhZ2VCYWNrZW5kLnJlbW92ZUl0ZW0oc2VydmljZUNvbmZpZ3VyYXRpb25LZXkoaGFuZGxlLCByZXF1ZXN0VHlwZSkpXG4gICAgICAgICAgICAgICAgICAgIF0pXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICBsb2coJ0RlbGl2ZXJpbmcgYXV0aG9yaXphdGlvbiByZXNwb25zZScpO1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGF1dGhvcml6YXRpb25SZXNwb25zZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBhdXRob3JpemF0aW9uRXJyb3JcbiAgICAgICAgICAgICAgICAgICAgICB9IGFzIEF1dGhvcml6YXRpb25SZXF1ZXN0UmVzcG9uc2U7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZygnTWlzbWF0Y2hlZCByZXF1ZXN0IChzdGF0ZSBhbmQgcmVxdWVzdF91cmkpIGRvbnQgbWF0Y2guJyk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShudWxsKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/src/app/index.ts b/src/app/index.ts index 3060ddb..d2705ac 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -24,6 +24,7 @@ import {BaseTokenRequestHandler, TokenRequestHandler} from '../token_request_han import {TokenResponse} from '../token_response'; import { AuthorizationResponse } from '../authorization_response'; import { StringMap } from '../types'; +import { EndSessionRequest } from '../end_session_request'; /* Some interface declarations for Material design lite. */ diff --git a/src/end_session_redirect_based_handler.ts b/src/end_session_redirect_based_handler.ts deleted file mode 100644 index 8fbec64..0000000 --- a/src/end_session_redirect_based_handler.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {AuthorizationError} from './authorization_management_response'; -import {AuthorizationRequestHandler, AuthorizationRequestResponse} from './authorization_request_handler'; -import {AuthorizationServiceConfiguration} from './authorization_service_configuration'; -import {Crypto, DefaultCrypto} from './crypto_utils'; -import {EndSessionRequest} from './end_session_request'; -import {EndSessionResponse} from './end_session_response' -import {log} from './logger'; -import {BasicQueryStringUtils} from './query_string_utils'; -import {LocalStorageBackend, StorageBackend} from './storage'; -import {LocationLike} from './types'; - - -/** key for endsession request. */ -const endSessionRequestKey = - (handle: string) => { - return `${handle}_appauth_endsession_request`; - } - -/** key for authorization service configuration */ -const authorizationServiceConfigurationKey = - (handle: string) => { - return `${handle}_appauth_authorization_service_configuration`; - } - -/** key in local storage which represents the current endsession request. */ -const ENDSESSION_REQUEST_HANDLE_KEY = 'appauth_current_endsession_request'; - -/** - * Represents an EndSessionRequestHandler which uses a standard - * redirect based code flow. - */ -export class EndSessionRedirectRequestHandler extends AuthorizationRequestHandler { - constructor( - // use the provided storage backend - // or initialize local storage with the default storage backend which - // uses window.localStorage - public storageBackend: StorageBackend = new LocalStorageBackend(), - utils = new BasicQueryStringUtils(), - public locationLike: LocationLike = window.location, - crypto: Crypto = new DefaultCrypto()) { - super(utils, crypto); - } - - performAuthorizationRequest( - configuration: AuthorizationServiceConfiguration, - request: EndSessionRequest) { - const handle = this.crypto.generateRandom(10); - // before you make request, persist all request related data in local storage. - let persisted = Promise.all([ - this.storageBackend.setItem(ENDSESSION_REQUEST_HANDLE_KEY, handle), - request.toJson().then( - result => - this.storageBackend.setItem(endSessionRequestKey(handle), JSON.stringify(result))), - this.storageBackend.setItem( - authorizationServiceConfigurationKey(handle), JSON.stringify(configuration.toJson())), - ]); - - persisted.then(() => { - // make the redirect request - let url = this.buildRequestUrl(configuration, request); - log('Making a request to ', request, url); - this.locationLike.assign(url); - }); - } - - /** - * Attempts to introspect the contents of storage backend and completes the - * request. - */ - protected completeAuthorizationRequest(): Promise { - // TODO(rahulrav@): handle endsession errors. - return this.storageBackend.getItem(ENDSESSION_REQUEST_HANDLE_KEY).then(handle => { - if (handle) { - // we have a pending request. - // fetch endsession request, and check state - return this.storageBackend - .getItem(endSessionRequestKey(handle)) - // requires a corresponding instance of result - // TODO(rahulrav@): check for inconsitent state here - .then(result => JSON.parse(result!)) - .then(json => new EndSessionRequest(json)) - .then(request => { - // check redirect_uri and state - let currentUri = `${this.locationLike.origin}${this.locationLike.pathname}`; - let queryParams = this.utils.parse(this.locationLike, true /* use hash */); - let state: string|undefined = queryParams['state']; - let error: string|undefined = queryParams['error']; - log('Potential endsession request ', currentUri, queryParams, state, error); - let shouldNotify = state === request.state; - let endSessionResponse: EndSessionResponse|null = null; - let endSessionError: AuthorizationError|null = null; - if (shouldNotify) { - if (error) { - // get additional optional info. - let errorUri = queryParams['error_uri']; - let errorDescription = queryParams['error_description']; - endSessionError = new AuthorizationError({ - error: error, - error_description: errorDescription, - error_uri: errorUri, - state: state - }); - } else { - endSessionResponse = new EndSessionResponse({state: state}); - } - // cleanup state - return Promise - .all([ - this.storageBackend.removeItem(ENDSESSION_REQUEST_HANDLE_KEY), - this.storageBackend.removeItem(endSessionRequestKey(handle)), - this.storageBackend.removeItem(authorizationServiceConfigurationKey(handle)) - ]) - .then(() => { - log('Delivering endsession response'); - return { - request: request, - response: endSessionResponse, - error: endSessionError - } as AuthorizationRequestResponse; - }); - } else { - log('Mismatched request (state and request_uri) dont match.'); - return Promise.resolve(null); - } - }); - } else { - return null; - } - }); - } -} \ No newline at end of file diff --git a/src/redirect_based_handler.ts b/src/redirect_based_handler.ts index 514248e..d96cc2c 100644 --- a/src/redirect_based_handler.ts +++ b/src/redirect_based_handler.ts @@ -12,32 +12,40 @@ * limitations under the License. */ +import {AuthorizationManagementRequest} from './authorization_management_request'; import {AuthorizationError} from './authorization_management_response'; import {AuthorizationRequest} from './authorization_request'; import {AuthorizationRequestHandler, AuthorizationRequestResponse} from './authorization_request_handler'; import {AuthorizationResponse} from './authorization_response' import {AuthorizationServiceConfiguration} from './authorization_service_configuration'; import {Crypto, DefaultCrypto} from './crypto_utils'; +import {EndSessionRequest} from './end_session_request'; +import {EndSessionResponse} from './end_session_response'; import {log} from './logger'; import {BasicQueryStringUtils} from './query_string_utils'; import {LocalStorageBackend, StorageBackend} from './storage'; import {LocationLike} from './types'; +enum RequestTypes { + endSession = 'end_session', + authorization = 'authorization' +} + /** key for authorization request. */ -const authorizationRequestKey = - (handle: string) => { - return `${handle}_appauth_authorization_request`; +const requestKey = + (handle: string, requestType: RequestTypes) => { + return `${handle}_appauth_${requestType}_request`; } /** key for authorization service configuration */ -const authorizationServiceConfigurationKey = - (handle: string) => { - return `${handle}_appauth_authorization_service_configuration`; +const serviceConfigurationKey = + (handle: string, requestType: RequestTypes) => { + return `${handle}_appauth_${requestType}_service_configuration`; } /** key in local storage which represents the current authorization request. */ -const AUTHORIZATION_REQUEST_HANDLE_KEY = 'appauth_current_authorization_request'; +const REQUEST_HANDLE_KEY = (requestType: RequestTypes) => `appauth_current_${requestType}_request`; /** * Represents an AuthorizationRequestHandler which uses a standard @@ -58,17 +66,30 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { performAuthorizationRequest( configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest) { + this.performRequest(configuration, request, RequestTypes.authorization); + } + + performEndSessionRequest( + configuration: AuthorizationServiceConfiguration, + request: EndSessionRequest) { + this.performRequest(configuration, request, RequestTypes.endSession); + } + + private performRequest( + configuration: AuthorizationServiceConfiguration, + request: AuthorizationManagementRequest, + requestType: RequestTypes = RequestTypes.authorization) { const handle = this.crypto.generateRandom(10); // before you make request, persist all request related data in local storage. const persisted = Promise.all([ - this.storageBackend.setItem(AUTHORIZATION_REQUEST_HANDLE_KEY, handle), + this.storageBackend.setItem(REQUEST_HANDLE_KEY(requestType), handle), // Calling toJson() adds in the code & challenge when possible request.toJson().then( result => - this.storageBackend.setItem(authorizationRequestKey(handle), JSON.stringify(result))), + this.storageBackend.setItem(requestKey(handle, requestType), JSON.stringify(result))), this.storageBackend.setItem( - authorizationServiceConfigurationKey(handle), JSON.stringify(configuration.toJson())), + serviceConfigurationKey(handle, requestType), JSON.stringify(configuration.toJson())), ]); persisted.then(() => { @@ -81,20 +102,39 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { /** * Attempts to introspect the contents of storage backend and completes the - * request. + * authorization request. */ protected completeAuthorizationRequest(): Promise { + return this.completeRequest(RequestTypes.authorization); + } + + /** + * Attempts to introspect the contents of storage backend and completes the + * end session request. + */ + protected completeEndSessionRequest(): Promise { + return this.completeRequest(RequestTypes.endSession); + } + + /** + * Attempts to introspect the contents of storage backend and completes the + * request. + */ + private completeRequest(requestType: RequestTypes) { // TODO(rahulrav@): handle authorization errors. - return this.storageBackend.getItem(AUTHORIZATION_REQUEST_HANDLE_KEY).then(handle => { + return this.storageBackend.getItem(REQUEST_HANDLE_KEY(requestType)).then(handle => { if (handle) { // we have a pending request. // fetch authorization request, and check state return this.storageBackend - .getItem(authorizationRequestKey(handle)) + .getItem(requestKey(handle, requestType)) // requires a corresponding instance of result - // TODO(rahulrav@): check for inconsitent state here + // TODO(rahulrav@): check for inconsistent state here .then(result => JSON.parse(result!)) - .then(json => new AuthorizationRequest(json)) + .then( + json => requestType === RequestTypes.authorization ? + new AuthorizationRequest(json) : + new EndSessionRequest(json)) .then(request => { // check redirect_uri and state let currentUri = `${this.locationLike.origin}${this.locationLike.pathname}`; @@ -102,9 +142,18 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { let state: string|undefined = queryParams['state']; let code: string|undefined = queryParams['code']; let error: string|undefined = queryParams['error']; - log('Potential authorization request ', currentUri, queryParams, state, code, error); + if (requestType === RequestTypes.authorization) { + log('Potential authorization request ', + currentUri, + queryParams, + state, + code, + error); + } else { + log('Potential end session request ', currentUri, queryParams, state, error) + } let shouldNotify = state === request.state; - let authorizationResponse: AuthorizationResponse|null = null; + let authorizationResponse: EndSessionResponse|AuthorizationResponse|null = null; let authorizationError: AuthorizationError|null = null; if (shouldNotify) { if (error) { @@ -118,14 +167,18 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { state: state }); } else { - authorizationResponse = new AuthorizationResponse({code: code, state: state}); + if (requestType === RequestTypes.authorization) { + authorizationResponse = new AuthorizationResponse({code: code, state: state}); + } else if (requestType === RequestTypes.endSession) { + authorizationResponse = new EndSessionResponse({state: state}) + } } // cleanup state return Promise .all([ - this.storageBackend.removeItem(AUTHORIZATION_REQUEST_HANDLE_KEY), - this.storageBackend.removeItem(authorizationRequestKey(handle)), - this.storageBackend.removeItem(authorizationServiceConfigurationKey(handle)) + this.storageBackend.removeItem(REQUEST_HANDLE_KEY(requestType)), + this.storageBackend.removeItem(requestKey(handle, requestType)), + this.storageBackend.removeItem(serviceConfigurationKey(handle, requestType)) ]) .then(() => { log('Delivering authorization response'); From 28183eb0a27da57e5bca3350ec0f7e0f0e40d98a Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Thu, 9 Sep 2021 11:44:33 +0430 Subject: [PATCH 08/13] Add new files to index --- built/index.d.ts | 4 ++++ built/index.js | 6 +++++- src/index.ts | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/built/index.d.ts b/built/index.d.ts index d49785b..fc734ad 100644 --- a/built/index.d.ts +++ b/built/index.d.ts @@ -15,3 +15,7 @@ export * from './token_request_handler'; export * from './token_response'; export * from './types'; export * from './xhr'; +export * from './authorization_management_request'; +export * from './end_session_request'; +export * from './end_session_response'; +export * from './authorization_management_response'; diff --git a/built/index.js b/built/index.js index e516565..e22b591 100644 --- a/built/index.js +++ b/built/index.js @@ -27,4 +27,8 @@ __exportStar(require("./token_request_handler"), exports); __exportStar(require("./token_response"), exports); __exportStar(require("./types"), exports); __exportStar(require("./xhr"), exports); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsMERBQXdDO0FBQ3hDLGtFQUFnRDtBQUNoRCwyREFBeUM7QUFDekMsd0VBQXNEO0FBQ3RELGlEQUErQjtBQUMvQiwyQ0FBeUI7QUFDekIsMENBQXdCO0FBQ3hCLDJDQUF5QjtBQUN6Qix1REFBcUM7QUFDckMsMkRBQXlDO0FBQ3pDLHlEQUF1QztBQUN2Qyw0Q0FBMEI7QUFDMUIsa0RBQWdDO0FBQ2hDLDBEQUF3QztBQUN4QyxtREFBaUM7QUFDakMsMENBQXdCO0FBQ3hCLHdDQUFzQiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vYXV0aG9yaXphdGlvbl9yZXF1ZXN0JztcbmV4cG9ydCAqIGZyb20gJy4vYXV0aG9yaXphdGlvbl9yZXF1ZXN0X2hhbmRsZXInO1xuZXhwb3J0ICogZnJvbSAnLi9hdXRob3JpemF0aW9uX3Jlc3BvbnNlJztcbmV4cG9ydCAqIGZyb20gJy4vYXV0aG9yaXphdGlvbl9zZXJ2aWNlX2NvbmZpZ3VyYXRpb24nO1xuZXhwb3J0ICogZnJvbSAnLi9jcnlwdG9fdXRpbHMnO1xuZXhwb3J0ICogZnJvbSAnLi9lcnJvcnMnO1xuZXhwb3J0ICogZnJvbSAnLi9mbGFncyc7XG5leHBvcnQgKiBmcm9tICcuL2xvZ2dlcic7XG5leHBvcnQgKiBmcm9tICcuL3F1ZXJ5X3N0cmluZ191dGlscyc7XG5leHBvcnQgKiBmcm9tICcuL3JlZGlyZWN0X2Jhc2VkX2hhbmRsZXInO1xuZXhwb3J0ICogZnJvbSAnLi9yZXZva2VfdG9rZW5fcmVxdWVzdCc7XG5leHBvcnQgKiBmcm9tICcuL3N0b3JhZ2UnO1xuZXhwb3J0ICogZnJvbSAnLi90b2tlbl9yZXF1ZXN0JztcbmV4cG9ydCAqIGZyb20gJy4vdG9rZW5fcmVxdWVzdF9oYW5kbGVyJztcbmV4cG9ydCAqIGZyb20gJy4vdG9rZW5fcmVzcG9uc2UnO1xuZXhwb3J0ICogZnJvbSAnLi90eXBlcyc7XG5leHBvcnQgKiBmcm9tICcuL3hocic7XG4iXX0= \ No newline at end of file +__exportStar(require("./authorization_management_request"), exports); +__exportStar(require("./end_session_request"), exports); +__exportStar(require("./end_session_response"), exports); +__exportStar(require("./authorization_management_response"), exports); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsMERBQXdDO0FBQ3hDLGtFQUFnRDtBQUNoRCwyREFB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ICcuL3Rva2VuX3Jlc3BvbnNlJztcbmV4cG9ydCAqIGZyb20gJy4vdHlwZXMnO1xuZXhwb3J0ICogZnJvbSAnLi94aHInO1xuZXhwb3J0ICogZnJvbSAnLi9hdXRob3JpemF0aW9uX21hbmFnZW1lbnRfcmVxdWVzdCc7XG5leHBvcnQgKiBmcm9tICcuL2VuZF9zZXNzaW9uX3JlcXVlc3QnO1xuZXhwb3J0ICogZnJvbSAnLi9lbmRfc2Vzc2lvbl9yZXNwb25zZSc7XG5leHBvcnQgKiBmcm9tICcuL2F1dGhvcml6YXRpb25fbWFuYWdlbWVudF9yZXNwb25zZSc7Il19 \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index d49785b..04552b5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,3 +15,7 @@ export * from './token_request_handler'; export * from './token_response'; export * from './types'; export * from './xhr'; +export * from './authorization_management_request'; +export * from './end_session_request'; +export * from './end_session_response'; +export * from './authorization_management_response'; \ No newline at end of file From 8772621826b0779bab3074d111025f9a19204153 Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Sat, 11 Sep 2021 18:58:59 +0430 Subject: [PATCH 09/13] Add end session end points to auth handler --- src/authorization_request_handler.ts | 43 ++++++++++++++++++++++++++-- src/types.ts | 5 ++++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/authorization_request_handler.ts b/src/authorization_request_handler.ts index a299ba1..66d6a4d 100644 --- a/src/authorization_request_handler.ts +++ b/src/authorization_request_handler.ts @@ -19,7 +19,7 @@ import {AuthorizationServiceConfiguration} from './authorization_service_configu import {Crypto} from './crypto_utils'; import {log} from './logger'; import {QueryStringUtils} from './query_string_utils'; -import {StringMap} from './types'; +import {RedirectRequestTypes, StringMap} from './types'; /** @@ -81,12 +81,15 @@ export abstract class AuthorizationRequestHandler { */ protected buildRequestUrl( configuration: AuthorizationServiceConfiguration, - request: AuthorizationManagementRequest) { + request: AuthorizationManagementRequest, + requestType: RedirectRequestTypes) { // build the query string // coerce to any type for convenience let requestMap: StringMap = request.toRequestMap() let query = this.utils.stringify(requestMap); - let baseUrl = configuration.authorizationEndpoint; + let baseUrl = requestType === RedirectRequestTypes.authorization ? + configuration.authorizationEndpoint : + configuration.endSessionEndpoint; let url = `${baseUrl}?${query}`; return url; } @@ -112,6 +115,27 @@ export abstract class AuthorizationRequestHandler { }); } + /** + * Completes the endsession request if necessary & when possible. + */ + completeEndSessionRequestIfPossible(): Promise { + // call complete endsession if possible to see there might + // be a response that needs to be delivered. + log(`Checking to see if there is an endsession response to be delivered.`); + if (!this.notifier) { + log(`Notifier is not present on EndSessionRequest handler. + No delivery of result will be possible`) + } + return this.completeEndSessionRequest().then(result => { + if (!result) { + log(`No result is available yet.`); + } + if (result && this.notifier) { + this.notifier.onAuthorizationComplete(result.request, result.response, result.error); + } + }); + } + /** * Sets the default Authorization Service notifier. */ @@ -127,10 +151,23 @@ export abstract class AuthorizationRequestHandler { configuration: AuthorizationServiceConfiguration, request: AuthorizationManagementRequest): void; + /** + * Makes an end session request. + */ + abstract performEndSessionRequest( + configuration: AuthorizationServiceConfiguration, + request: AuthorizationManagementRequest): void; /** * Checks if an authorization flow can be completed, and completes it. * The handler returns a `Promise` if ready, or a `Promise` * if not ready. */ protected abstract completeAuthorizationRequest(): Promise; + + /** + * Checks if an end session flow can be completed, and completes it. + * The handler returns a `Promise` if ready, or a `Promise` + * if not ready. + */ + protected abstract completeEndSessionRequest(): Promise; } diff --git a/src/types.ts b/src/types.ts index 3af235a..280830b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -30,3 +30,8 @@ export interface LocationLike { search: string; assign(url: string): void; } + +export enum RedirectRequestTypes { + endSession = 'end_session', + authorization = 'authorization' +} \ No newline at end of file From a1cf53de469c878429aa061539f8519f71a90654 Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Sat, 11 Sep 2021 18:59:22 +0430 Subject: [PATCH 10/13] Fix node related files --- src/node_support/node_request_handler.ts | 50 +++++++++++++++++++----- src/redirect_based_handler.ts | 36 ++++++++--------- 2 files changed, 57 insertions(+), 29 deletions(-) diff --git a/src/node_support/node_request_handler.ts b/src/node_support/node_request_handler.ts index d6ff270..ae339ac 100644 --- a/src/node_support/node_request_handler.ts +++ b/src/node_support/node_request_handler.ts @@ -15,7 +15,7 @@ import {EventEmitter} from 'events'; import * as Http from 'http'; import * as Url from 'url'; -import {AuthorizationRequest} from '../authorization_request'; +import {AuthorizationManagementRequest} from '../authorization_management_request'; import {AuthorizationRequestHandler, AuthorizationRequestResponse} from '../authorization_request_handler'; import {AuthorizationResponse} from '../authorization_response'; import {AuthorizationError} from '../authorization_management_response'; @@ -24,10 +24,13 @@ import {Crypto} from '../crypto_utils'; import {log} from '../logger'; import {BasicQueryStringUtils, QueryStringUtils} from '../query_string_utils'; import {NodeCrypto} from './crypto_utils'; +import {RedirectRequestTypes} from '../types'; +import {EndSessionResponse} from '../end_session_response'; // TypeScript typings for `opener` are not correct and do not export it as module import opener = require('opener'); +import { AuthorizationRequest } from '../authorization_request'; class ServerEventsEmitter extends EventEmitter { static ON_UNABLE_TO_START = 'unable_to_start'; @@ -46,9 +49,18 @@ export class NodeBasedHandler extends AuthorizationRequestHandler { super(utils, crypto); } - performAuthorizationRequest( + performAuthorizationRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest){ + this.performRequest(configuration, request, RedirectRequestTypes.authorization); + } + + performEndSessionRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest){ + this.performRequest(configuration, request, RedirectRequestTypes.endSession); + } + + private performRequest( configuration: AuthorizationServiceConfiguration, - request: AuthorizationRequest) { + request: AuthorizationManagementRequest, + requestType: RedirectRequestTypes) { // use opener to launch a web browser and start the authorization flow. // start a web server to handle the authorization response. const emitter = new ServerEventsEmitter(); @@ -70,8 +82,12 @@ export class NodeBasedHandler extends AuthorizationRequestHandler { return; } - log('Handling Authorization Request ', searchParams, state, code, error); - let authorizationResponse: AuthorizationResponse|null = null; + if(requestType === RedirectRequestTypes.authorization){ + log('Handling Authorization Request ', searchParams, state, code, error); + } else if(requestType === RedirectRequestTypes.endSession){ + log('Handling end session Request ', searchParams, state, error); + } + let authorizationResponse: EndSessionResponse|AuthorizationResponse|null = null; let authorizationError: AuthorizationError|null = null; if (error) { log('error'); @@ -81,7 +97,11 @@ export class NodeBasedHandler extends AuthorizationRequestHandler { authorizationError = new AuthorizationError( {error: error, error_description: errorDescription, error_uri: errorUri, state: state}); } else { - authorizationResponse = new AuthorizationResponse({code: code!, state: state!}); + if (requestType === RedirectRequestTypes.authorization) { + authorizationResponse = new AuthorizationResponse({code: code!, state: state!}); + } else if (requestType === RedirectRequestTypes.endSession) { + authorizationResponse = new EndSessionResponse({state: state!}) + } } const completeResponse = { request, @@ -106,11 +126,15 @@ export class NodeBasedHandler extends AuthorizationRequestHandler { }); let server: Http.Server; - request.setupCodeVerifier() - .then(() => { + let codeVerified: Promise = Promise.resolve(); + if(request instanceof AuthorizationRequest){ + codeVerified = request.setupCodeVerifier() + } + + codeVerified.then(() => { server = Http.createServer(requestHandler); server.listen(this.httpServerPort); - const url = this.buildRequestUrl(configuration, request); + const url = this.buildRequestUrl(configuration, request, requestType); log('Making a request to ', request, url); opener(url); }) @@ -121,6 +145,14 @@ export class NodeBasedHandler extends AuthorizationRequestHandler { } protected completeAuthorizationRequest(): Promise { + return this.completeRequest(); + } + + protected completeEndSessionRequest(): Promise { + return this.completeRequest(); + } + + private completeRequest(): Promise { if (!this.authorizationPromise) { return Promise.reject( 'No pending authorization request. Call performAuthorizationRequest() ?'); diff --git a/src/redirect_based_handler.ts b/src/redirect_based_handler.ts index d96cc2c..c435f3e 100644 --- a/src/redirect_based_handler.ts +++ b/src/redirect_based_handler.ts @@ -24,28 +24,24 @@ import {EndSessionResponse} from './end_session_response'; import {log} from './logger'; import {BasicQueryStringUtils} from './query_string_utils'; import {LocalStorageBackend, StorageBackend} from './storage'; -import {LocationLike} from './types'; +import {LocationLike, RedirectRequestTypes} from './types'; -enum RequestTypes { - endSession = 'end_session', - authorization = 'authorization' -} - /** key for authorization request. */ const requestKey = - (handle: string, requestType: RequestTypes) => { + (handle: string, requestType: RedirectRequestTypes) => { return `${handle}_appauth_${requestType}_request`; } /** key for authorization service configuration */ const serviceConfigurationKey = - (handle: string, requestType: RequestTypes) => { + (handle: string, requestType: RedirectRequestTypes) => { return `${handle}_appauth_${requestType}_service_configuration`; } /** key in local storage which represents the current authorization request. */ -const REQUEST_HANDLE_KEY = (requestType: RequestTypes) => `appauth_current_${requestType}_request`; +const REQUEST_HANDLE_KEY = (requestType: RedirectRequestTypes) => + `appauth_current_${requestType}_request`; /** * Represents an AuthorizationRequestHandler which uses a standard @@ -66,19 +62,19 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { performAuthorizationRequest( configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest) { - this.performRequest(configuration, request, RequestTypes.authorization); + this.performRequest(configuration, request, RedirectRequestTypes.authorization); } performEndSessionRequest( configuration: AuthorizationServiceConfiguration, request: EndSessionRequest) { - this.performRequest(configuration, request, RequestTypes.endSession); + this.performRequest(configuration, request, RedirectRequestTypes.endSession); } private performRequest( configuration: AuthorizationServiceConfiguration, request: AuthorizationManagementRequest, - requestType: RequestTypes = RequestTypes.authorization) { + requestType: RedirectRequestTypes = RedirectRequestTypes.authorization) { const handle = this.crypto.generateRandom(10); // before you make request, persist all request related data in local storage. @@ -94,7 +90,7 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { persisted.then(() => { // make the redirect request - let url = this.buildRequestUrl(configuration, request); + let url = this.buildRequestUrl(configuration, request, requestType); log('Making a request to ', request, url); this.locationLike.assign(url); }); @@ -105,7 +101,7 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { * authorization request. */ protected completeAuthorizationRequest(): Promise { - return this.completeRequest(RequestTypes.authorization); + return this.completeRequest(RedirectRequestTypes.authorization); } /** @@ -113,14 +109,14 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { * end session request. */ protected completeEndSessionRequest(): Promise { - return this.completeRequest(RequestTypes.endSession); + return this.completeRequest(RedirectRequestTypes.endSession); } /** * Attempts to introspect the contents of storage backend and completes the * request. */ - private completeRequest(requestType: RequestTypes) { + private completeRequest(requestType: RedirectRequestTypes) { // TODO(rahulrav@): handle authorization errors. return this.storageBackend.getItem(REQUEST_HANDLE_KEY(requestType)).then(handle => { if (handle) { @@ -132,7 +128,7 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { // TODO(rahulrav@): check for inconsistent state here .then(result => JSON.parse(result!)) .then( - json => requestType === RequestTypes.authorization ? + json => requestType === RedirectRequestTypes.authorization ? new AuthorizationRequest(json) : new EndSessionRequest(json)) .then(request => { @@ -142,7 +138,7 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { let state: string|undefined = queryParams['state']; let code: string|undefined = queryParams['code']; let error: string|undefined = queryParams['error']; - if (requestType === RequestTypes.authorization) { + if (requestType === RedirectRequestTypes.authorization) { log('Potential authorization request ', currentUri, queryParams, @@ -167,9 +163,9 @@ export class RedirectRequestHandler extends AuthorizationRequestHandler { state: state }); } else { - if (requestType === RequestTypes.authorization) { + if (requestType === RedirectRequestTypes.authorization) { authorizationResponse = new AuthorizationResponse({code: code, state: state}); - } else if (requestType === RequestTypes.endSession) { + } else if (requestType === RedirectRequestTypes.endSession) { authorizationResponse = new EndSessionResponse({state: state}) } } From 4e6d7ce20892cb8617439d79b94067bbb2b77ddb Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Sat, 11 Sep 2021 19:00:41 +0430 Subject: [PATCH 11/13] Add built files --- built/authorization_request_handler.d.ts | 17 ++++++++- built/authorization_request_handler.js | 29 ++++++++++++-- built/node_support/node_request_handler.d.ts | 6 ++- built/node_support/node_request_handler.js | 40 +++++++++++++++++--- built/redirect_based_handler.js | 32 ++++++++-------- built/types.d.ts | 4 ++ built/types.js | 8 +++- 7 files changed, 107 insertions(+), 29 deletions(-) diff --git a/built/authorization_request_handler.d.ts b/built/authorization_request_handler.d.ts index ffe5d80..cb5b816 100644 --- a/built/authorization_request_handler.d.ts +++ b/built/authorization_request_handler.d.ts @@ -4,6 +4,7 @@ import { AuthorizationError } from './authorization_management_response'; import { AuthorizationServiceConfiguration } from './authorization_service_configuration'; import { Crypto } from './crypto_utils'; import { QueryStringUtils } from './query_string_utils'; +import { RedirectRequestTypes } from './types'; /** * This type represents a lambda that can take an AuthorizationRequest, * and an AuthorizationResponse as arguments. @@ -41,11 +42,15 @@ export declare abstract class AuthorizationRequestHandler { /** * A utility method to be able to build the authorization request URL. */ - protected buildRequestUrl(configuration: AuthorizationServiceConfiguration, request: AuthorizationManagementRequest): string; + protected buildRequestUrl(configuration: AuthorizationServiceConfiguration, request: AuthorizationManagementRequest, requestType: RedirectRequestTypes): string; /** * Completes the authorization request if necessary & when possible. */ completeAuthorizationRequestIfPossible(): Promise; + /** + * Completes the endsession request if necessary & when possible. + */ + completeEndSessionRequestIfPossible(): Promise; /** * Sets the default Authorization Service notifier. */ @@ -54,10 +59,20 @@ export declare abstract class AuthorizationRequestHandler { * Makes an authorization request. */ abstract performAuthorizationRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationManagementRequest): void; + /** + * Makes an end session request. + */ + abstract performEndSessionRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationManagementRequest): void; /** * Checks if an authorization flow can be completed, and completes it. * The handler returns a `Promise` if ready, or a `Promise` * if not ready. */ protected abstract completeAuthorizationRequest(): Promise; + /** + * Checks if an end session flow can be completed, and completes it. + * The handler returns a `Promise` if ready, or a `Promise` + * if not ready. + */ + protected abstract completeEndSessionRequest(): Promise; } diff --git a/built/authorization_request_handler.js b/built/authorization_request_handler.js index 2fe8fe7..a963354 100644 --- a/built/authorization_request_handler.js +++ b/built/authorization_request_handler.js @@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.AuthorizationRequestHandler = exports.AuthorizationNotifier = void 0; var logger_1 = require("./logger"); +var types_1 = require("./types"); /** * Authorization Service notifier. * This manages the communication of the AuthorizationResponse to the 3p client. @@ -52,12 +53,14 @@ var AuthorizationRequestHandler = /** @class */ (function () { /** * A utility method to be able to build the authorization request URL. */ - AuthorizationRequestHandler.prototype.buildRequestUrl = function (configuration, request) { + AuthorizationRequestHandler.prototype.buildRequestUrl = function (configuration, request, requestType) { // build the query string // coerce to any type for convenience var requestMap = request.toRequestMap(); var query = this.utils.stringify(requestMap); - var baseUrl = configuration.authorizationEndpoint; + var baseUrl = requestType === types_1.RedirectRequestTypes.authorization ? + configuration.authorizationEndpoint : + configuration.endSessionEndpoint; var url = baseUrl + "?" + query; return url; }; @@ -81,6 +84,26 @@ var AuthorizationRequestHandler = /** @class */ (function () { } }); }; + /** + * Completes the endsession request if necessary & when possible. + */ + AuthorizationRequestHandler.prototype.completeEndSessionRequestIfPossible = function () { + var _this = this; + // call complete endsession if possible to see there might + // be a response that needs to be delivered. + logger_1.log("Checking to see if there is an endsession response to be delivered."); + if (!this.notifier) { + logger_1.log("Notifier is not present on EndSessionRequest handler.\n No delivery of result will be possible"); + } + return this.completeEndSessionRequest().then(function (result) { + if (!result) { + logger_1.log("No result is available yet."); + } + if (result && _this.notifier) { + _this.notifier.onAuthorizationComplete(result.request, result.response, result.error); + } + }); + }; /** * Sets the default Authorization Service notifier. */ @@ -92,4 +115,4 @@ var AuthorizationRequestHandler = /** @class */ (function () { return AuthorizationRequestHandler; }()); exports.AuthorizationRequestHandler = AuthorizationRequestHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbl9yZXF1ZXN0X2hhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXV0aG9yaXphdGlvbl9yZXF1ZXN0X2hhbmRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7R0FZRzs7O0FBT0gsbUNBQTZCO0FBdUI3Qjs7O0dBR0c7QUFDSDtJQUFB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lIG5vdGlmaWVyLlxuICAgKi9cbiAgc2V0QXV0aG9yaXphdGlvbk5vdGlmaWVyKG5vdGlmaWVyOiBBdXRob3JpemF0aW9uTm90aWZpZXIpOiBBdXRob3JpemF0aW9uUmVxdWVzdEhhbmRsZXIge1xuICAgIHRoaXMubm90aWZpZXIgPSBub3RpZmllcjtcbiAgICByZXR1cm4gdGhpcztcbiAgfTtcblxuICAvKipcbiAgICogTWFrZXMgYW4gYXV0aG9yaXphdGlvbiByZXF1ZXN0LlxuICAgKi9cbiAgYWJzdHJhY3QgcGVyZm9ybUF1dGhvcml6YXRpb25SZXF1ZXN0KFxuICAgICAgY29uZmlndXJhdGlvbjogQXV0aG9yaXphdGlvblNlcnZpY2VDb25maWd1cmF0aW9uLFxuICAgICAgcmVxdWVzdDogQXV0aG9yaXphdGlvbk1hbmFnZW1lbnRSZXF1ZXN0KTogdm9pZDtcblxuICAvKipcbiAgICogQ2hlY2tzIGlmIGFuIGF1dGhvcml6YXRpb24gZmxvdyBjYW4gYmUgY29tcGxldGVkLCBhbmQgY29tcGxldGVzIGl0LlxuICAgKiBUaGUgaGFuZGxlciByZXR1cm5zIGEgYFByb21pc2U8QXV0aG9yaXphdGlvblJlcXVlc3RSZXNwb25zZT5gIGlmIHJlYWR5LCBvciBhIGBQcm9taXNlPG51bGw+YFxuICAgKiBpZiBub3QgcmVhZHkuXG4gICAqL1xuICBwcm90ZWN0ZWQgYWJzdHJhY3QgY29tcGxldGVBdXRob3JpemF0aW9uUmVxdWVzdCgpOiBQcm9taXNlPEF1dGhvcml6YXRpb25SZXF1ZXN0UmVzcG9uc2V8bnVsbD47XG59XG4iXX0= \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aG9yaXphdGlvbl9yZXF1ZXN0X2hhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXV0aG9yaXphdGlvbl9yZXF1ZXN0X2h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IGFic3RyYWN0IGNvbXBsZXRlQXV0aG9yaXphdGlvblJlcXVlc3QoKTogUHJvbWlzZTxBdXRob3JpemF0aW9uUmVxdWVzdFJlc3BvbnNlfG51bGw+O1xuXG4gIC8qKlxuICAgKiBDaGVja3MgaWYgYW4gZW5kIHNlc3Npb24gZmxvdyBjYW4gYmUgY29tcGxldGVkLCBhbmQgY29tcGxldGVzIGl0LlxuICAgKiBUaGUgaGFuZGxlciByZXR1cm5zIGEgYFByb21pc2U8QXV0aG9yaXphdGlvblJlcXVlc3RSZXNwb25zZT5gIGlmIHJlYWR5LCBvciBhIGBQcm9taXNlPG51bGw+YFxuICAgKiBpZiBub3QgcmVhZHkuXG4gICAqL1xuICBwcm90ZWN0ZWQgYWJzdHJhY3QgY29tcGxldGVFbmRTZXNzaW9uUmVxdWVzdCgpOiBQcm9taXNlPEF1dGhvcml6YXRpb25SZXF1ZXN0UmVzcG9uc2V8bnVsbD47XG59XG4iXX0= \ No newline at end of file diff --git a/built/node_support/node_request_handler.d.ts b/built/node_support/node_request_handler.d.ts index 3728765..bd0b378 100644 --- a/built/node_support/node_request_handler.d.ts +++ b/built/node_support/node_request_handler.d.ts @@ -1,12 +1,16 @@ -import { AuthorizationRequest } from '../authorization_request'; import { AuthorizationRequestHandler, AuthorizationRequestResponse } from '../authorization_request_handler'; import { AuthorizationServiceConfiguration } from '../authorization_service_configuration'; import { Crypto } from '../crypto_utils'; import { QueryStringUtils } from '../query_string_utils'; +import { AuthorizationRequest } from '../authorization_request'; export declare class NodeBasedHandler extends AuthorizationRequestHandler { httpServerPort: number; authorizationPromise: Promise | null; constructor(httpServerPort?: number, utils?: QueryStringUtils, crypto?: Crypto); performAuthorizationRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest): void; + performEndSessionRequest(configuration: AuthorizationServiceConfiguration, request: AuthorizationRequest): void; + private performRequest; protected completeAuthorizationRequest(): Promise; + protected completeEndSessionRequest(): Promise; + private completeRequest; } diff --git a/built/node_support/node_request_handler.js b/built/node_support/node_request_handler.js index c26af31..e3e9adf 100644 --- a/built/node_support/node_request_handler.js +++ b/built/node_support/node_request_handler.js @@ -38,8 +38,11 @@ var authorization_management_response_1 = require("../authorization_management_r var logger_1 = require("../logger"); var query_string_utils_1 = require("../query_string_utils"); var crypto_utils_1 = require("./crypto_utils"); +var types_1 = require("../types"); +var end_session_response_1 = require("../end_session_response"); // TypeScript typings for `opener` are not correct and do not export it as module var opener = require("opener"); +var authorization_request_1 = require("../authorization_request"); var ServerEventsEmitter = /** @class */ (function (_super) { __extends(ServerEventsEmitter, _super); function ServerEventsEmitter() { @@ -64,6 +67,12 @@ var NodeBasedHandler = /** @class */ (function (_super) { return _this; } NodeBasedHandler.prototype.performAuthorizationRequest = function (configuration, request) { + this.performRequest(configuration, request, types_1.RedirectRequestTypes.authorization); + }; + NodeBasedHandler.prototype.performEndSessionRequest = function (configuration, request) { + this.performRequest(configuration, request, types_1.RedirectRequestTypes.endSession); + }; + NodeBasedHandler.prototype.performRequest = function (configuration, request, requestType) { var _this = this; // use opener to launch a web browser and start the authorization flow. // start a web server to handle the authorization response. @@ -81,7 +90,12 @@ var NodeBasedHandler = /** @class */ (function (_super) { // ignore irrelevant requests (e.g. favicon.ico) return; } - logger_1.log('Handling Authorization Request ', searchParams, state, code, error); + if (requestType === types_1.RedirectRequestTypes.authorization) { + logger_1.log('Handling Authorization Request ', searchParams, state, code, error); + } + else if (requestType === types_1.RedirectRequestTypes.endSession) { + logger_1.log('Handling end session Request ', searchParams, state, error); + } var authorizationResponse = null; var authorizationError = null; if (error) { @@ -92,7 +106,12 @@ var NodeBasedHandler = /** @class */ (function (_super) { authorizationError = new authorization_management_response_1.AuthorizationError({ error: error, error_description: errorDescription, error_uri: errorUri, state: state }); } else { - authorizationResponse = new authorization_response_1.AuthorizationResponse({ code: code, state: state }); + if (requestType === types_1.RedirectRequestTypes.authorization) { + authorizationResponse = new authorization_response_1.AuthorizationResponse({ code: code, state: state }); + } + else if (requestType === types_1.RedirectRequestTypes.endSession) { + authorizationResponse = new end_session_response_1.EndSessionResponse({ state: state }); + } } var completeResponse = { request: request, @@ -115,11 +134,14 @@ var NodeBasedHandler = /** @class */ (function (_super) { }); }); var server; - request.setupCodeVerifier() - .then(function () { + var codeVerified = Promise.resolve(); + if (request instanceof authorization_request_1.AuthorizationRequest) { + codeVerified = request.setupCodeVerifier(); + } + codeVerified.then(function () { server = Http.createServer(requestHandler); server.listen(_this.httpServerPort); - var url = _this.buildRequestUrl(configuration, request); + var url = _this.buildRequestUrl(configuration, request, requestType); logger_1.log('Making a request to ', request, url); opener(url); }) @@ -129,6 +151,12 @@ var NodeBasedHandler = /** @class */ (function (_super) { }); }; NodeBasedHandler.prototype.completeAuthorizationRequest = function () { + return this.completeRequest(); + }; + NodeBasedHandler.prototype.completeEndSessionRequest = function () { + return this.completeRequest(); + }; + NodeBasedHandler.prototype.completeRequest = function () { if (!this.authorizationPromise) { return Promise.reject('No pending authorization request. Call performAuthorizationRequest() ?'); } @@ -137,4 +165,4 @@ var NodeBasedHandler = /** @class */ (function (_super) { return NodeBasedHandler; }(authorization_request_handler_1.AuthorizationRequestHandler)); exports.NodeBasedHandler = NodeBasedHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZV9yZXF1ZXN0X2hhbmRsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbm9kZV9zdXBwb3J0L25vZGVfcmVxdWVzdF9oYW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7O0dBWUc7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUVILGlDQUFvQztBQUNwQywyQkFBNkI7QUFDN0IseUJBQTJCO0FBRTNCLGtGQUEyRztBQUMzRyxvRUFBZ0U7QUFDaEUsMEZBQXdFO0FBR3hFLG9DQUE4QjtBQUM5Qiw0REFBOEU7QUFDOUUsK0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XphdGlvblByb21pc2UpIHtcbiAgICAgIHJldHVybiBQcm9taXNlLnJlamVjdChcbiAgICAgICAgICAnTm8gcGVuZGluZyBhdXRob3JpemF0aW9uIHJlcXVlc3QuIENhbGwgcGVyZm9ybUF1dGhvcml6YXRpb25SZXF1ZXN0KCkgPycpO1xuICAgIH1cblxuICAgIHJldHVybiB0aGlzLmF1dGhvcml6YXRpb25Qcm9taXNlO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/built/redirect_based_handler.js b/built/redirect_based_handler.js index 25001c5..b851729 100644 --- a/built/redirect_based_handler.js +++ b/built/redirect_based_handler.js @@ -39,11 +39,7 @@ var end_session_response_1 = require("./end_session_response"); var logger_1 = require("./logger"); var query_string_utils_1 = require("./query_string_utils"); var storage_1 = require("./storage"); -var RequestTypes; -(function (RequestTypes) { - RequestTypes["endSession"] = "end_session"; - RequestTypes["authorization"] = "authorization"; -})(RequestTypes || (RequestTypes = {})); +var types_1 = require("./types"); /** key for authorization request. */ var requestKey = function (handle, requestType) { return handle + "_appauth_" + requestType + "_request"; @@ -53,7 +49,9 @@ var serviceConfigurationKey = function (handle, requestType) { return handle + "_appauth_" + requestType + "_service_configuration"; }; /** key in local storage which represents the current authorization request. */ -var REQUEST_HANDLE_KEY = function (requestType) { return "appauth_current_" + requestType + "_request"; }; +var REQUEST_HANDLE_KEY = function (requestType) { + return "appauth_current_" + requestType + "_request"; +}; /** * Represents an AuthorizationRequestHandler which uses a standard * redirect based code flow. @@ -75,14 +73,14 @@ var RedirectRequestHandler = /** @class */ (function (_super) { return _this; } RedirectRequestHandler.prototype.performAuthorizationRequest = function (configuration, request) { - this.performRequest(configuration, request, RequestTypes.authorization); + this.performRequest(configuration, request, types_1.RedirectRequestTypes.authorization); }; RedirectRequestHandler.prototype.performEndSessionRequest = function (configuration, request) { - this.performRequest(configuration, request, RequestTypes.endSession); + this.performRequest(configuration, request, types_1.RedirectRequestTypes.endSession); }; RedirectRequestHandler.prototype.performRequest = function (configuration, request, requestType) { var _this = this; - if (requestType === void 0) { requestType = RequestTypes.authorization; } + if (requestType === void 0) { requestType = types_1.RedirectRequestTypes.authorization; } var handle = this.crypto.generateRandom(10); // before you make request, persist all request related data in local storage. var persisted = Promise.all([ @@ -95,7 +93,7 @@ var RedirectRequestHandler = /** @class */ (function (_super) { ]); persisted.then(function () { // make the redirect request - var url = _this.buildRequestUrl(configuration, request); + var url = _this.buildRequestUrl(configuration, request, requestType); logger_1.log('Making a request to ', request, url); _this.locationLike.assign(url); }); @@ -105,14 +103,14 @@ var RedirectRequestHandler = /** @class */ (function (_super) { * authorization request. */ RedirectRequestHandler.prototype.completeAuthorizationRequest = function () { - return this.completeRequest(RequestTypes.authorization); + return this.completeRequest(types_1.RedirectRequestTypes.authorization); }; /** * Attempts to introspect the contents of storage backend and completes the * end session request. */ RedirectRequestHandler.prototype.completeEndSessionRequest = function () { - return this.completeRequest(RequestTypes.endSession); + return this.completeRequest(types_1.RedirectRequestTypes.endSession); }; /** * Attempts to introspect the contents of storage backend and completes the @@ -130,7 +128,7 @@ var RedirectRequestHandler = /** @class */ (function (_super) { // requires a corresponding instance of result // TODO(rahulrav@): check for inconsistent state here .then(function (result) { return JSON.parse(result); }) - .then(function (json) { return requestType === RequestTypes.authorization ? + .then(function (json) { return requestType === types_1.RedirectRequestTypes.authorization ? new authorization_request_1.AuthorizationRequest(json) : new end_session_request_1.EndSessionRequest(json); }) .then(function (request) { @@ -140,7 +138,7 @@ var RedirectRequestHandler = /** @class */ (function (_super) { var state = queryParams['state']; var code = queryParams['code']; var error = queryParams['error']; - if (requestType === RequestTypes.authorization) { + if (requestType === types_1.RedirectRequestTypes.authorization) { logger_1.log('Potential authorization request ', currentUri, queryParams, state, code, error); } else { @@ -162,10 +160,10 @@ var RedirectRequestHandler = /** @class */ (function (_super) { }); } else { - if (requestType === RequestTypes.authorization) { + if (requestType === types_1.RedirectRequestTypes.authorization) { authorizationResponse = new authorization_response_1.AuthorizationResponse({ code: code, state: state }); } - else if (requestType === RequestTypes.endSession) { + else if (requestType === types_1.RedirectRequestTypes.endSession) { authorizationResponse = new end_session_response_1.EndSessionResponse({ state: state }); } } @@ -199,4 +197,4 @@ var RedirectRequestHandler = /** @class */ (function (_super) { return RedirectRequestHandler; }(authorization_request_handler_1.AuthorizationRequestHandler)); exports.RedirectRequestHandler = RedirectRequestHandler; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVkaXJlY3RfYmFzZWRfaGFuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9yZWRpcmVjdF9iYXNlZF9oYW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7O0dBWUc7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUdILHlGQUF1RTtBQUN2RSxpRUFBNkQ7QUFDN0QsaUZBQTBHO0FBQzFHLG1FQUE4RDtBQUU5RCwrQ0FBcUQ7QUFDckQsNkRBQXdEO0FBQ3hELCtEQUEwRDtBQUMxRCxtQ0FBNkI7QUFDN0IsMkRBQTJEO0FBQzNELHFDQUE4RDtBQUk5RCxJQUFLLFlBR0o7QUFIRCxXQUFLLFlBQVk7SUFDZiwwQ0FBMEIsQ0FBQTtJQUMxQiwrQ0FBK0IsQ0FBQTtBQUNqQyxDQUFDLEVBSEksWUFBWSxLQUFaLFlBQVksUUFHaEI7QUFFRCxxQ0FBcUM7QUFDckMsSUFBTSxVQUFVLEdBQ1osVUFBQyxNQUFjLEVBQUUsV0FBeUI7SUFDeEMsT0FBVSxNQUFNLGlCQUFZLFdBQVcsYUFBVSxDQUFDO0FBQ3BELENBQUMsQ0FBQTtBQUVMLGtEQUFrRDtBQUNsRCxJQUFNLHVCQUF1QixHQUN6QixVQUFDLE1BQWMsRUFBRSxXQUF5QjtJQUN4QyxPQUFVLE1BQU0saUJBQVksV0FBVywyQkFBd0IsQ0FBQztBQUNsRSxD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kXG4gICAgICAgICAgICAuZ2V0SXRlbShyZXF1ZXN0S2V5KGhhbmRsZSwgcmVxdWVzdFR5cGUpKVxuICAgICAgICAgICAgLy8gcmVxdWlyZXMgYSBjb3JyZXNwb25kaW5nIGluc3RhbmNlIG9mIHJlc3VsdFxuICAgICAgICAgICAgLy8gVE9ETyhyYWh1bHJhdkApOiBjaGVjayBmb3IgaW5jb25zaXN0ZW50IHN0YXRlIGhlcmVcbiAgICAgICAgICAgIC50aGVuKHJlc3VsdCA9PiBKU09OLnBhcnNlKHJlc3VsdCEpKVxuICAgICAgICAgICAgLnRoZW4oXG4gICAgICAgICAgICAgICAganNvbiA9PiByZXF1ZXN0VHlwZSA9PT0gUmVxdWVzdFR5cGVzLmF1dGhvcml6YXRpb24gP1xuICAgICAgICAgICAgICAgICAgICBuZXcgQXV0aG9yaXphdGlvblJlcXVlc3QoanNvbikgOlxuICAgICAgICAgICAgICAgICAgICBuZXcgRW5kU2Vzc2lvblJlcXVlc3QoanNvbikpXG4gICAgICAgICAgICAudGhlbihyZXF1ZXN0ID0+IHtcbiAgICAgICAgICAgICAgLy8gY2hlY2sgcmVkaXJlY3RfdXJpIGFuZCBzdGF0ZVxuICAgICAgICAgICAgICBsZXQgY3VycmVudFVyaSA9IGAke3RoaXMubG9jYXRpb25MaWtlLm9yaWdpbn0ke3RoaXMubG9jYXRpb25MaWtlLnBhdGhuYW1lfWA7XG4gICAgICAgICAgICAgIGxldCBxdWVyeVBhcmFtcyA9IHRoaXMudXRpbHMucGFyc2UodGhpcy5sb2NhdGlvbkxpa2UsIHRydWUgLyogdXNlIGhhc2ggKi8pO1xuICAgICAgICAgICAgICBsZXQgc3RhdGU6IHN0cmluZ3x1bmRlZmluZWQgPSBxdWVyeVBhcmFtc1snc3RhdGUnXTtcbiAgICAgICAgICAgICAgbGV0IGNvZGU6IHN0cmluZ3x1bmRlZmluZWQgPSBxdWVyeVBhcmFtc1snY29kZSddO1xuICAgICAgICAgICAgICBsZXQgZXJyb3I6IHN0cmluZ3x1bmRlZmluZWQgPSBxdWVyeVBhcmFtc1snZXJyb3InXTtcbiAgICAgICAgICAgICAgaWYgKHJlcXVlc3RUeXBlID09PSBSZXF1ZXN0VHlwZXMuYXV0aG9yaXphdGlvbikge1xuICAgICAgICAgICAgICAgIGxvZygnUG90ZW50aWFsIGF1dGhvcml6YXRpb24gcmVxdWVzdCAnLFxuICAgICAgICAgICAgICAgICAgICBjdXJyZW50VXJpLFxuICAgICAgICAgICAgICAgICAgICBxdWVyeVBhcmFtcyxcbiAgICAgICAgICAgICAgICAgICAgc3RhdGUsXG4gICAgICAgICAgICAgICAgICAgIGNvZGUsXG4gICAgICAgICAgICAgICAgICAgIGVycm9yKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBsb2coJ1BvdGVudGlhbCBlbmQgc2Vzc2lvbiByZXF1ZXN0ICcsIGN1cnJlbnRVcmksIHF1ZXJ5UGFyYW1zLCBzdGF0ZSwgZXJyb3IpXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgbGV0IHNob3VsZE5vdGlmeSA9IHN0YXRlID09PSByZXF1ZXN0LnN0YXRlO1xuICAgICAgICAgICAgICBsZXQgYXV0aG9yaXphdGlvblJlc3BvbnNlOiBFbmRTZXNzaW9uUmVzcG9uc2V8QXV0aG9yaXphdGlvblJlc3BvbnNlfG51bGwgPSBudWxsO1xuICAgICAgICAgICAgICBsZXQgYXV0aG9yaXphdGlvbkVycm9yOiBBdXRob3JpemF0aW9uRXJyb3J8bnVsbCA9IG51bGw7XG4gICAgICAgICAgICAgIGlmIChzaG91bGROb3RpZnkpIHtcbiAgICAgICAgICAgICAgICBpZiAoZXJyb3IpIHtcbiAgICAgICAgICAgICAgICAgIC8vIGdldCBhZGRpdGlvbmFsIG9wdGlvbmFsIGluZm8uXG4gICAgICAgICAgICAgICAgICBsZXQgZXJyb3JVcmkgPSBxdWVyeVBhcmFtc1snZXJyb3JfdXJpJ107XG4gICAgICAgICAgICAgICAgICBsZXQgZXJyb3JEZXNjcmlwdGlvbiA9IHF1ZXJ5UGFyYW1zWydlcnJvcl9kZXNjcmlwdGlvbiddO1xuICAgICAgICAgICAgICAgICAgYXV0aG9yaXphdGlvbkVycm9yID0gbmV3IEF1dGhvcml6YXRpb25FcnJvcih7XG4gICAgICAgICAgICAgICAgICAgIGVycm9yOiBlcnJvcixcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JfZGVzY3JpcHRpb246IGVycm9yRGVzY3JpcHRpb24sXG4gICAgICAgICAgICAgICAgICAgIGVycm9yX3VyaTogZXJyb3JVcmksXG4gICAgICAgICAgICAgICAgICAgIHN0YXRlOiBzdGF0ZVxuICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIGlmIChyZXF1ZXN0VHlwZSA9PT0gUmVxdWVzdFR5cGVzLmF1dGhvcml6YXRpb24pIHtcbiAgICAgICAgICAgICAgICAgICAgYXV0aG9yaXphdGlvblJlc3BvbnNlID0gbmV3IEF1dGhvcml6YXRpb25SZXNwb25zZSh7Y29kZTogY29kZSwgc3RhdGU6IHN0YXRlfSk7XG4gICAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHJlcXVlc3RUeXBlID09PSBSZXF1ZXN0VHlwZXMuZW5kU2Vzc2lvbikge1xuICAgICAgICAgICAgICAgICAgICBhdXRob3JpemF0aW9uUmVzcG9uc2UgPSBuZXcgRW5kU2Vzc2lvblJlc3BvbnNlKHtzdGF0ZTogc3RhdGV9KVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBjbGVhbnVwIHN0YXRlXG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2VcbiAgICAgICAgICAgICAgICAgICAgLmFsbChbXG4gICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdG9yYWdlQmFja2VuZC5yZW1vdmVJdGVtKFJFUVVFU1RfSEFORExFX0tFWShyZXF1ZXN0VHlwZSkpLFxuICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RvcmFnZUJhY2tlbmQucmVtb3ZlSXRlbShyZXF1ZXN0S2V5KGhhbmRsZSwgcmVxdWVzdFR5cGUpKSxcbiAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0b3JhZ2VCYWNrZW5kLnJlbW92ZUl0ZW0oc2VydmljZUNvbmZpZ3VyYXRpb25LZXkoaGFuZGxlLCByZXF1ZXN0VHlwZSkpXG4gICAgICAgICAgICAgICAgICAgIF0pXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICBsb2coJ0RlbGl2ZXJpbmcgYXV0aG9yaXphdGlvbiByZXNwb25zZScpO1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGF1dGhvcml6YXRpb25SZXNwb25zZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBhdXRob3JpemF0aW9uRXJyb3JcbiAgICAgICAgICAgICAgICAgICAgICB9IGFzIEF1dGhvcml6YXRpb25SZXF1ZXN0UmVzcG9uc2U7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZygnTWlzbWF0Y2hlZCByZXF1ZXN0IChzdGF0ZSBhbmQgcmVxdWVzdF91cmkpIGRvbnQgbWF0Y2guJyk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShudWxsKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxufVxuIl19 \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2hlY2sgZm9yIGluY29uc2lzdGVudCBzdGF0ZSBoZXJlXG4gICAgICAgICAgICAudGhlbihyZXN1bHQgPT4gSlNPTi5wYXJzZShyZXN1bHQhKSlcbiAgICAgICAgICAgIC50aGVuKFxuICAgICAgICAgICAgICAgIGpzb24gPT4gcmVxdWVzdFR5cGUgPT09IFJlZGlyZWN0UmVxdWVzdFR5cGVzLmF1dGhvcml6YXRpb24gP1xuICAgICAgICAgICAgICAgICAgICBuZXcgQXV0aG9yaXphdGlvblJlcXVlc3QoanNvbikgOlxuICAgICAgICAgICAgICAgICAgICBuZXcgRW5kU2Vzc2lvblJlcXVlc3QoanNvbikpXG4gICAgICAgICAgICAudGhlbihyZXF1ZXN0ID0+IHtcbiAgICAgICAgICAgICAgLy8gY2hlY2sgcmVkaXJlY3RfdXJpIGFuZCBzdGF0ZVxuICAgICAgICAgICAgICBsZXQgY3VycmVudFVyaSA9IGAke3RoaXMubG9jYXRpb25MaWtlLm9yaWdpbn0ke3RoaXMubG9jYXRpb25MaWtlLnBhdGhuYW1lfWA7XG4gICAgICAgICAgICAgIGxldCBxdWVyeVBhcmFtcyA9IHRoaXMudXRpbHMucGFyc2UodGhpcy5sb2NhdGlvbkxpa2UsIHRydWUgLyogdXNlIGhhc2ggKi8pO1xuICAgICAgICAgICAgICBsZXQgc3RhdGU6IHN0cmluZ3x1bmRlZmluZWQgPSBxdWVyeVBhcmFtc1snc3RhdGUnXTtcbiAgICAgICAgICAgICAgbGV0IGNvZGU6IHN0cmluZ3x1bmRlZmluZWQgPSBxdWVyeVBhcmFtc1snY29kZSddO1xuICAgICAgICAgICAgICBsZXQgZXJyb3I6IHN0cmluZ3x1bmRlZmluZWQgPSBxdWVyeVBhcmFtc1snZXJyb3InXTtcbiAgICAgICAgICAgICAgaWYgKHJlcXVlc3RUeXBlID09PSBSZWRpcmVjdFJlcXVlc3RUeXBlcy5hdXRob3JpemF0aW9uKSB7XG4gICAgICAgICAgICAgICAgbG9nKCdQb3RlbnRpYWwgYXV0aG9yaXphdGlvbiByZXF1ZXN0ICcsXG4gICAgICAgICAgICAgICAgICAgIGN1cnJlbnRVcmksXG4gICAgICAgICAgICAgICAgICAgIHF1ZXJ5UGFyYW1zLFxuICAgICAgICAgICAgICAgICAgICBzdGF0ZSxcbiAgICAgICAgICAgICAgICAgICAgY29kZSxcbiAgICAgICAgICAgICAgICAgICAgZXJyb3IpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZygnUG90ZW50aWFsIGVuZCBzZXNzaW9uIHJlcXVlc3QgJywgY3VycmVudFVyaSwgcXVlcnlQYXJhbXMsIHN0YXRlLCBlcnJvcilcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBsZXQgc2hvdWxkTm90aWZ5ID0gc3RhdGUgPT09IHJlcXVlc3Quc3RhdGU7XG4gICAgICAgICAgICAgIGxldCBhdXRob3JpemF0aW9uUmVzcG9uc2U6IEVuZFNlc3Npb25SZXNwb25zZXxBdXRob3JpemF0aW9uUmVzcG9uc2V8bnVsbCA9IG51bGw7XG4gICAgICAgICAgICAgIGxldCBhdXRob3JpemF0aW9uRXJyb3I6IEF1dGhvcml6YXRpb25FcnJvcnxudWxsID0gbnVsbDtcbiAgICAgICAgICAgICAgaWYgKHNob3VsZE5vdGlmeSkge1xuICAgICAgICAgICAgICAgIGlmIChlcnJvcikge1xuICAgICAgICAgICAgICAgICAgLy8gZ2V0IGFkZGl0aW9uYWwgb3B0aW9uYWwgaW5mby5cbiAgICAgICAgICAgICAgICAgIGxldCBlcnJvclVyaSA9IHF1ZXJ5UGFyYW1zWydlcnJvcl91cmknXTtcbiAgICAgICAgICAgICAgICAgIGxldCBlcnJvckRlc2NyaXB0aW9uID0gcXVlcnlQYXJhbXNbJ2Vycm9yX2Rlc2NyaXB0aW9uJ107XG4gICAgICAgICAgICAgICAgICBhdXRob3JpemF0aW9uRXJyb3IgPSBuZXcgQXV0aG9yaXphdGlvbkVycm9yKHtcbiAgICAgICAgICAgICAgICAgICAgZXJyb3I6IGVycm9yLFxuICAgICAgICAgICAgICAgICAgICBlcnJvcl9kZXNjcmlwdGlvbjogZXJyb3JEZXNjcmlwdGlvbixcbiAgICAgICAgICAgICAgICAgICAgZXJyb3JfdXJpOiBlcnJvclVyaSxcbiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IHN0YXRlXG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgaWYgKHJlcXVlc3RUeXBlID09PSBSZWRpcmVjdFJlcXVlc3RUeXBlcy5hdXRob3JpemF0aW9uKSB7XG4gICAgICAgICAgICAgICAgICAgIGF1dGhvcml6YXRpb25SZXNwb25zZSA9IG5ldyBBdXRob3JpemF0aW9uUmVzcG9uc2Uoe2NvZGU6IGNvZGUsIHN0YXRlOiBzdGF0ZX0pO1xuICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChyZXF1ZXN0VHlwZSA9PT0gUmVkaXJlY3RSZXF1ZXN0VHlwZXMuZW5kU2Vzc2lvbikge1xuICAgICAgICAgICAgICAgICAgICBhdXRob3JpemF0aW9uUmVzcG9uc2UgPSBuZXcgRW5kU2Vzc2lvblJlc3BvbnNlKHtzdGF0ZTogc3RhdGV9KVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBjbGVhbnVwIHN0YXRlXG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2VcbiAgICAgICAgICAgICAgICAgICAgLmFsbChbXG4gICAgICAgICAgICAgICAgICAgICAgdGhpcy5zdG9yYWdlQmFja2VuZC5yZW1vdmVJdGVtKFJFUVVFU1RfSEFORExFX0tFWShyZXF1ZXN0VHlwZSkpLFxuICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc3RvcmFnZUJhY2tlbmQucmVtb3ZlSXRlbShyZXF1ZXN0S2V5KGhhbmRsZSwgcmVxdWVzdFR5cGUpKSxcbiAgICAgICAgICAgICAgICAgICAgICB0aGlzLnN0b3JhZ2VCYWNrZW5kLnJlbW92ZUl0ZW0oc2VydmljZUNvbmZpZ3VyYXRpb25LZXkoaGFuZGxlLCByZXF1ZXN0VHlwZSkpXG4gICAgICAgICAgICAgICAgICAgIF0pXG4gICAgICAgICAgICAgICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICBsb2coJ0RlbGl2ZXJpbmcgYXV0aG9yaXphdGlvbiByZXNwb25zZScpO1xuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICAgICAgICAgICAgICByZXF1ZXN0OiByZXF1ZXN0LFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVzcG9uc2U6IGF1dGhvcml6YXRpb25SZXNwb25zZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGVycm9yOiBhdXRob3JpemF0aW9uRXJyb3JcbiAgICAgICAgICAgICAgICAgICAgICB9IGFzIEF1dGhvcml6YXRpb25SZXF1ZXN0UmVzcG9uc2U7XG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxvZygnTWlzbWF0Y2hlZCByZXF1ZXN0IChzdGF0ZSBhbmQgcmVxdWVzdF91cmkpIGRvbnQgbWF0Y2guJyk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZShudWxsKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxufVxuIl19 \ No newline at end of file diff --git a/built/types.d.ts b/built/types.d.ts index 78565a9..cc8ab5e 100644 --- a/built/types.d.ts +++ b/built/types.d.ts @@ -15,3 +15,7 @@ export interface LocationLike { search: string; assign(url: string): void; } +export declare enum RedirectRequestTypes { + endSession = "end_session", + authorization = "authorization" +} diff --git a/built/types.js b/built/types.js index d6cbfda..d5a21bd 100644 --- a/built/types.js +++ b/built/types.js @@ -13,4 +13,10 @@ * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7R0FZRyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBDb3B5cmlnaHQgMjAxNyBHb29nbGUgSW5jLlxuICpcbiAqIExpY2Vuc2VkIHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAgKHRoZSBcIkxpY2Vuc2VcIik7IHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0XG4gKiBpbiBjb21wbGlhbmNlIHdpdGggdGhlIExpY2Vuc2UuIFlvdSBtYXkgb2J0YWluIGEgY29weSBvZiB0aGUgTGljZW5zZSBhdFxuICpcbiAqIGh0dHA6Ly93d3cuYXBhY2hlLm9yZy9saWNlbnNlcy9MSUNFTlNFLTIuMFxuICpcbiAqIFVubGVzcyByZXF1aXJlZCBieSBhcHBsaWNhYmxlIGxhdyBvciBhZ3JlZWQgdG8gaW4gd3JpdGluZywgc29mdHdhcmUgZGlzdHJpYnV0ZWQgdW5kZXIgdGhlXG4gKiBMaWNlbnNlIGlzIGRpc3RyaWJ1dGVkIG9uIGFuIFwiQVMgSVNcIiBCQVNJUywgV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJTkQsIGVpdGhlclxuICogZXhwcmVzcyBvciBpbXBsaWVkLiBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kXG4gKiBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS5cbiAqL1xuXG5leHBvcnQgaW50ZXJmYWNlIFN0cmluZ01hcCB7XG4gIFtrZXk6IHN0cmluZ106IHN0cmluZztcbn1cblxuLyoqXG4gKiBSZXByZXNlbnRzIGEgd2luZG93LmxvY2F0aW9uIGxpa2Ugb2JqZWN0LlxuICovXG5leHBvcnQgaW50ZXJmYWNlIExvY2F0aW9uTGlrZSB7XG4gIGhhc2g6IHN0cmluZztcbiAgaG9zdDogc3RyaW5nO1xuICBvcmlnaW46IHN0cmluZztcbiAgaG9zdG5hbWU6IHN0cmluZztcbiAgcGF0aG5hbWU6IHN0cmluZztcbiAgcG9ydDogc3RyaW5nO1xuICBwcm90b2NvbDogc3RyaW5nO1xuICBzZWFyY2g6IHN0cmluZztcbiAgYXNzaWduKHVybDogc3RyaW5nKTogdm9pZDtcbn1cbiJdfQ== \ No newline at end of file +exports.RedirectRequestTypes = void 0; +var RedirectRequestTypes; +(function (RedirectRequestTypes) { + RedirectRequestTypes["endSession"] = "end_session"; + RedirectRequestTypes["authorization"] = "authorization"; +})(RedirectRequestTypes = exports.RedirectRequestTypes || (exports.RedirectRequestTypes = {})); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7R0FZRzs7O0FBcUJILElBQVksb0JBR1g7QUFIRCxXQUFZLG9CQUFvQjtJQUM5QixrREFBMEIsQ0FBQTtJQUMxQix1REFBK0IsQ0FBQTtBQUNqQyxDQUFDLEVBSFcsb0JBQW9CLEdBQXBCLDRCQUFvQixLQUFwQiw0QkFBb0IsUUFHL0IiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogQ29weXJpZ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vc3RuYW1lOiBzdHJpbmc7XG4gIHBhdGhuYW1lOiBzdHJpbmc7XG4gIHBvcnQ6IHN0cmluZztcbiAgcHJvdG9jb2w6IHN0cmluZztcbiAgc2VhcmNoOiBzdHJpbmc7XG4gIGFzc2lnbih1cmw6IHN0cmluZyk6IHZvaWQ7XG59XG5cbmV4cG9ydCBlbnVtIFJlZGlyZWN0UmVxdWVzdFR5cGVzIHtcbiAgZW5kU2Vzc2lvbiA9ICdlbmRfc2Vzc2lvbicsXG4gIGF1dGhvcml6YXRpb24gPSAnYXV0aG9yaXphdGlvbidcbn0iXX0= \ No newline at end of file From 0f012ce849be01621a0037f4b25ecd11262ef992 Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Sat, 11 Sep 2021 19:09:20 +0430 Subject: [PATCH 12/13] Add readme for end session --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index fbef7c0..90663c4 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,33 @@ this.tokenHandler.performTokenRequest(this.configuration, request) }); ``` +##### Make End Session Requests + +```typescript +this.notifier = new AuthorizationNotifier(); +// uses a redirect flow +this.authorizationHandler = new RedirectRequestHandler(); +// set notifier to deliver responses +this.authorizationHandler.setAuthorizationNotifier(this.notifier); +// set a listener to listen for authorization responses +this.notifier.setAuthorizationListener((request, response, error) => { + log('End Session request complete ', request, response, error); + if (response && response instanceof EndSessionResponse) { + //do clean up + } +}); + +// create a request +const request = new EndSessionRequest({ + id_token_hint: this.tokenResponse?.idToken, + post_logout_redirect_uri: settings.post_logout_redirect_uri, + state: undefined, + }) + +// make the end Session request +this.authorizationHandler.performEndSessionRequest(this.configuration, request); +``` + ### Development #### Preamble From fc9125892c361a9e9445e941bc7395ef06e9ff05 Mon Sep 17 00:00:00 2001 From: Arsalan Salari Date: Sat, 11 Sep 2021 19:11:25 +0430 Subject: [PATCH 13/13] Fix readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 90663c4..dfc524b 100644 --- a/README.md +++ b/README.md @@ -131,8 +131,8 @@ this.notifier.setAuthorizationListener((request, response, error) => { // create a request const request = new EndSessionRequest({ - id_token_hint: this.tokenResponse?.idToken, - post_logout_redirect_uri: settings.post_logout_redirect_uri, + id_token_hint: idToken, + post_logout_redirect_uri: post_logout_redirect_uri, state: undefined, })