feat: sso admin mapping support#102
Open
BoxBoxJason wants to merge 2 commits intoZimengXiong:mainfrom
Open
Conversation
|
Amazing PR, we strongly need this feature in our team , many thanks 😊 |
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
fb58d56 to
f78809e
Compare
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.
Warning
I am not a cybersecurity expert, the "security" aspects of this PR should be reviewed with utmost care
This PR adds the support of an optional mapping for admin groups when using OIDC SSO.
Combining the variables:
OIDC_GROUPS_CLAIMthat specifies to the backend pod where in the jwt response from OIDC the groups are locatedOIDC_ADMIN_GROUPSthat specifies to the backend pod which group(s) are supposed to be admin (anyone not in them will NOT be admin)Caution
When these parameters are set, the default first user to connect is NO LONGER admin by default
Also, if these parameters are set, manually setting someone as admin will NO LONGER WORK, because the OIDC provider groups become the source of truth for who is admin
Every route call now re evaluates if the user is admin or not before processing.
The README was updated to showcase these new available parameters.
This adds many unit tests for authentication (those were AI generated, they are very complete)
Closes #99
This also fixes some minor issues:
OIDC_DISCOVERY_URLvariable was added to be able to give a separate "discovery" endpoint to the backend than the one the browser will use. (Useful for people who wish to use an internal URL for the backend to reach)Note
This was fully tested with the exact setup in the
docker-compose.ymland thedocker-compose.oidc.yml. In the keycloak, I just manually created one "admins" group, with one user inside, and created a protocol mapper for the groups in the client (default scopes)