chore(core): Always load oidc and add runtime license checks (#16947)

This commit is contained in:
Andreas Fitzek
2025-07-03 10:40:10 +02:00
committed by GitHub
parent 1e96d5436e
commit c5a371bb89
2 changed files with 8 additions and 5 deletions

View File

@@ -157,11 +157,12 @@ export class Server extends AbstractServer {
// ----------------------------------------
try {
if (this.licenseState.isOidcLicensed()) {
const { OidcService } = await import('@/sso.ee/oidc/oidc.service.ee');
await Container.get(OidcService).init();
await import('@/sso.ee/oidc/routes/oidc.controller.ee');
}
// in the short term, we load the OIDC module here to ensure it is initialized
// ideally we want to migrate this to a module and be able to load it dynamically
// when the license changes, but that requires some refactoring
const { OidcService } = await import('@/sso.ee/oidc/oidc.service.ee');
await Container.get(OidcService).init();
await import('@/sso.ee/oidc/routes/oidc.controller.ee');
} catch (error) {
this.logger.warn(`OIDC initialization failed: ${(error as Error).message}`);
}

View File

@@ -42,6 +42,7 @@ export class OidcController {
}
@Get('/login', { skipAuth: true })
@Licensed('feat:oidc')
async redirectToAuthProvider(_req: Request, res: Response) {
const authorizationURL = await this.oidcService.generateLoginUrl();
@@ -49,6 +50,7 @@ export class OidcController {
}
@Get('/callback', { skipAuth: true })
@Licensed('feat:oidc')
async callbackHandler(req: Request, res: Response) {
const fullUrl = `${this.urlService.getInstanceBaseUrl()}${req.originalUrl}`;
const callbackUrl = new URL(fullUrl);