fix(editor): Use redirect url also with SSO login (#14893)

This commit is contained in:
Csaba Tuncsik
2025-04-28 10:21:49 +02:00
committed by GitHub
parent 0c7f7b33cb
commit 614579026d
3 changed files with 11 additions and 5 deletions

View File

@@ -2,8 +2,8 @@ import type { SamlPreferences, SamlToggleDto } from '@n8n/api-types';
import { makeRestApiRequest } from '@/utils/apiUtils';
import type { IRestApiContext, SamlPreferencesExtractedData } from '@/Interface';
export const initSSO = async (context: IRestApiContext): Promise<string> => {
return await makeRestApiRequest(context, 'GET', '/sso/saml/initsso');
export const initSSO = async (context: IRestApiContext, redirectUrl = ''): Promise<string> => {
return await makeRestApiRequest(context, 'GET', `/sso/saml/initsso?redirect=${redirectUrl}`);
};
export const getSamlMetadata = async (context: IRestApiContext): Promise<SamlPreferences> => {

View File

@@ -1,5 +1,6 @@
import type { SamlPreferences } from '@n8n/api-types';
import { computed, reactive } from 'vue';
import { useRoute } from 'vue-router';
import { defineStore } from 'pinia';
import { EnterpriseEditionFeature } from '@/constants';
import { useRootStore } from '@/stores/root.store';
@@ -13,6 +14,7 @@ export const useSSOStore = defineStore('sso', () => {
const rootStore = useRootStore();
const settingsStore = useSettingsStore();
const usersStore = useUsersStore();
const route = useRoute();
const state = reactive({
loading: false,
@@ -54,7 +56,11 @@ export const useSSOStore = defineStore('sso', () => {
isDefaultAuthenticationSaml.value,
);
const getSSORedirectUrl = async () => await ssoApi.initSSO(rootStore.restApiContext);
const getSSORedirectUrl = async () =>
await ssoApi.initSSO(
rootStore.restApiContext,
typeof route.query?.redirect === 'string' ? route.query.redirect : '',
);
const toggleLoginEnabled = async (enabled: boolean) =>
await ssoApi.toggleSamlConfig(rootStore.restApiContext, { loginEnabled: enabled });