feat(oidc): automatic admin mapping based on OIDC group claims#3581
Open
gaetan-steininger wants to merge 7 commits intosemaphoreui:developfrom
Open
feat(oidc): automatic admin mapping based on OIDC group claims#3581gaetan-steininger wants to merge 7 commits intosemaphoreui:developfrom
gaetan-steininger wants to merge 7 commits intosemaphoreui:developfrom
Conversation
Collaborator
|
Hi! Thank you for PR. Reviewing. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request introduces automatic admin privilege assignment for OIDC-authenticated users based on group claims. The feature allows administrators to configure an admin group name in the OIDC provider settings, and users who are members of that group will automatically receive admin privileges upon login.
Changes:
- Added
groups_claimandadmin_groupconfiguration options to OIDC providers - Extended the ClaimsProvider interface with methods to check admin mapping status and validate admin group membership
- Modified the login flow to automatically set admin status based on group claims during OIDC authentication
- Implemented stub methods for LDAP to maintain interface compatibility (LDAP admin mapping not supported)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| util/OdbcProvider.go | Added new config fields (GroupsClaim, AdminGroup) and implemented ClaimsProvider interface methods for admin group checking |
| util/config.go | Added stub implementations of ClaimsProvider methods to LdapMappings to satisfy interface requirements |
| api/login.go | Extended claimResult struct with admin field, integrated admin checking into claims parsing, and added user update logic to persist admin status |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…n LDAP Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Author
|
Hi, Review fixes:
Thanks for the review! |
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
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.
This Pull Request introduces a new feature that automatically maps administrative users based on group information provided in OIDC claims.
This PR extends the existing OIDC integration by leveraging group claims to determine admin privileges dynamically, removing the need for manual admin assignment.
How It Works
Adding 2 options in the
oidc_providersconfig:groups_claim: the name of the claim with user groups in the claimsadmin_group: the name of the admin groupIf the admin_group is included in the user’s groups, the user is promoted to admin upon login; otherwise, the user is assigned a regular user role.
Full config example with gitlab app
{ "sqlite": { "host": "/tmp/database.sqlite" }, "dialect": "sqlite", "tmp_path": "/tmp/semaphore", "web_host": "http://127.0.0.1:3000", "cookie_hash": "************", "cookie_encryption": "**************", "access_key_encryption": "***************", "port": "3000", "interface": "127.0.0.1", "oidc_providers": { "gitlab": { "display_name": "Gitlab", "provider_url": "https://gitlab.com", "client_id": "******************", "client_secret": "***********************", "redirect_url": "http://127.0.0.1:3000/api/auth/oidc/gitlab/redirect", "groups_claim": "groups_direct", "admin_group": "myadmingroup" } } }