2023-03-17 13:07:08 -07:00
|
|
|
import { makeRestApiRequest } from '@/utils';
|
2023-04-24 03:18:24 -07:00
|
|
|
import type {
|
2023-04-04 05:28:29 -07:00
|
|
|
IRestApiContext,
|
|
|
|
SamlPreferencesLoginEnabled,
|
|
|
|
SamlPreferences,
|
|
|
|
SamlPreferencesExtractedData,
|
|
|
|
} from '@/Interface';
|
2023-03-17 13:07:08 -07:00
|
|
|
|
|
|
|
export const initSSO = (context: IRestApiContext): Promise<string> => {
|
|
|
|
return makeRestApiRequest(context, 'GET', '/sso/saml/initsso');
|
|
|
|
};
|
2023-04-04 05:28:29 -07:00
|
|
|
|
|
|
|
export const getSamlMetadata = (context: IRestApiContext): Promise<SamlPreferences> => {
|
|
|
|
return makeRestApiRequest(context, 'GET', '/sso/saml/metadata');
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getSamlConfig = (
|
|
|
|
context: IRestApiContext,
|
|
|
|
): Promise<SamlPreferences & SamlPreferencesExtractedData> => {
|
|
|
|
return makeRestApiRequest(context, 'GET', '/sso/saml/config');
|
|
|
|
};
|
|
|
|
|
|
|
|
export const saveSamlConfig = (
|
|
|
|
context: IRestApiContext,
|
|
|
|
data: SamlPreferences,
|
|
|
|
): Promise<SamlPreferences | undefined> => {
|
|
|
|
return makeRestApiRequest(context, 'POST', '/sso/saml/config', data);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const toggleSamlConfig = (
|
|
|
|
context: IRestApiContext,
|
|
|
|
data: SamlPreferencesLoginEnabled,
|
|
|
|
): Promise<void> => {
|
|
|
|
return makeRestApiRequest(context, 'POST', '/sso/saml/config/toggle', data);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const testSamlConfig = (context: IRestApiContext): Promise<string> => {
|
|
|
|
return makeRestApiRequest(context, 'GET', '/sso/saml/config/test');
|
|
|
|
};
|