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

@@ -8,5 +8,6 @@ export * from './nodeTypes';
export * from './npsSurvey';
export * from './orchestration';
export * from './roles';
export * from './sso';
export * from './ui';
export * from './webhooks';

View File

@@ -0,0 +1,41 @@
import type { SamlPreferences, SamlToggleDto } from '@n8n/api-types';
import type { IRestApiContext } from '../types';
import { makeRestApiRequest } from '../utils';
export type SamlPreferencesExtractedData = {
entityID: string;
returnUrl: string;
};
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');
};