UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

183 lines (182 loc) 8.37 kB
; (function () { System.register(["./vue.runtime.esm-bundler-legacy--Sn1h8On.js", "./useTelemetry-legacy-B3pzzkAE.js", "./_baseOrderBy-legacy-CB2Dh5d_.js"], function (_export, _context) { "use strict"; var computed, ref, UserManagementAuthenticationMethod, updateLdapConfig, testLdapConnection, initSSO, getLdapSynchronizations, testSamlConfig, getSamlMetadata, getOidcConfig, saveOidcConfig, getSamlConfig, saveSamlConfig, runLdapSync, getLdapConfig, defineStore, useRootStore, SupportedProtocols, useSSOStore; return { setters: [function (_vueRuntimeEsmBundlerLegacy003Js) { computed = _vueRuntimeEsmBundlerLegacy003Js.C; ref = _vueRuntimeEsmBundlerLegacy003Js.It; }, function (_useTelemetryLegacy00HJs) { UserManagementAuthenticationMethod = _useTelemetryLegacy00HJs.$s; updateLdapConfig = _useTelemetryLegacy00HJs.Cs; testLdapConnection = _useTelemetryLegacy00HJs.Ss; initSSO = _useTelemetryLegacy00HJs.as; getLdapSynchronizations = _useTelemetryLegacy00HJs.bs; testSamlConfig = _useTelemetryLegacy00HJs.cs; getSamlMetadata = _useTelemetryLegacy00HJs.is; getOidcConfig = _useTelemetryLegacy00HJs.ns; saveOidcConfig = _useTelemetryLegacy00HJs.os; getSamlConfig = _useTelemetryLegacy00HJs.rs; saveSamlConfig = _useTelemetryLegacy00HJs.ss; runLdapSync = _useTelemetryLegacy00HJs.xs; getLdapConfig = _useTelemetryLegacy00HJs.ys; }, function (_baseOrderByLegacy00ZJs) { defineStore = _baseOrderByLegacy00ZJs.k; useRootStore = _baseOrderByLegacy00ZJs.r; }], execute: function () { //#region src/features/settings/sso/sso.store.ts _export("t", SupportedProtocols = { SAML: "saml", OIDC: "oidc" }); _export("n", useSSOStore = defineStore("sso", () => { const rootStore = useRootStore(); const authenticationMethod = ref(void 0); const selectedAuthProtocol = ref(void 0); const showSsoLoginButton = computed(() => isSamlLoginEnabled.value && isEnterpriseSamlEnabled.value && isDefaultAuthenticationSaml.value || isOidcLoginEnabled.value && isEnterpriseOidcEnabled.value && isDefaultAuthenticationOidc.value); const getSSORedirectUrl = async existingRedirect => await initSSO(rootStore.restApiContext, existingRedirect); const initialize = options => { authenticationMethod.value = options.authenticationMethod; isEnterpriseLdapEnabled.value = options.features.ldap; if (options.config.ldap) { ldap.value.loginEnabled = options.config.ldap.loginEnabled; ldap.value.loginLabel = options.config.ldap.loginLabel; } isEnterpriseSamlEnabled.value = options.features.saml; if (options.config.saml) { saml.value.loginEnabled = options.config.saml.loginEnabled; saml.value.loginLabel = options.config.saml.loginLabel; } isEnterpriseOidcEnabled.value = options.features.oidc; if (options.config.oidc) { oidc.value.loginEnabled = options.config.oidc.loginEnabled; oidc.value.loginUrl = options.config.oidc.loginUrl || ""; oidc.value.callbackUrl = options.config.oidc.callbackUrl || ""; } }; /** * SAML */ const saml = ref({ loginLabel: "", loginEnabled: false }); const samlConfig = ref(); const isSamlLoginEnabled = computed({ get: () => saml.value.loginEnabled, set: value => { saml.value.loginEnabled = value; } }); const isEnterpriseSamlEnabled = ref(false); const isDefaultAuthenticationSaml = computed(() => authenticationMethod.value === UserManagementAuthenticationMethod.Saml); const getSamlMetadata$1 = async () => await getSamlMetadata(rootStore.restApiContext); const getSamlConfig$1 = async () => { const config = await getSamlConfig(rootStore.restApiContext); samlConfig.value = config; saml.value.loginEnabled = config.loginEnabled; saml.value.loginLabel = config.loginLabel; return config; }; const saveSamlConfig$1 = async config => await saveSamlConfig(rootStore.restApiContext, config); const testSamlConfig$1 = async () => await testSamlConfig(rootStore.restApiContext); /** * OIDC */ const oidc = ref({ loginUrl: "", loginEnabled: false, callbackUrl: "" }); const oidcConfig = ref(); const isEnterpriseOidcEnabled = ref(false); const getOidcConfig$1 = async () => { const config = await getOidcConfig(rootStore.restApiContext); oidcConfig.value = config; return config; }; const saveOidcConfig$1 = async config => { const savedConfig = await saveOidcConfig(rootStore.restApiContext, config); oidcConfig.value = savedConfig; return savedConfig; }; const isOidcLoginEnabled = computed({ get: () => oidc.value.loginEnabled, set: value => { oidc.value.loginEnabled = value; } }); const isDefaultAuthenticationOidc = computed(() => authenticationMethod.value === UserManagementAuthenticationMethod.Oidc); /** * LDAP Configuration */ const ldap = ref({ loginLabel: "", loginEnabled: false }); const isEnterpriseLdapEnabled = ref(false); const isLdapLoginEnabled = computed(() => ldap.value.loginEnabled); const ldapLoginLabel = computed(() => ldap.value.loginLabel); const getLdapConfig$1 = async () => { const rootStore$1 = useRootStore(); return await getLdapConfig(rootStore$1.restApiContext); }; const getLdapSynchronizations$1 = async pagination => { const rootStore$1 = useRootStore(); return await getLdapSynchronizations(rootStore$1.restApiContext, pagination); }; const testLdapConnection$1 = async () => { const rootStore$1 = useRootStore(); return await testLdapConnection(rootStore$1.restApiContext); }; const updateLdapConfig$1 = async ldapConfig => { const rootStore$1 = useRootStore(); return await updateLdapConfig(rootStore$1.restApiContext, ldapConfig); }; const runLdapSync$1 = async data => { const rootStore$1 = useRootStore(); return await runLdapSync(rootStore$1.restApiContext, data); }; const initializeSelectedProtocol = () => { if (selectedAuthProtocol.value) return; selectedAuthProtocol.value = isDefaultAuthenticationOidc.value ? SupportedProtocols.OIDC : SupportedProtocols.SAML; }; return { showSsoLoginButton, getSSORedirectUrl, initialize, selectedAuthProtocol, initializeSelectedProtocol, saml, samlConfig, isSamlLoginEnabled, isEnterpriseSamlEnabled, isDefaultAuthenticationSaml, getSamlMetadata: getSamlMetadata$1, getSamlConfig: getSamlConfig$1, saveSamlConfig: saveSamlConfig$1, testSamlConfig: testSamlConfig$1, oidc, oidcConfig, isOidcLoginEnabled, isEnterpriseOidcEnabled, isDefaultAuthenticationOidc, getOidcConfig: getOidcConfig$1, saveOidcConfig: saveOidcConfig$1, ldap, isLdapLoginEnabled, isEnterpriseLdapEnabled, ldapLoginLabel, getLdapConfig: getLdapConfig$1, getLdapSynchronizations: getLdapSynchronizations$1, testLdapConnection: testLdapConnection$1, updateLdapConfig: updateLdapConfig$1, runLdapSync: runLdapSync$1 }; })); //#endregion } }; }); })();