Enforce system wide sso providers (#9058)

We have recently introduced the possibility to specify workspace
specific auth providers.
I'm:
- introducing system wide auth providers (provided by clientConfig)
- making sure workspace specific auth providers belong to system wide
auth providers set
This commit is contained in:
Charles Bochet
2024-12-13 16:38:04 +01:00
committed by GitHub
parent 57869d3c8c
commit 7e67b1c5a6
26 changed files with 382 additions and 236 deletions

View File

@ -7,14 +7,14 @@ import { RecoilRoot, useRecoilValue } from 'recoil';
import { iconsState } from 'twenty-ui';
import { useAuth } from '@/auth/hooks/useAuth';
import { authProvidersState } from '@/client-config/states/authProvidersState';
import { billingState } from '@/client-config/states/billingState';
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
import { isDeveloperDefaultSignInPrefilledState } from '@/client-config/states/isDeveloperDefaultSignInPrefilledState';
import { supportChatState } from '@/client-config/states/supportChatState';
import { workspaceAuthProvidersState } from '@/workspace/states/workspaceAuthProvidersState';
import { email, mocks, password, results, token } from '../__mocks__/useAuth';
import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';
import { email, mocks, password, results, token } from '../__mocks__/useAuth';
const Wrapper = ({ children }: { children: ReactNode }) => (
<MockedProvider mocks={mocks} addTypename={false}>
@ -77,7 +77,9 @@ describe('useAuth', () => {
() => {
const client = useApolloClient();
const icons = useRecoilValue(iconsState);
const authProviders = useRecoilValue(authProvidersState);
const workspaceAuthProviders = useRecoilValue(
workspaceAuthProvidersState,
);
const billing = useRecoilValue(billingState);
const isDeveloperDefaultSignInPrefilled = useRecoilValue(
isDeveloperDefaultSignInPrefilledState,
@ -92,7 +94,7 @@ describe('useAuth', () => {
client,
state: {
icons,
authProviders,
workspaceAuthProviders,
billing,
isDeveloperDefaultSignInPrefilled,
supportChat,
@ -118,7 +120,7 @@ describe('useAuth', () => {
const { state } = result.current;
expect(state.icons).toEqual({});
expect(state.authProviders).toEqual({
expect(state.workspaceAuthProviders).toEqual({
google: true,
microsoft: false,
magicLink: false,