Browse Source

Feature: add OIDC_CALLBACK_URL to configuration and update auth module to use it

pull/5981/head
Germán Martín 2 weeks ago
parent
commit
bdeb89e9a7
  1. 8
      apps/api/src/app/auth/auth.module.ts
  2. 1
      apps/api/src/services/configuration/configuration.service.ts
  3. 1
      apps/api/src/services/interfaces/environment.interface.ts

8
apps/api/src/app/auth/auth.module.ts

@ -51,6 +51,10 @@ import { OidcStrategy } from './oidc.strategy';
.map((s) => s.trim()) .map((s) => s.trim())
.filter((s) => s.length > 0); .filter((s) => s.length > 0);
const callbackUrl =
configurationService.get('OIDC_CALLBACK_URL') ||
`${configurationService.get('ROOT_URL')}/api/auth/oidc/callback`;
const options: { const options: {
authorizationURL?: string; authorizationURL?: string;
callbackURL: string; callbackURL: string;
@ -61,9 +65,7 @@ import { OidcStrategy } from './oidc.strategy';
tokenURL?: string; tokenURL?: string;
userInfoURL?: string; userInfoURL?: string;
} = { } = {
callbackURL: `${configurationService.get( callbackURL: callbackUrl,
'ROOT_URL'
)}/api/auth/oidc/callback`,
clientID: configurationService.get('OIDC_CLIENT_ID'), clientID: configurationService.get('OIDC_CLIENT_ID'),
clientSecret: configurationService.get('OIDC_CLIENT_SECRET'), clientSecret: configurationService.get('OIDC_CLIENT_SECRET'),
scope scope

1
apps/api/src/services/configuration/configuration.service.ts

@ -59,6 +59,7 @@ export class ConfigurationService {
MAX_ACTIVITIES_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }), MAX_ACTIVITIES_TO_IMPORT: num({ default: Number.MAX_SAFE_INTEGER }),
MAX_CHART_ITEMS: num({ default: 365 }), MAX_CHART_ITEMS: num({ default: 365 }),
OIDC_AUTHORIZATION_URL: str({ default: '' }), OIDC_AUTHORIZATION_URL: str({ default: '' }),
OIDC_CALLBACK_URL: str({ default: '' }),
OIDC_CLIENT_ID: str({ default: '' }), OIDC_CLIENT_ID: str({ default: '' }),
OIDC_CLIENT_SECRET: str({ default: '' }), OIDC_CLIENT_SECRET: str({ default: '' }),
OIDC_ISSUER: str({ default: '' }), OIDC_ISSUER: str({ default: '' }),

1
apps/api/src/services/interfaces/environment.interface.ts

@ -34,6 +34,7 @@ export interface Environment extends CleanedEnvAccessors {
MAX_ACTIVITIES_TO_IMPORT: number; MAX_ACTIVITIES_TO_IMPORT: number;
MAX_CHART_ITEMS: number; MAX_CHART_ITEMS: number;
OIDC_AUTHORIZATION_URL: string; OIDC_AUTHORIZATION_URL: string;
OIDC_CALLBACK_URL: string;
OIDC_CLIENT_ID: string; OIDC_CLIENT_ID: string;
OIDC_CLIENT_SECRET: string; OIDC_CLIENT_SECRET: string;
OIDC_ISSUER: string; OIDC_ISSUER: string;

Loading…
Cancel
Save