mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-28 07:17:04 +02:00
feat: Add new env vars for sso provisioning configuration (#20749)
This commit is contained in:
parent
64ad7586c6
commit
28a4e2c418
|
|
@ -1,5 +1,7 @@
|
|||
import { Config, Env, Nested } from '../decorators';
|
||||
|
||||
type ScopesProvisioningFrequency = 'never' | 'first_login' | 'every_login';
|
||||
|
||||
@Config
|
||||
class SamlConfig {
|
||||
/** Whether to enable SAML SSO. */
|
||||
|
|
@ -27,6 +29,33 @@ class LdapConfig {
|
|||
loginLabel: string = '';
|
||||
}
|
||||
|
||||
@Config
|
||||
class ProvisioningConfig {
|
||||
/** Whether to provision the instance role from an SSO auth claim */
|
||||
@Env('N8N_SSO_SCOPES_PROVISION_INSTANCE_ROLE')
|
||||
scopesProvisionInstanceRole: boolean = false;
|
||||
|
||||
/** Whether to provision the project <> role mappings from an SSO auth claim */
|
||||
@Env('N8N_SSO_SCOPES_PROVISION_PROJECT_ROLES')
|
||||
scopesProvisionProjectRoles: boolean = false;
|
||||
|
||||
/** How often to trigger provisioning, never, fist login, or every login */
|
||||
@Env('N8N_SSO_SCOPES_PROVISIONING_FREQUENCY')
|
||||
scopesProvisioningFrequency: ScopesProvisioningFrequency = 'never';
|
||||
|
||||
/** The name of scope to request on oauth flows */
|
||||
@Env('N8N_SSO_SCOPES_NAME')
|
||||
scopesName: string = 'n8n';
|
||||
|
||||
/** The name of the expected claim to be returned for provisioning instance role */
|
||||
@Env('N8N_SSO_SCOPES_INSTANCE_ROLE_CLAIM_NAME')
|
||||
scopesInstanceRoleClaimName: string = 'n8n_instance_role';
|
||||
|
||||
/** The name of the expected claim to be returned for provisioning project <> role mappings */
|
||||
@Env('N8N_SSO_SCOPES_PROJECTS_ROLES_CLAIM_NAME')
|
||||
scopesProjectsRolesClaimName: string = 'n8n_projects';
|
||||
}
|
||||
|
||||
@Config
|
||||
export class SsoConfig {
|
||||
/** Whether to create users when they log in via SSO. */
|
||||
|
|
@ -45,4 +74,7 @@ export class SsoConfig {
|
|||
|
||||
@Nested
|
||||
ldap: LdapConfig;
|
||||
|
||||
@Nested
|
||||
provisioning: ProvisioningConfig;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,6 +368,14 @@ describe('GlobalConfig', () => {
|
|||
loginEnabled: false,
|
||||
loginLabel: '',
|
||||
},
|
||||
provisioning: {
|
||||
scopesProvisionInstanceRole: false,
|
||||
scopesProvisionProjectRoles: false,
|
||||
scopesProvisioningFrequency: 'never',
|
||||
scopesName: 'n8n',
|
||||
scopesInstanceRoleClaimName: 'n8n_instance_role',
|
||||
scopesProjectsRolesClaimName: 'n8n_projects',
|
||||
},
|
||||
},
|
||||
redis: {
|
||||
prefix: 'n8n',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user