n8n
Version:
n8n Workflow Automation Tool
43 lines • 2.36 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.doRedirectUsersFromLoginToSsoFlow = exports.isSsoJustInTimeProvisioningEnabled = exports.isEmailCurrentAuthenticationMethod = exports.isLdapCurrentAuthenticationMethod = exports.isSamlCurrentAuthenticationMethod = exports.getCurrentAuthenticationMethod = exports.setCurrentAuthenticationMethod = void 0;
const config_1 = __importDefault(require("../config"));
const settings_repository_1 = require("../databases/repositories/settings.repository");
const typedi_1 = __importDefault(require("typedi"));
async function setCurrentAuthenticationMethod(authenticationMethod) {
config_1.default.set('userManagement.authenticationMethod', authenticationMethod);
await typedi_1.default.get(settings_repository_1.SettingsRepository).save({
key: 'userManagement.authenticationMethod',
value: authenticationMethod,
loadOnStartup: true,
}, { transaction: false });
}
exports.setCurrentAuthenticationMethod = setCurrentAuthenticationMethod;
function getCurrentAuthenticationMethod() {
return config_1.default.getEnv('userManagement.authenticationMethod');
}
exports.getCurrentAuthenticationMethod = getCurrentAuthenticationMethod;
function isSamlCurrentAuthenticationMethod() {
return getCurrentAuthenticationMethod() === 'saml';
}
exports.isSamlCurrentAuthenticationMethod = isSamlCurrentAuthenticationMethod;
function isLdapCurrentAuthenticationMethod() {
return getCurrentAuthenticationMethod() === 'ldap';
}
exports.isLdapCurrentAuthenticationMethod = isLdapCurrentAuthenticationMethod;
function isEmailCurrentAuthenticationMethod() {
return getCurrentAuthenticationMethod() === 'email';
}
exports.isEmailCurrentAuthenticationMethod = isEmailCurrentAuthenticationMethod;
function isSsoJustInTimeProvisioningEnabled() {
return config_1.default.getEnv('sso.justInTimeProvisioning');
}
exports.isSsoJustInTimeProvisioningEnabled = isSsoJustInTimeProvisioningEnabled;
function doRedirectUsersFromLoginToSsoFlow() {
return config_1.default.getEnv('sso.redirectLoginToSso');
}
exports.doRedirectUsersFromLoginToSsoFlow = doRedirectUsersFromLoginToSsoFlow;
//# sourceMappingURL=ssoHelpers.js.map
;