mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(editor): Migrate sso to @n8n/rest-api-client (no-changelog) (#16145)
This commit is contained in:
@@ -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';
|
||||
|
||||
41
packages/frontend/@n8n/rest-api-client/src/api/sso.ts
Normal file
41
packages/frontend/@n8n/rest-api-client/src/api/sso.ts
Normal 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');
|
||||
};
|
||||
Reference in New Issue
Block a user