Skip to content

Commit adce04e

Browse files
committed
Fix the default auth config processing
1 parent 987ac19 commit adce04e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/portal-options/auth-config-provider.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('PMAuthConfigProvider', () => {
2929
it('should delegate to EnvAuthConfigService if available', async () => {
3030
const req = { hostname: 'foo.example.com' } as Request;
3131
const expected = {
32-
idpName: 'idp',
32+
idpName: 'foo',
3333
baseDomain: 'example.com',
3434
oauthServerUrl: 'url',
3535
oauthTokenUrl: 'token',

src/portal-options/auth-config-provider.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ export class PMAuthConfigProvider implements AuthConfigService {
1818

1919
async getAuthConfig(request: Request): Promise<ServerAuthVariables> {
2020
try {
21-
return await this.envEuthConfigService.getAuthConfig(request);
21+
const authConfig = await this.envEuthConfigService.getAuthConfig(request);
22+
const subDomain = request.hostname.split('.')[0];
23+
return {
24+
...authConfig,
25+
idpName:
26+
request.hostname === authConfig.baseDomain
27+
? authConfig.idpName
28+
: subDomain,
29+
};
2230
} catch {
2331
this.logger.debug(
2432
'Failed to retrieve auth config from environment variables based on provided IDP.',

0 commit comments

Comments
 (0)