-
Notifications
You must be signed in to change notification settings - Fork 94
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
Get JupyterHub groups
from Keycloak, support oauthenticator
16.3+
#2361
Get JupyterHub groups
from Keycloak, support oauthenticator
16.3+
#2361
Conversation
6a4691a
to
36ff361
Compare
I can reproduce the failure when using the old Edit: I actually see this with the new version too. |
Previously the keycloak Lines 247 to 251 in 3e1dfde
Lines 161 to 162 in 3e1dfde
Of note previously extracting the group data (for some reason from roles) was working, but these groups were not persisted in JupyterHub (which is why we are moving to The logs:
highlight that this is caused by the misalignment between
|
Looking more through the codebase, it appears that the idea of mapping from keycloak group to a service-specific group roles is prevalent in I think that the solution is to align the JupyterHub and keycloak roles as follows:
@aktech any thoughts? |
I assume this will look for the key "
Will that prevent users in any other group to login to JupyterHub (Nebari)? Context on this: We would want people to be able to create any number of groups with any roles (pre-existing) attached to them. The arbitrary groups creation is already possible. The arbitrary roles creation is not possible yet as they are static in nebari at the moment (explicitly mapped to specific service roles), but after the permissions overhaul, we should be able to create arbitrary roles, like say "I want to create a role to have read access to conda environments in the xyz namespace", hence it's important to be able to fetch all groups/roles from keycloak, irrespective of the fact they are created at the deployment time or after deployment via keycloak's GUI.
Yes. |
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.
I have one comment regarding how allowed_groups
and admin_groups
is set.
username_claim = "preferred_username" | ||
claim_groups_key = "groups" |
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.
Side note:
It's quite weird on oauthenticator
side, that one of them is called: username_claim
and other one is called: claim_groups_key
instead of consistent names.
src/_nebari/stages/kubernetes_services/template/modules/kubernetes/services/jupyterhub/main.tf
Show resolved
Hide resolved
Yes. But! We don't need to use
Ultimately I think we want the last one, but at this time the roles syncing is work in progress. I think I can already make it work by overriding Do we want to do that in this PR? |
I am curious, do we even need this
Will this fetch all the groups from keycloak? If yes, then this is what we need.
Since we're fetching all the groups as per third option, this is not required.
Certainly not, separate PR is better infact. |
By default OAuthenticator will not allow any user unless they meet one of the
What you are proposing is essentially setting
Is there a scenario when a nebari user would be allowed access to say conda-store but not to JupyterHub? I guess it does not make sense because conda-store is a resource for JupyterHub users, and any user who is trusted with conda-store would usually also trusted to access JupyterHub... unless in a high confidentiality deployment when someone wanted to get an external eye on conda-store config, but without exposing the shared file system? But we can also have fine-grained file system permissions so I guess it does not matter if configured properly? |
FYI while I was referencing OAuthenticator above, this behaviour is also going to be the same in JupyterHub 5.0 in general, see jupyterhub/jupyterhub#4701. |
It's fine to have
I don't think so.
Yes, that makes sense. Regarding fine-grained permissions here is a proposal: nebari-dev/governance#47 |
Also, If this is true, this PR is good to merge. |
The groups are synced from keycloak, but |
I meant all groups should be allowed, but I see what's happening. I understand now that we need to make sure every user who's allowed to login to Nebari (JupyterHub), needs to be in one of the So, no change required now, this PR looks good to me. |
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.
Thanks for digging into it, this looks good to me.
Reference Issues or PRs
groups
to get populated from keycloak requires Upgradeoauthenticator
to 16.3.0 nebari-docker-images#131What does this implement/fix?
Put a
x
in the boxes that applyTesting
To test:
oauthenticator
to 16.3.0 nebari-docker-images#131:/hub/api/users
Any other comments?