mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
chore(core): Always load oidc and add runtime license checks (#16947)
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user