-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix(auth): Improve error management with sso + fix microsoft saml #9799
Merged
+499
−303
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replaced static error handling in multiple auth guards with a new dynamic error dispatch mechanism using GuardErrorManagerService. Added context-based error propagation, ensuring consistent error management across all guards, including OAuth and provider checks.
Log
|
Replaced `getRequestOriginByHeaders` with `getCallerByContext` for improved clarity and cohesion. Removed unused `OAUTH_INVALID_PAYLOAD` error code and associated metadata handling, simplifying AuthException logic. Adjusted SSO guards to derive subdomain from `origin_url` when available.
Updated the import path for `getCallerByContext` to reflect the correct module location. This ensures the unit tests reference the appropriate file and avoid potential failures due to incorrect imports.
Updated validation schemas to require non-empty strings for critical SSOIdentityProvider fields such as clientID, clientSecret, id, ssoURL, certificate, and issuer. This ensures stricter validation and
packages/twenty-server/src/engine/core-modules/guard-manager/utils/get-caller-by-context.ts
Outdated
Show resolved
Hide resolved
.../twenty-server/src/engine/core-modules/guard-manager/services/guard-error-manager.service.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/guard-manager/guard-manager.module.ts
Outdated
Show resolved
Hide resolved
...ages/twenty-server/src/engine/core-modules/domain-manager/services/domain-manager.service.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/auth/guards/saml-auth.guard.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/auth/guards/saml-auth.guard.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/auth/sign-in-up/hooks/useSSO.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/settings/security/utils/parseSAMLMetadataFromXMLFile.ts
Outdated
Show resolved
Hide resolved
.../twenty-server/src/engine/core-modules/guard-manager/services/guard-error-manager.service.ts
Outdated
Show resolved
Hide resolved
Simplified error handling by replacing `GuardManagerService` with `GuardRedirectService`, improving clarity and modularity. Removed the unused `getCallerByContext`
# Conflicts: # packages/twenty-server/src/engine/core-modules/auth/auth.module.ts # packages/twenty-server/src/engine/core-modules/billing/services/billing-portal.workspace-service.ts
Reorganized imports in `billing-portal.workspace-service.ts` to maintain alphabetical order and consistency. No functional changes were made.
charlesBochet
approved these changes
Jan 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it, thanks for addressing all the feedbacks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #9760 #9758