From 5c1f63705ecb3d3e0a8c0eb02c9b11701781314d Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Mon, 20 Mar 2023 17:03:38 +0100 Subject: [PATCH 01/25] feat(editor): SSO settings page --- .../src/components/SettingsSidebar.vue | 16 +++++++++ packages/editor-ui/src/constants.ts | 1 + .../src/plugins/i18n/locales/en.json | 6 +++- packages/editor-ui/src/plugins/icons.ts | 2 ++ packages/editor-ui/src/router.ts | 32 ++++++++++++++++++ packages/editor-ui/src/stores/sso.ts | 1 + packages/editor-ui/src/views/SettingsSso.vue | 33 +++++++++++++++++++ 7 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 packages/editor-ui/src/views/SettingsSso.vue diff --git a/packages/editor-ui/src/components/SettingsSidebar.vue b/packages/editor-ui/src/components/SettingsSidebar.vue index 02dfe188bf1ed..bd9c380a1ad28 100644 --- a/packages/editor-ui/src/components/SettingsSidebar.vue +++ b/packages/editor-ui/src/components/SettingsSidebar.vue @@ -74,6 +74,14 @@ export default mixins(userHelpers, pushConnection).extend({ available: this.canAccessApiSettings(), activateOnRouteNames: [VIEWS.API_SETTINGS], }, + { + id: 'settings-sso', + icon: 'user-lock', + label: this.$locale.baseText('settings.sso'), + position: 'top', + available: this.canAccessSso(), + activateOnRouteNames: [VIEWS.SSO_SETTINGS], + }, { id: 'settings-ldap', icon: 'network-wired', @@ -143,6 +151,9 @@ export default mixins(userHelpers, pushConnection).extend({ canAccessUsageAndPlan(): boolean { return this.canUserAccessRouteByName(VIEWS.USAGE); }, + canAccessSso(): boolean { + return this.canUserAccessRouteByName(VIEWS.SSO_SETTINGS); + }, onVersionClick() { this.uiStore.openModal(ABOUT_MODAL_KEY); }, @@ -191,6 +202,11 @@ export default mixins(userHelpers, pushConnection).extend({ this.$router.push({ name: VIEWS.USAGE }); } break; + case 'settings-sso': + if (this.$router.currentRoute.name !== VIEWS.SSO_SETTINGS) { + this.$router.push({ name: VIEWS.SSO_SETTINGS }); + } + break; default: break; } diff --git a/packages/editor-ui/src/constants.ts b/packages/editor-ui/src/constants.ts index a7e2e4b597671..1e33ebf0951d4 100644 --- a/packages/editor-ui/src/constants.ts +++ b/packages/editor-ui/src/constants.ts @@ -386,6 +386,7 @@ export enum VIEWS { WORKFLOW_EXECUTIONS = 'WorkflowExecutions', USAGE = 'Usage', LOG_STREAMING_SETTINGS = 'LogStreamingSettingsView', + SSO_SETTINGS = 'SSoSettings', } export enum FAKE_DOOR_FEATURES { diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index 9345cbf838bf5..df4301fcd9703 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -1693,7 +1693,11 @@ "settings.ldap.form.searchTimeout.label": "Search Timeout (Seconds)", "settings.ldap.form.searchTimeout.infoText": "The timeout value for queries to the AD/LDAP server. Increase if you are getting timeout errors caused by a slow AD/LDAP server", "settings.ldap.section.synchronization.title": "Synchronization", - + "settings.sso": "SSO", + "settings.sso.title": "Single Sign On", + "settings.sso.subtitle": "SAML 2.0", + "settings.sso.info": "SAML SSO (Security Assertion Markup Language Single Sign-On) is a type of authentication process that enables users to access multiple applications with a single set of login credentials. {link}", + "settings.sso.info.link": "More info.", "sso.login.divider": "or", "sso.login.button": "Continue with SSO" } diff --git a/packages/editor-ui/src/plugins/icons.ts b/packages/editor-ui/src/plugins/icons.ts index 3d67c20fc2d42..8c0a82d4db008 100644 --- a/packages/editor-ui/src/plugins/icons.ts +++ b/packages/editor-ui/src/plugins/icons.ts @@ -125,6 +125,7 @@ import { faVideo, faTree, faStickyNote as faSolidStickyNote, + faUserLock, } from '@fortawesome/free-solid-svg-icons'; import { faStickyNote } from '@fortawesome/free-regular-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'; @@ -258,5 +259,6 @@ addIcon(faUserFriends); addIcon(faUsers); addIcon(faVideo); addIcon(faTree); +addIcon(faUserLock); Vue.component('font-awesome-icon', FontAwesomeIcon); diff --git a/packages/editor-ui/src/router.ts b/packages/editor-ui/src/router.ts index 3b007a32853d8..2b44adc37fb19 100644 --- a/packages/editor-ui/src/router.ts +++ b/packages/editor-ui/src/router.ts @@ -34,7 +34,9 @@ import { RouteConfigSingleView } from 'vue-router/types/router'; import { VIEWS } from './constants'; import { useSettingsStore } from './stores/settings'; import { useTemplatesStore } from './stores/templates'; +import { useSSOStore } from './stores/sso'; import SettingsUsageAndPlanVue from './views/SettingsUsageAndPlan.vue'; +import SettingsSso from './views/SettingsSso.vue'; import SignoutView from '@/views/SignoutView.vue'; Vue.use(Router); @@ -563,6 +565,36 @@ const router = new Router({ }, }, }, + { + path: 'sso', + name: VIEWS.SSO_SETTINGS, + components: { + settingsView: SettingsSso, + }, + meta: { + telemetry: { + pageCategory: 'settings', + getProperties(route: Route) { + return { + feature: 'sso', + }; + }, + }, + permissions: { + allow: { + loginStatus: [LOGIN_STATUS.LoggedIn], + role: [ROLE.Owner], + }, + deny: { + role: [ROLE.Default], + shouldDeny: () => { + const ssoStore = useSSOStore(); + return !ssoStore.isEnterpriseSamlEnabled; + }, + }, + }, + }, + }, { path: 'log-streaming', name: VIEWS.LOG_STREAMING_SETTINGS, diff --git a/packages/editor-ui/src/stores/sso.ts b/packages/editor-ui/src/stores/sso.ts index 52779c4608c7d..1fbe43867833f 100644 --- a/packages/editor-ui/src/stores/sso.ts +++ b/packages/editor-ui/src/stores/sso.ts @@ -36,6 +36,7 @@ export const useSSOStore = defineStore('sso', () => { return { isLoading, setLoading, + isEnterpriseSamlEnabled, showSsoLoginButton, getSSORedirectUrl, }; diff --git a/packages/editor-ui/src/views/SettingsSso.vue b/packages/editor-ui/src/views/SettingsSso.vue new file mode 100644 index 0000000000000..3dae525cd4577 --- /dev/null +++ b/packages/editor-ui/src/views/SettingsSso.vue @@ -0,0 +1,33 @@ + + + + + From 47772e913bfef856179427f1028059619104b057 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Wed, 22 Mar 2023 14:17:33 +0100 Subject: [PATCH 02/25] feat(editor): SSO settings page --- .../src/sso/saml/routes/saml.controller.ee.ts | 1 - .../cli/src/sso/saml/views/initSsoRedirect.ts | 12 --- packages/editor-ui/src/Interface.ts | 36 +++++++++ packages/editor-ui/src/api/sso.ts | 28 ++++++- .../src/plugins/i18n/locales/en.json | 4 + packages/editor-ui/src/stores/sso.ts | 38 +++++++++- packages/editor-ui/src/utils/typeHelpers.ts | 1 + packages/editor-ui/src/views/SettingsSso.vue | 74 +++++++++++++++++-- 8 files changed, 170 insertions(+), 24 deletions(-) delete mode 100644 packages/cli/src/sso/saml/views/initSsoRedirect.ts create mode 100644 packages/editor-ui/src/utils/typeHelpers.ts diff --git a/packages/cli/src/sso/saml/routes/saml.controller.ee.ts b/packages/cli/src/sso/saml/routes/saml.controller.ee.ts index d5cc9969d2621..536ee38cafdd1 100644 --- a/packages/cli/src/sso/saml/routes/saml.controller.ee.ts +++ b/packages/cli/src/sso/saml/routes/saml.controller.ee.ts @@ -10,7 +10,6 @@ import { SamlService } from '../saml.service.ee'; import { SamlConfiguration } from '../types/requests'; import { AuthError, BadRequestError } from '../../../ResponseHelper'; import { getInitSSOFormView } from '../views/initSsoPost'; -import { getInitSSOPostView } from '../views/initSsoRedirect'; import { issueCookie } from '../../../auth/jwt'; import { validate } from 'class-validator'; import type { PostBindingContext } from 'samlify/types/src/entity'; diff --git a/packages/cli/src/sso/saml/views/initSsoRedirect.ts b/packages/cli/src/sso/saml/views/initSsoRedirect.ts deleted file mode 100644 index 56db9ce0838d7..0000000000000 --- a/packages/cli/src/sso/saml/views/initSsoRedirect.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { BindingContext } from 'samlify/types/src/entity'; - -export function getInitSSOPostView(context: BindingContext): string { - return ` - - `; -} diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index d0394414a20f9..22cde852dd909 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -37,6 +37,7 @@ import { import { SignInType } from './constants'; import { FAKE_DOOR_FEATURES, TRIGGER_NODE_FILTER, REGULAR_NODE_FILTER } from './constants'; import { BulkCommand, Undoable } from '@/models/history'; +import { PartialBy } from '@/utils/typeHelpers'; export * from 'n8n-design-system/types'; @@ -1455,3 +1456,38 @@ export type NodeAuthenticationOption = { value: string; displayOptions?: IDisplayOptions; }; + +export type SamlAttributeMapping = { + email: string; + firstName: string; + lastName: string; + userPrincipalName: string; +}; + +export type SamlLoginBinding = 'post' | 'redirect'; + +export type SamlSignatureConfig = { + prefix: 'ds'; + location: { + reference: '/samlp:Response/saml:Issuer'; + action: 'after'; + }; +}; + +export type SamlPreferencesLoginEnabled = { + loginEnabled: boolean; +}; + +export type SamlPreferences = { + mapping?: SamlAttributeMapping; + metadata?: string; + metadataUrl?: string; + ignoreSSL?: boolean; + loginBinding?: SamlLoginBinding; + acsBinding?: SamlLoginBinding; + authnRequestsSigned?: boolean; + loginLabel?: string; + wantAssertionsSigned?: boolean; + wantMessageSigned?: boolean; + signatureConfig?: SamlSignatureConfig; +} & PartialBy; diff --git a/packages/editor-ui/src/api/sso.ts b/packages/editor-ui/src/api/sso.ts index 5019335d35eb3..c154839482431 100644 --- a/packages/editor-ui/src/api/sso.ts +++ b/packages/editor-ui/src/api/sso.ts @@ -1,6 +1,32 @@ import { makeRestApiRequest } from '@/utils'; -import { IRestApiContext } from '@/Interface'; +import { IRestApiContext, SamlPreferencesLoginEnabled, SamlPreferences } from '@/Interface'; export const initSSO = (context: IRestApiContext): Promise => { return makeRestApiRequest(context, 'GET', '/sso/saml/initsso'); }; + +export const getSamlMetadata = (context: IRestApiContext): Promise => { + return makeRestApiRequest(context, 'GET', '/sso/saml/metadata'); +}; + +export const getSamlConfig = (context: IRestApiContext): Promise => { + return makeRestApiRequest(context, 'GET', '/sso/saml/config'); +}; + +export const saveSamlConfig = ( + context: IRestApiContext, + data: SamlPreferences, +): Promise => { + return makeRestApiRequest(context, 'POST', '/sso/saml/config', data); +}; + +export const toggleSamlConfig = ( + context: IRestApiContext, + data: SamlPreferencesLoginEnabled, +): Promise => { + return makeRestApiRequest(context, 'POST', '/sso/saml/config/toggle', data); +}; + +export const testSamlConfig = (context: IRestApiContext): Promise => { + return makeRestApiRequest(context, 'GET', '/sso/saml/config/test'); +}; diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index df4301fcd9703..dbec626dd48e2 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -1698,6 +1698,10 @@ "settings.sso.subtitle": "SAML 2.0", "settings.sso.info": "SAML SSO (Security Assertion Markup Language Single Sign-On) is a type of authentication process that enables users to access multiple applications with a single set of login credentials. {link}", "settings.sso.info.link": "More info.", + "settings.sso.activated": "Activated", + "settings.sso.deactivated": "Deactivated", + "settings.sso.settings.test": "Test settings", + "settings.sso.settings.save": "Save settings", "sso.login.divider": "or", "sso.login.button": "Continue with SSO" } diff --git a/packages/editor-ui/src/stores/sso.ts b/packages/editor-ui/src/stores/sso.ts index 1fbe43867833f..229bf99ec4316 100644 --- a/packages/editor-ui/src/stores/sso.ts +++ b/packages/editor-ui/src/stores/sso.ts @@ -1,9 +1,10 @@ -import { computed, reactive } from 'vue'; +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 { initSSO } from '@/api/sso'; +import * as ssoApi from '@/api/sso'; +import { SamlPreferences } from '@/Interface'; export const useSSOStore = defineStore('sso', () => { const rootStore = useRootStore(); @@ -19,7 +20,22 @@ export const useSSOStore = defineStore('sso', () => { state.loading = loading; }; - const isSamlLoginEnabled = computed(() => settingsStore.isSamlLoginEnabled); + 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), ); @@ -31,13 +47,27 @@ export const useSSOStore = defineStore('sso', () => { isDefaultAuthenticationSaml.value, ); - const getSSORedirectUrl = () => initSSO(rootStore.getRestApiContext); + 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, }; }); diff --git a/packages/editor-ui/src/utils/typeHelpers.ts b/packages/editor-ui/src/utils/typeHelpers.ts new file mode 100644 index 0000000000000..ce7e0b412773a --- /dev/null +++ b/packages/editor-ui/src/utils/typeHelpers.ts @@ -0,0 +1 @@ +export type PartialBy = Omit & Partial>; diff --git a/packages/editor-ui/src/views/SettingsSso.vue b/packages/editor-ui/src/views/SettingsSso.vue index 3dae525cd4577..bf29ab9881781 100644 --- a/packages/editor-ui/src/views/SettingsSso.vue +++ b/packages/editor-ui/src/views/SettingsSso.vue @@ -1,17 +1,51 @@ +
+ + {{ locale.baseText('settings.sso.settings.test') }} + + + {{ locale.baseText('settings.sso.settings.save') }} + +
From bc6fcee3b123f408db4dbbf6d2b6963479b76890 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Wed, 22 Mar 2023 14:36:14 +0100 Subject: [PATCH 03/25] feat(editor): SSO settings page --- .../src/plugins/i18n/locales/en.json | 6 ++++ packages/editor-ui/src/views/SettingsSso.vue | 32 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index dbec626dd48e2..b1f0d51e3eafe 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -1700,6 +1700,12 @@ "settings.sso.info.link": "More info.", "settings.sso.activated": "Activated", "settings.sso.deactivated": "Deactivated", + "settings.sso.settings.redirectUrl.label": "Redirect URL", + "settings.sso.settings.redirectUrl.help": "Save the Redirect URL as you’ll need it to configure these in the SAML provider’s settings.", + "settings.sso.settings.entityId.label": "Entity ID", + "settings.sso.settings.entityId.help": "Save the Entity URL as you’ll need it to configure these in the SAML provider’s settings.", + "settings.sso.settings.ips.label": "Identity Provider Settings", + "settings.sso.settings.ips.help": "Add the raw Metadata XML provided by your Identity Provider", "settings.sso.settings.test": "Test settings", "settings.sso.settings.save": "Save settings", "sso.login.divider": "or", diff --git a/packages/editor-ui/src/views/SettingsSso.vue b/packages/editor-ui/src/views/SettingsSso.vue index bf29ab9881781..4ccebb3a75344 100644 --- a/packages/editor-ui/src/views/SettingsSso.vue +++ b/packages/editor-ui/src/views/SettingsSso.vue @@ -2,6 +2,7 @@ import { computed, ref } from 'vue'; import { useSSOStore } from '@/stores/sso'; import { i18n as locale } from '@/plugins/i18n'; +import CopyInput from '@/components/CopyInput.vue'; const ssoStore = useSSOStore(); @@ -13,6 +14,8 @@ const ssoActivatedLabel = computed(() => const ssoSettingsSaved = ref(false); const metadata = ref(''); +const redirectUrl = ref(''); +const entityId = ref(''); const onSave = async () => { try { @@ -56,6 +59,29 @@ const onTest = () => { +
+ + + {{ locale.baseText('settings.sso.settings.redirectUrl.help') }} +
+
+ + + {{ locale.baseText('settings.sso.settings.entityId.help') }} +
+
+ + + {{ locale.baseText('settings.sso.settings.ips.help') }} +
{{ locale.baseText('settings.sso.settings.test') }} @@ -86,10 +112,14 @@ const onTest = () => { .buttons { display: flex; justify-content: flex-start; - padding: var(--spacing-xl) 0 0; + padding: var(--spacing-2xl) 0 0; button { margin: 0 var(--spacing-s) 0 0; } } + +.group { + padding: var(--spacing-2xl) 0 0; +} From 9dd767957501fba1741d875d9149d8f1ceec2269 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Wed, 22 Mar 2023 16:55:06 +0100 Subject: [PATCH 04/25] feat(editor): SSO settings page --- .../src/plugins/i18n/locales/en.json | 2 ++ packages/editor-ui/src/views/SettingsSso.vue | 28 +++++++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index b1f0d51e3eafe..a417b0727e25b 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -1701,8 +1701,10 @@ "settings.sso.activated": "Activated", "settings.sso.deactivated": "Deactivated", "settings.sso.settings.redirectUrl.label": "Redirect URL", + "settings.sso.settings.redirectUrl.copied": "Redirect URL copied to clipboard", "settings.sso.settings.redirectUrl.help": "Save the Redirect URL as you’ll need it to configure these in the SAML provider’s settings.", "settings.sso.settings.entityId.label": "Entity ID", + "settings.sso.settings.entityId.copied": "Entity ID copied to clipboard", "settings.sso.settings.entityId.help": "Save the Entity URL as you’ll need it to configure these in the SAML provider’s settings.", "settings.sso.settings.ips.label": "Identity Provider Settings", "settings.sso.settings.ips.help": "Add the raw Metadata XML provided by your Identity Provider", diff --git a/packages/editor-ui/src/views/SettingsSso.vue b/packages/editor-ui/src/views/SettingsSso.vue index 4ccebb3a75344..c8ab671ebd5d9 100644 --- a/packages/editor-ui/src/views/SettingsSso.vue +++ b/packages/editor-ui/src/views/SettingsSso.vue @@ -62,25 +62,27 @@ const onTest = () => {
- {{ locale.baseText('settings.sso.settings.redirectUrl.help') }} + {{ locale.baseText('settings.sso.settings.redirectUrl.help') }}
- {{ locale.baseText('settings.sso.settings.entityId.help') }} + {{ locale.baseText('settings.sso.settings.entityId.help') }}
- {{ locale.baseText('settings.sso.settings.ips.help') }} + {{ locale.baseText('settings.sso.settings.ips.help') }}
@@ -120,6 +122,20 @@ const onTest = () => { } .group { - padding: var(--spacing-2xl) 0 0; + padding: var(--spacing-xl) 0 0; + + label { + display: inline-block; + font-size: var(--font-size-s); + font-weight: var(--font-weight-bold); + padding: 0 0 var(--spacing-2xs); + } + + small { + display: block; + padding: var(--spacing-2xs) 0 0; + font-size: var(--font-size-2xs); + color: var(--color-text-base); + } } From f659b3bca644f59a0a18dfec5799a5a284991c84 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Wed, 22 Mar 2023 21:57:21 +0100 Subject: [PATCH 05/25] feat(editor): SSO settings page --- packages/editor-ui/src/views/SettingsSso.vue | 45 ++++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/packages/editor-ui/src/views/SettingsSso.vue b/packages/editor-ui/src/views/SettingsSso.vue index c8ab671ebd5d9..16d678d097ac3 100644 --- a/packages/editor-ui/src/views/SettingsSso.vue +++ b/packages/editor-ui/src/views/SettingsSso.vue @@ -1,5 +1,6 @@ @@ -100,7 +127,7 @@ const onTest = () => { display: flex; align-items: center; justify-content: space-between; - padding: var(--spacing-2xl) 0 var(--spacing-m); + padding: var(--spacing-2xl) 0 var(--spacing-xl); } .switch { From 438cb67b28f53b6d4a39ef6a89907d89fd017a05 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Wed, 22 Mar 2023 22:03:05 +0100 Subject: [PATCH 06/25] feat(editor): SSO settings page --- packages/editor-ui/src/api/sso.ts | 2 +- packages/editor-ui/src/views/SettingsSso.vue | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/editor-ui/src/api/sso.ts b/packages/editor-ui/src/api/sso.ts index c154839482431..8927c3305a706 100644 --- a/packages/editor-ui/src/api/sso.ts +++ b/packages/editor-ui/src/api/sso.ts @@ -27,6 +27,6 @@ export const toggleSamlConfig = ( return makeRestApiRequest(context, 'POST', '/sso/saml/config/toggle', data); }; -export const testSamlConfig = (context: IRestApiContext): Promise => { +export const testSamlConfig = (context: IRestApiContext): Promise => { return makeRestApiRequest(context, 'GET', '/sso/saml/config/test'); }; diff --git a/packages/editor-ui/src/views/SettingsSso.vue b/packages/editor-ui/src/views/SettingsSso.vue index 16d678d097ac3..513d18cd89405 100644 --- a/packages/editor-ui/src/views/SettingsSso.vue +++ b/packages/editor-ui/src/views/SettingsSso.vue @@ -33,7 +33,8 @@ const onSave = async () => { const onTest = async () => { try { - await ssoStore.testSamlConfig(); + const url = await ssoStore.testSamlConfig(); + window.open(url, '_blank'); } catch (error) { Notification.error({ title: 'Error', From 9f7aaf06d2b322b4beb800065f4b66f3afbfc0d4 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Thu, 23 Mar 2023 14:19:00 +0100 Subject: [PATCH 07/25] Merge remote-tracking branch 'origin/master' into pay-170-sso-set-up-page # Conflicts: # packages/cli/src/sso/saml/routes/saml.controller.ee.ts --- packages/editor-ui/package.json | 2 ++ packages/editor-ui/src/Interface.ts | 5 +++++ packages/editor-ui/src/api/sso.ts | 11 ++++++++--- packages/editor-ui/src/views/SettingsSso.vue | 12 ++++++++++-- pnpm-lock.yaml | 14 ++++++++++++++ 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json index 88a66e96eafa1..fa4e87680a811 100644 --- a/packages/editor-ui/package.json +++ b/packages/editor-ui/package.json @@ -47,6 +47,7 @@ "codemirror-lang-html-n8n": "^1.0.0", "codemirror-lang-n8n-expression": "^0.2.0", "dateformat": "^3.0.3", + "dompurify": "^3.0.1", "esprima-next": "5.8.4", "fast-json-stable-stringify": "^2.1.0", "file-saver": "^2.0.2", @@ -89,6 +90,7 @@ "@testing-library/user-event": "^14.4.3", "@testing-library/vue": "^5.8.3", "@types/dateformat": "^3.0.0", + "@types/dompurify": "^3.0.0", "@types/express": "^4.17.6", "@types/file-saver": "^2.0.1", "@types/humanize-duration": "^3.27.1", diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 22cde852dd909..b4e30313d286f 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -1491,3 +1491,8 @@ export type SamlPreferences = { wantMessageSigned?: boolean; signatureConfig?: SamlSignatureConfig; } & PartialBy; + +export type SamlPreferencesExtractedData = { + entityID: string; + returnUrl: string; +}; diff --git a/packages/editor-ui/src/api/sso.ts b/packages/editor-ui/src/api/sso.ts index 8927c3305a706..430d0836285f8 100644 --- a/packages/editor-ui/src/api/sso.ts +++ b/packages/editor-ui/src/api/sso.ts @@ -1,15 +1,20 @@ import { makeRestApiRequest } from '@/utils'; -import { IRestApiContext, SamlPreferencesLoginEnabled, SamlPreferences } from '@/Interface'; +import { + IRestApiContext, + SamlPreferencesLoginEnabled, + SamlPreferences, + SamlPreferencesExtractedData, +} from '@/Interface'; export const initSSO = (context: IRestApiContext): Promise => { return makeRestApiRequest(context, 'GET', '/sso/saml/initsso'); }; -export const getSamlMetadata = (context: IRestApiContext): Promise => { +export const getSamlMetadata = (context: IRestApiContext): Promise => { return makeRestApiRequest(context, 'GET', '/sso/saml/metadata'); }; -export const getSamlConfig = (context: IRestApiContext): Promise => { +export const getSamlConfig = (context: IRestApiContext): Promise => { return makeRestApiRequest(context, 'GET', '/sso/saml/config'); }; diff --git a/packages/editor-ui/src/views/SettingsSso.vue b/packages/editor-ui/src/views/SettingsSso.vue index 513d18cd89405..026ebc3c3ab05 100644 --- a/packages/editor-ui/src/views/SettingsSso.vue +++ b/packages/editor-ui/src/views/SettingsSso.vue @@ -1,5 +1,6 @@