mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
* feat(editor): SSO settings page * feat(editor): SSO settings page * feat(editor): SSO settings page * feat(editor): SSO settings page * feat(editor): SSO settings page * feat(editor): SSO settings page * Merge remote-tracking branch 'origin/master' into pay-170-sso-set-up-page # Conflicts: # packages/cli/src/sso/saml/routes/saml.controller.ee.ts * feat(editor): Prevent SSO settings page route * feat(editor): some UI improvements * fix(editor): SSO settings saml config optional chaining * fix return values saml controller * fix(editor): drop dompurify * fix(editor): save xml as is * return authenticationMethod with settings * fix(editor): add missing prop to server * chore(editor): code formatting * fix ldap/saml enable toggle endpoint * fix missing import * prevent faulty ldap setting from breaking startup * remove sso fake-door from users page * fix(editor): update SSO settings route permissions + unit testing * fix(editor): update vite config for test * fix(editor): add paddings to SSO settings page buttons, add translation * fix(editor): fix saml unit test * fix(core): Improve saml test connection function (#5899) improve-saml-test-connection return --------- Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com> Co-authored-by: Romain Minaud <romain.minaud@gmail.com>
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
import { computed, reactive, ref } from 'vue';
|
|
import { defineStore } from 'pinia';
|
|
import { EnterpriseEditionFeature } from '@/constants';
|
|
import { useRootStore } from '@/stores/n8nRootStore';
|
|
import { useSettingsStore } from '@/stores/settings';
|
|
import * as ssoApi from '@/api/sso';
|
|
import { SamlPreferences } from '@/Interface';
|
|
|
|
export const useSSOStore = defineStore('sso', () => {
|
|
const rootStore = useRootStore();
|
|
const settingsStore = useSettingsStore();
|
|
|
|
const state = reactive({
|
|
loading: false,
|
|
});
|
|
|
|
const isLoading = computed(() => state.loading);
|
|
|
|
const setLoading = (loading: boolean) => {
|
|
state.loading = loading;
|
|
};
|
|
|
|
const isSamlLoginEnabled = computed({
|
|
get: () => settingsStore.isSamlLoginEnabled,
|
|
set: (value: boolean) => {
|
|
settingsStore.setSettings({
|
|
...settingsStore.settings,
|
|
sso: {
|
|
...settingsStore.settings.sso,
|
|
saml: {
|
|
...settingsStore.settings.sso.saml,
|
|
loginEnabled: value,
|
|
},
|
|
},
|
|
});
|
|
toggleLoginEnabled(value);
|
|
},
|
|
});
|
|
const isEnterpriseSamlEnabled = computed(() =>
|
|
settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.Saml),
|
|
);
|
|
const isDefaultAuthenticationSaml = computed(() => settingsStore.isDefaultAuthenticationSaml);
|
|
const showSsoLoginButton = computed(
|
|
() =>
|
|
isSamlLoginEnabled.value &&
|
|
isEnterpriseSamlEnabled.value &&
|
|
isDefaultAuthenticationSaml.value,
|
|
);
|
|
|
|
const getSSORedirectUrl = () => ssoApi.initSSO(rootStore.getRestApiContext);
|
|
|
|
const toggleLoginEnabled = (enabled: boolean) =>
|
|
ssoApi.toggleSamlConfig(rootStore.getRestApiContext, { loginEnabled: enabled });
|
|
|
|
const getSamlMetadata = () => ssoApi.getSamlMetadata(rootStore.getRestApiContext);
|
|
const getSamlConfig = () => ssoApi.getSamlConfig(rootStore.getRestApiContext);
|
|
const saveSamlConfig = (config: SamlPreferences) =>
|
|
ssoApi.saveSamlConfig(rootStore.getRestApiContext, config);
|
|
const testSamlConfig = () => ssoApi.testSamlConfig(rootStore.getRestApiContext);
|
|
|
|
return {
|
|
isLoading,
|
|
setLoading,
|
|
isSamlLoginEnabled,
|
|
isEnterpriseSamlEnabled,
|
|
showSsoLoginButton,
|
|
getSSORedirectUrl,
|
|
getSamlMetadata,
|
|
getSamlConfig,
|
|
saveSamlConfig,
|
|
testSamlConfig,
|
|
};
|
|
});
|