diff --git a/packages/cli/src/Interfaces.ts b/packages/cli/src/Interfaces.ts index 145500b9be568..2605c80929105 100644 --- a/packages/cli/src/Interfaces.ts +++ b/packages/cli/src/Interfaces.ts @@ -513,6 +513,7 @@ export interface IN8nUISettings { enterprise: { sharing: boolean; ldap: boolean; + saml: boolean; logStreaming: boolean; }; hideUsagePage: boolean; diff --git a/packages/cli/src/License.ts b/packages/cli/src/License.ts index 72c62eb993f33..66952b0080a1c 100644 --- a/packages/cli/src/License.ts +++ b/packages/cli/src/License.ts @@ -102,6 +102,10 @@ export class License { return this.isFeatureEnabled(LICENSE_FEATURES.LDAP); } + isSamlEnabled() { + return this.isFeatureEnabled(LICENSE_FEATURES.SAML); + } + getCurrentEntitlements() { return this.manager?.getCurrentEntitlements() ?? []; } diff --git a/packages/cli/src/Saml/helpers.ts b/packages/cli/src/Saml/helpers.ts new file mode 100644 index 0000000000000..c12f02cdba15b --- /dev/null +++ b/packages/cli/src/Saml/helpers.ts @@ -0,0 +1,10 @@ +import { getLicense } from '../License'; +import { isUserManagementEnabled } from '../UserManagement/UserManagementHelper'; + +/** + * Check whether the SAML feature is licensed and enabled in the instance + */ +export function isSamlEnabled(): boolean { + const license = getLicense(); + return isUserManagementEnabled() && license.isSamlEnabled(); +} diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index c65300131668d..870a7e124c447 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -145,6 +145,7 @@ import { AbstractServer } from './AbstractServer'; import { configureMetrics } from './metrics'; import { setupBasicAuth } from './middlewares/basicAuth'; import { setupExternalJWTAuth } from './middlewares/externalJWTAuth'; +import { isSamlEnabled } from './Saml/helpers'; const exec = promisify(callbackExec); @@ -275,6 +276,7 @@ class Server extends AbstractServer { enterprise: { sharing: false, ldap: false, + saml: false, logStreaming: config.getEnv('enterprise.features.logStreaming'), }, hideUsagePage: config.getEnv('hideUsagePage'), @@ -303,6 +305,7 @@ class Server extends AbstractServer { sharing: isSharingEnabled(), logStreaming: isLogStreamingEnabled(), ldap: isLdapEnabled(), + saml: isSamlEnabled(), }); if (isLdapEnabled()) { diff --git a/packages/cli/src/config/schema.ts b/packages/cli/src/config/schema.ts index 55925eebf6c34..3fa9dc0cbbb78 100644 --- a/packages/cli/src/config/schema.ts +++ b/packages/cli/src/config/schema.ts @@ -985,6 +985,10 @@ export const schema = { format: Boolean, default: false, }, + saml: { + format: Boolean, + default: false, + }, logStreaming: { format: Boolean, default: false, diff --git a/packages/cli/src/constants.ts b/packages/cli/src/constants.ts index 5b2d2e08721a2..0a50fe90818ff 100644 --- a/packages/cli/src/constants.ts +++ b/packages/cli/src/constants.ts @@ -69,6 +69,7 @@ export const SETTINGS_LICENSE_CERT_KEY = 'license.cert'; export enum LICENSE_FEATURES { SHARING = 'feat:sharing', LDAP = 'feat:ldap', + SAML = 'feat:saml', LOG_STREAMING = 'feat:logStreaming', }