Skip to content

Commit 387bffa

Browse files
committed
Update Keycloak example (currently broken)
1 parent fc323db commit 387bffa

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

docs/source/administrator/authentication.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ documentation in this project also.
425425
[KeyCloak](https://www.keycloak.org) is an open source based provider of
426426
identity management that you can host yourself. Below is an example on how you
427427
can configure the GenericOAuthenticator class to authenticate against a KeyCloak
428-
server (version 17 or later).
428+
server (last tested with Keycloak 26).
429429

430430
To configure an OpenID Connect client, see [KeyCloak's own
431431
documentation](https://www.keycloak.org/docs/latest/server_admin/index.html#_oidc_clients).
@@ -444,16 +444,32 @@ hub:
444444
username_claim: preferred_username
445445
userdata_params:
446446
state: state
447-
# In order to use keycloak client's roles as authorization layer
448-
claim_groups_key: roles
449-
allowed_groups:
447+
allowed_users:
450448
- user
451-
admin_groups:
449+
admin_users:
452450
- admin
453451
JupyterHub:
454452
authenticator_class: generic-oauth
455453
```
456454

455+
If you want to use Keycloak roles as JupyterHub groups for authorization you must create or modify a Keycloak scope mapper to return the roles, and ensure the mapper is returned in userinfo.
456+
For example, if you modify the default Keycloak Client scope called `roles`:
457+
458+
```yaml
459+
hub:
460+
config:
461+
GenericOAuthenticator:
462+
scope:
463+
- openid
464+
- roles
465+
auth_state_groups_key: oauth_user.realm_access.roles
466+
manage_groups: true
467+
allowed_groups:
468+
- user
469+
admin_groups:
470+
- admin
471+
```
472+
457473
### LDAP and Active Directory
458474

459475
```{warning}

0 commit comments

Comments
 (0)