Skip to content

Commit

Permalink
updated pushed authorization request to handle auth options
Browse files Browse the repository at this point in the history
  • Loading branch information
izahirclemencia committed Aug 17, 2023
1 parent 0d80875 commit 7ce2647
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -76,8 +74,8 @@ export class ParLoginService {
return;
}

if (urlHandler) {
urlHandler(url);
if (authOptions.urlHandler) {
authOptions.urlHandler(url);
} else {
this.redirectService.redirectTo(url);
}
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -20,7 +21,7 @@ export class ParService {

postParRequest(
configuration: OpenIdConfiguration,
customParams?: { [key: string]: string | number | boolean }
authOptions: AuthOptions
): Observable<ParResponse> {
let headers: HttpHeaders = new HttpHeaders();

Expand Down Expand Up @@ -50,7 +51,7 @@ export class ParService {
}

return this.urlService
.createBodyForParCodeFlowRequest(configuration, customParams)
.createBodyForParCodeFlowRequest(configuration, authOptions)
.pipe(
switchMap((data) => {
return this.dataService
Expand Down

0 comments on commit 7ce2647

Please sign in to comment.