mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Port SSO config (#17044)
This commit is contained in:
48
packages/@n8n/config/src/configs/sso.config.ts
Normal file
48
packages/@n8n/config/src/configs/sso.config.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Config, Env, Nested } from '../decorators';
|
||||
|
||||
@Config
|
||||
class SamlConfig {
|
||||
/** Whether to enable SAML SSO. */
|
||||
@Env('N8N_SSO_SAML_LOGIN_ENABLED')
|
||||
loginEnabled: boolean = false;
|
||||
|
||||
@Env('N8N_SSO_SAML_LOGIN_LABEL')
|
||||
loginLabel: string = '';
|
||||
}
|
||||
|
||||
@Config
|
||||
class OidcConfig {
|
||||
/** Whether to enable OIDC SSO. */
|
||||
@Env('N8N_SSO_OIDC_LOGIN_ENABLED')
|
||||
loginEnabled: boolean = false;
|
||||
}
|
||||
|
||||
@Config
|
||||
class LdapConfig {
|
||||
/** Whether to enable LDAP SSO. */
|
||||
@Env('N8N_SSO_LDAP_LOGIN_ENABLED')
|
||||
loginEnabled: boolean = false;
|
||||
|
||||
@Env('N8N_SSO_LDAP_LOGIN_LABEL')
|
||||
loginLabel: string = '';
|
||||
}
|
||||
|
||||
@Config
|
||||
export class SsoConfig {
|
||||
/** Whether to create users when they log in via SSO. */
|
||||
@Env('N8N_SSO_JUST_IN_TIME_PROVISIONING')
|
||||
justInTimeProvisioning: boolean = true;
|
||||
|
||||
/** Whether to redirect users from the login dialog to initialize SSO flow. */
|
||||
@Env('N8N_SSO_REDIRECT_LOGIN_TO_SSO')
|
||||
redirectLoginToSso: boolean = true;
|
||||
|
||||
@Nested
|
||||
saml: SamlConfig;
|
||||
|
||||
@Nested
|
||||
oidc: OidcConfig;
|
||||
|
||||
@Nested
|
||||
ldap: LdapConfig;
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import { TaskRunnersConfig } from './configs/runners.config';
|
||||
import { ScalingModeConfig } from './configs/scaling-mode.config';
|
||||
import { SecurityConfig } from './configs/security.config';
|
||||
import { SentryConfig } from './configs/sentry.config';
|
||||
import { SsoConfig } from './configs/sso.config';
|
||||
import { TagsConfig } from './configs/tags.config';
|
||||
import { TemplatesConfig } from './configs/templates.config';
|
||||
import { UserManagementConfig } from './configs/user-management.config';
|
||||
@@ -167,6 +168,9 @@ export class GlobalConfig {
|
||||
@Nested
|
||||
personalization: PersonalizationConfig;
|
||||
|
||||
@Nested
|
||||
sso: SsoConfig;
|
||||
|
||||
/** Default locale for the UI. */
|
||||
@Env('N8N_DEFAULT_LOCALE')
|
||||
defaultLocale: string = 'en';
|
||||
|
||||
@@ -331,6 +331,21 @@ describe('GlobalConfig', () => {
|
||||
enabled: true,
|
||||
pruneTime: -1,
|
||||
},
|
||||
sso: {
|
||||
justInTimeProvisioning: true,
|
||||
redirectLoginToSso: true,
|
||||
saml: {
|
||||
loginEnabled: false,
|
||||
loginLabel: '',
|
||||
},
|
||||
oidc: {
|
||||
loginEnabled: false,
|
||||
},
|
||||
ldap: {
|
||||
loginEnabled: false,
|
||||
loginLabel: '',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
it('should use all default values when no env variables are defined', () => {
|
||||
|
||||
Reference in New Issue
Block a user