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

Add OIDC_ROLES_MAPPING support #5053

Merged
merged 11 commits into from May 14, 2024

Conversation

mihaivint
Copy link
Contributor

@mihaivint mihaivint commented May 10, 2024

Description

This add support for OIDC_ROLES_MAPPING environment variable:

OIDC_ROLES_MAPPING='{"RoleMap-Admin": "Admin", "RoleMap-Editor":"Editor", "RoleMap-Owner":"Owner","RoleMap-Viewer":"Viewer"}'

#5052

How Has This Been Tested?

Using Vault OIDC provider using the following scope template for OIDC provider:

SCOPE_TEMPLATE='{
"username": "user",
"email": "test@email.com",
"user_roles":["RoleMap-Admin","RoleMap-Editor"]
}'

In case OIDC_ROLES_MAPPING is not defined user_roles remains with normal behaviour and should look like this:

SCOPE_TEMPLATE='{
"username": "user",
"email": "test@email.com",
"user_roles":["Admin","Editor"]
}'

Checklist

  • The PR is tagged with proper labels (bug, enhancement, feature, documentation)
  • [ x] I have performed a self-review of my own code
  • I have added unit tests that prove my fix is effective or that my feature works
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

@mihaivint
Copy link
Contributor Author

Note that if mapping variable is not defined it maintains the user_roles behaviour

@dy46 dy46 added the enhancement Polish or UX improvements label May 10, 2024
@dy46
Copy link
Member

dy46 commented May 10, 2024

can you add unit tests for this? the code looks good otherwise

@mihaivint
Copy link
Contributor Author

Added, but that section is pain to test without rest of the code.

@wangxiaoyou1993 wangxiaoyou1993 merged commit 465d5ae into mage-ai:master May 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Polish or UX improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants