Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce system wide sso providers #9058

Merged
merged 10 commits into from
Dec 13, 2024
Merged

Enforce system wide sso providers #9058

merged 10 commits into from
Dec 13, 2024

Conversation

charlesBochet
Copy link
Member

@charlesBochet charlesBochet commented Dec 13, 2024

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

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR consolidates authentication provider configuration at the system level by introducing system-wide SSO providers in the client configuration.

  • Added authProviders field in packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts to centralize authentication methods configuration
  • Updated packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsx to manage auth provider states including Google, Microsoft, password and SSO options
  • Simplified domain logic in packages/twenty-front/src/pages/auth/SignInUp.tsx by removing special case handling for default domain with multi-workspace
  • Potential issue: Duplicate SSO enabled check in client-config.resolver.ts between authProviders object and isSSOEnabled field could lead to inconsistencies

7 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +11 to +14
authProviders {
google
password
microsoft
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: google, password, and microsoft fields are missing type definitions - they should likely be boolean flags

Comment on lines +15 to +21
sso {
id
name
type
status
issuer
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: sso field appears to be an array type but is not marked as such in the query, which could cause runtime type mismatches

Comment on lines +78 to +84
setAuthProviders({
google: data?.clientConfig.authProviders.google,
microsoft: data?.clientConfig.authProviders.microsoft,
password: data?.clientConfig.authProviders.password,
magicLink: false,
sso: data?.clientConfig.authProviders.sso,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: hardcoding magicLink to false here could cause issues if magicLink auth is supported in the future - consider getting this value from the config instead

Comment on lines 30 to 32
sso: this.environmentService.get('AUTH_SSO_ENABLED'),
},
isSSOEnabled: this.environmentService.get('AUTH_SSO_ENABLED'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Duplicate SSO configuration. authProviders.sso and isSSOEnabled could become inconsistent if environment variables change. Consider removing isSSOEnabled and using authProviders.sso throughout the codebase.

@@ -22,6 +22,13 @@ export class ClientConfigResolver {
'BILLING_FREE_TRIAL_DURATION_IN_DAYS',
),
},
authProviders: {
google: this.environmentService.get('AUTH_GOOGLE_ENABLED'),
magicLink: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: magicLink is hardcoded to false rather than using an environment variable like other auth providers. Consider using AUTH_MAGIC_LINK_ENABLED for consistency.

@charlesBochet charlesBochet merged commit 7e67b1c into main Dec 13, 2024
6 checks passed
@charlesBochet charlesBochet deleted the system-wide-providers branch December 13, 2024 15:38
Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants