feat(sso): add support for identityProviderId in SAML flow (#9411)
Updated SAML callback URLs and relevant logic to include identityProviderId, ensuring better handling of multiple identity providers. Refactored client and server-side code to streamline form interactions and validation within the SSO module. Fix https://github.com/twentyhq/twenty/issues/9323 https://github.com/twentyhq/twenty/issues/9325
This commit is contained in:
@ -12,7 +12,7 @@ import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/Snac
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { useEffect } from 'react';
|
||||
import pick from 'lodash.pick';
|
||||
import { FormProvider, useForm } from 'react-hook-form';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
@ -31,20 +31,19 @@ export const SettingsSecuritySSOIdentifyProvider = () => {
|
||||
),
|
||||
});
|
||||
|
||||
const selectedType = formConfig.watch('type');
|
||||
|
||||
useEffect(
|
||||
() =>
|
||||
formConfig.reset({
|
||||
...sSOIdentityProviderDefaultValues[selectedType](),
|
||||
name: formConfig.getValues('name'),
|
||||
}),
|
||||
[formConfig, selectedType],
|
||||
);
|
||||
|
||||
const handleSave = async () => {
|
||||
try {
|
||||
await createSSOIdentityProvider(formConfig.getValues());
|
||||
const type = formConfig.getValues('type');
|
||||
|
||||
await createSSOIdentityProvider(
|
||||
SSOIdentitiesProvidersParamsSchema.parse(
|
||||
pick(
|
||||
formConfig.getValues(),
|
||||
Object.keys(sSOIdentityProviderDefaultValues[type]()),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
navigate(getSettingsPagePath(SettingsPath.Security));
|
||||
} catch (error) {
|
||||
enqueueSnackBar((error as Error).message, {
|
||||
|
||||
Reference in New Issue
Block a user