-
Notifications
You must be signed in to change notification settings - Fork 604
feat: Add SCIM V2 #2309
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
Open
Bewinxed
wants to merge
37
commits into
master
Choose a base branch
from
bewinxed/add-scim-v2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Add SCIM V2 #2309
Conversation
This file contains hidden or 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
158c1ad to
f514de5
Compare
- Add FindUsersByProviderWithFilter for SCIM user listing - Add FindSCIMGroupsBySSOProviderWithFilter for group listing - Make external_id nullable, add case-insensitive displayName index - Validate user belongs to SSO provider before adding to group
Replace string-based error comparison with proper typed error pattern following existing codebase conventions in models/errors.go.
Remove CountSCIMGroupsBySSOProvider and FindSCIMGroupsBySSOProvider which were superseded by FindSCIMGroupsBySSOProviderWithFilter.
Export UserBelongsToSSOProvider from models package and use it as single source of truth. API layer retains thin wrapper for convenience.
Remove duplicate SCIMFilterResult type from api package in favor of models.SCIMFilterClause. Remove now-unnecessary toModelFilterClause conversion function.
- Remove duplicate SCIMErrorResponse and NewSCIMError from scim_types.go (use apierrors.SCIMHTTPError instead) - Remove duplicate SCIMSchemaError constant (already defined in apierrors) - Fix error wrapping in applySCIMUserPatch for Ban/Logout operations - Fix error wrapping in scimDeleteUser for Logout operation - Wrap validateEmail error in SCIM format in scimCreateUser
Task: fn-1-j1u.5
f514de5 to
7a60f1b
Compare
72e8e4d to
8450879
Compare
Pull Request Test Coverage Report for Build 21133681412Details
💛 - Coveralls |
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.
What kind of change does this PR introduce?
Feature - adds SCIM v2 provisioning support for enterprise SSO providers
This is a complete, general implementation inspired by the needs of this PR #2115
What is the current behavior?
Currently there's no way for identity providers (Okta, Azure AD, OneLogin, etc.) to automatically provision and deprovision users. Admins have to manually manage user accounts when employees join or leave, which is error-prone and doesn't scale for enterprise customers.
What is the new behavior?
Adds full SCIM v2 (RFC 7644) support, allowing identity providers to:
Endpoints added:
GET/POST /scim/v2/Users- list and create usersGET/PUT/PATCH/DELETE /scim/v2/Users/{id}- manage individual usersGET/POST /scim/v2/Groups- list and create groupsGET/PUT/PATCH/DELETE /scim/v2/Groups/{id}- manage individual groups/scim/v2/ServiceProviderConfig,/scim/v2/Schemas,/scim/v2/ResourceTypesAuthentication: Bearer token per SSO provider (stored as bcrypt hash)
Filtering: Full RFC 7644 filter support using the
scim2/filter-parserlibrary - supportseq,ne,co,sw,ew,pr,gt,ge,lt,leoperators withand/or/notlogic.IdP compatibility: Tested with Azure AD quirks (booleans as strings, case-insensitive displayName uniqueness).
Additional context
I tried my best to make the implementation fit within the current tenant/user model instead of new tables for everything, adding schema changes only when necessary.
Some compliance work might be needed for other nuances with other SCIM providers (I've tested Microsoft Azure).
Deviations from RFC 7643
Some deviations from the RFC for SCIM v2 were done that relates to Supabase Auth:
New dependencies
Schema Changes
Testing
All tests were based on the assumptions that the Azure Validation Tool expects, currently all passing.