From 7ce2647a473fb6076744aa35d90450a1e10cd43c Mon Sep 17 00:00:00 2001 From: Izahir Clemencia Date: Fri, 18 Aug 2023 00:00:08 +0530 Subject: [PATCH] updated pushed authorization request to handle auth options --- .../src/lib/login/par/par-login.service.ts | 12 ++++-------- .../src/lib/login/par/par.service.ts | 5 +++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/projects/angular-auth-oidc-client/src/lib/login/par/par-login.service.ts b/projects/angular-auth-oidc-client/src/lib/login/par/par-login.service.ts index 8d26c956..f5708133 100644 --- a/projects/angular-auth-oidc-client/src/lib/login/par/par-login.service.ts +++ b/projects/angular-auth-oidc-client/src/lib/login/par/par-login.service.ts @@ -48,13 +48,11 @@ export class ParLoginService { 'BEGIN Authorize OIDC Flow, no auth data' ); - const { urlHandler, customParams } = authOptions || {}; - this.authWellKnownService .queryAndStoreAuthWellKnownEndPoints(configuration) .pipe( switchMap(() => - this.parService.postParRequest(configuration, authOptions, customParams) + this.parService.postParRequest(configuration, authOptions) ) ) .subscribe((response) => { @@ -76,8 +74,8 @@ export class ParLoginService { return; } - if (urlHandler) { - urlHandler(url); + if (authOptions.urlHandler) { + authOptions.urlHandler(url); } else { this.redirectService.redirectTo(url); } @@ -109,13 +107,11 @@ export class ParLoginService { 'BEGIN Authorize OIDC Flow with popup, no auth data' ); - const { customParams } = authOptions || {}; - return this.authWellKnownService .queryAndStoreAuthWellKnownEndPoints(configuration) .pipe( switchMap(() => - this.parService.postParRequest(configuration, customParams) + this.parService.postParRequest(configuration, authOptions) ), switchMap((response: ParResponse) => { this.loggerService.logDebug( diff --git a/projects/angular-auth-oidc-client/src/lib/login/par/par.service.ts b/projects/angular-auth-oidc-client/src/lib/login/par/par.service.ts index c3ecac4b..cc7b71c3 100644 --- a/projects/angular-auth-oidc-client/src/lib/login/par/par.service.ts +++ b/projects/angular-auth-oidc-client/src/lib/login/par/par.service.ts @@ -3,6 +3,7 @@ import { Injectable } from '@angular/core'; import { Observable, throwError } from 'rxjs'; import { catchError, map, retry, switchMap } from 'rxjs/operators'; import { DataService } from '../../api/data.service'; +import { AuthOptions } from '../../auth-options'; import { OpenIdConfiguration } from '../../config/openid-configuration'; import { LoggerService } from '../../logging/logger.service'; import { StoragePersistenceService } from '../../storage/storage-persistence.service'; @@ -20,7 +21,7 @@ export class ParService { postParRequest( configuration: OpenIdConfiguration, - customParams?: { [key: string]: string | number | boolean } + authOptions: AuthOptions ): Observable { let headers: HttpHeaders = new HttpHeaders(); @@ -50,7 +51,7 @@ export class ParService { } return this.urlService - .createBodyForParCodeFlowRequest(configuration, customParams) + .createBodyForParCodeFlowRequest(configuration, authOptions) .pipe( switchMap((data) => { return this.dataService