Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Add saml feature flag #5494

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cli/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ export interface IN8nUISettings {
enterprise: {
sharing: boolean;
ldap: boolean;
saml: boolean;
logStreaming: boolean;
};
hideUsagePage: boolean;
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/License.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() ?? [];
}
Expand Down
10 changes: 10 additions & 0 deletions packages/cli/src/Saml/helpers.ts
Original file line number Diff line number Diff line change
@@ -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();
}
3 changes: 3 additions & 0 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -303,6 +305,7 @@ class Server extends AbstractServer {
sharing: isSharingEnabled(),
logStreaming: isLogStreamingEnabled(),
ldap: isLdapEnabled(),
saml: isSamlEnabled(),
});

if (isLdapEnabled()) {
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,10 @@ export const schema = {
format: Boolean,
default: false,
},
saml: {
format: Boolean,
default: false,
},
logStreaming: {
format: Boolean,
default: false,
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}

Expand Down