refactor(editor): Migrate sso to @n8n/rest-api-client (no-changelog) (#16145)

This commit is contained in:
Alex Grozav
2025-06-10 09:02:54 +02:00
committed by GitHub
parent 9cf7293990
commit 00083d5ed6
6 changed files with 13 additions and 12 deletions

View File

@@ -1368,11 +1368,6 @@ export type ExecutionsQueryFilter = {
vote?: ExecutionFilterVote;
};
export type SamlPreferencesExtractedData = {
entityID: string;
returnUrl: string;
};
export declare namespace Cloud {
export interface PlanData {
planId: number;

View File

@@ -1,7 +1,7 @@
import type { SamlPreferences } from '@n8n/api-types';
import type { Server, Request } from 'miragejs';
import { Response } from 'miragejs';
import type { SamlPreferencesExtractedData } from '@/Interface';
import type { SamlPreferencesExtractedData } from '@n8n/rest-api-client/api/sso';
import { faker } from '@faker-js/faker';
import type { AppSchema } from '@/__tests__/server/types';
import { jsonParse } from 'n8n-workflow';

View File

@@ -1,36 +0,0 @@
import type { SamlPreferences, SamlToggleDto } from '@n8n/api-types';
import { makeRestApiRequest } from '@n8n/rest-api-client';
import type { SamlPreferencesExtractedData } from '@/Interface';
import type { IRestApiContext } from '@n8n/rest-api-client';
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> => {
return await makeRestApiRequest(context, 'GET', '/sso/saml/metadata');
};
export const getSamlConfig = async (
context: IRestApiContext,
): Promise<SamlPreferences & SamlPreferencesExtractedData> => {
return await makeRestApiRequest(context, 'GET', '/sso/saml/config');
};
export const saveSamlConfig = async (
context: IRestApiContext,
data: Partial<SamlPreferences>,
): Promise<SamlPreferences | undefined> => {
return await makeRestApiRequest(context, 'POST', '/sso/saml/config', data);
};
export const toggleSamlConfig = async (
context: IRestApiContext,
data: SamlToggleDto,
): Promise<void> => {
return await makeRestApiRequest(context, 'POST', '/sso/saml/config/toggle', data);
};
export const testSamlConfig = async (context: IRestApiContext): Promise<string> => {
return await makeRestApiRequest(context, 'GET', '/sso/saml/config/test');
};

View File

@@ -5,8 +5,8 @@ import { defineStore } from 'pinia';
import { EnterpriseEditionFeature } from '@/constants';
import { useRootStore } from '@n8n/stores/useRootStore';
import { useSettingsStore } from '@/stores/settings.store';
import * as ssoApi from '@/api/sso';
import type { SamlPreferencesExtractedData } from '@/Interface';
import * as ssoApi from '@n8n/rest-api-client/api/sso';
import type { SamlPreferencesExtractedData } from '@n8n/rest-api-client/api/sso';
import { updateCurrentUser } from '@/api/users';
import { useUsersStore } from '@/stores/users.store';

View File

@@ -12,7 +12,7 @@ import { createComponentRenderer } from '@/__tests__/render';
import { EnterpriseEditionFeature } from '@/constants';
import { nextTick } from 'vue';
import { usePageRedirectionHelper } from '@/composables/usePageRedirectionHelper';
import type { SamlPreferencesExtractedData } from '@/Interface';
import type { SamlPreferencesExtractedData } from '@n8n/rest-api-client/api/sso';
const renderView = createComponentRenderer(SettingsSso);