From 813373bce42d2c2bfd81862a90e84fc158976cb9 Mon Sep 17 00:00:00 2001 From: Munish Sharma Date: Thu, 19 Dec 2024 16:13:36 +0000 Subject: [PATCH] #EXUI-2656: passport js rollout needs serviceOverride flag --- package.json | 2 +- src/auth/models/authOptions.interface.ts | 1 + src/auth/models/strategy.class.ts | 2 ++ src/auth/oidc/models/openid.class.ts | 5 ++++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c229d5d..0e85751 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/rpx-xui-node-lib", - "version": "2.29.7", + "version": "2.29.7-exui-2656-rc1", "description": "Common nodejs library components for XUI", "main": "dist/index", "types": "dist/index.d.ts", diff --git a/src/auth/models/authOptions.interface.ts b/src/auth/models/authOptions.interface.ts index 585d706..7239598 100644 --- a/src/auth/models/authOptions.interface.ts +++ b/src/auth/models/authOptions.interface.ts @@ -16,6 +16,7 @@ export interface AuthOptions { allowRolesRegex?: string useCSRF?: boolean routeCredential?: RouteCredential + serviceOverride?: boolean } export interface RouteCredential { diff --git a/src/auth/models/strategy.class.ts b/src/auth/models/strategy.class.ts index b41871b..c68ae00 100644 --- a/src/auth/models/strategy.class.ts +++ b/src/auth/models/strategy.class.ts @@ -36,6 +36,7 @@ export abstract class Strategy extends events.EventEmitter { allowRolesRegex: '.', useCSRF: true, routeCredential: undefined, + serviceOverride: false, } protected constructor(strategyName: string, router: Router, logger: XuiLogger = getLogger('auth:strategy')) { @@ -69,6 +70,7 @@ export abstract class Strategy extends events.EventEmitter { customHeaders: Joi.any(), allowRolesRegex: Joi.string(), useCSRF: Joi.bool(), + serviceOverride: Joi.bool(), routeCredential: Joi.any(), }) const { error } = schema.validate(options) diff --git a/src/auth/oidc/models/openid.class.ts b/src/auth/oidc/models/openid.class.ts index c51f50e..b7bc57e 100644 --- a/src/auth/oidc/models/openid.class.ts +++ b/src/auth/oidc/models/openid.class.ts @@ -130,7 +130,10 @@ export class OpenID extends AuthStrategy { const issuer = await this.discoverIssuer() const metadata = issuer.metadata - metadata.issuer = this.options.issuerURL + if (!this.options.serviceOverride) { + this.logger.log('setting options issuerURL', this.options.issuerURL) + metadata.issuer = this.options.issuerURL + } this.logger.log('discover metadata', metadata)