Skip to content

Commit

Permalink
add OIDC_GROUPS_CLAIM config var
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Nov 8, 2024
1 parent 86b0363 commit c0a914c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions IM/InfrastructureManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,10 +1434,7 @@ def check_oidc_token(im_auth):

if Config.OIDC_GROUPS:
# Get user groups from any of the possible fields
user_groups = userinfo.get('groups', # Generic
userinfo.get('entitlements', # GEANT
userinfo.get('eduperson_entitlement', # EGI Check-in
[])))
user_groups = userinfo.get(Config.OIDC_GROUPS_CLAIM, [])

if not set(Config.OIDC_GROUPS).issubset(user_groups):
raise InvaliddUserException("Invalid InfrastructureManager credentials. " +
Expand Down
1 change: 1 addition & 0 deletions IM/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class Config:
OIDC_USER_INFO_PATH = "/userinfo"
OIDC_INSTROSPECT_PATH = "/introspect"
OIDC_GROUPS = []
OIDC_GROUPS_CLAIM = "groups"
VM_NUM_USE_CTXT_DIST = 30
DELAY_BETWEEN_VM_RETRIES = 5
VERIFI_SSL = False
Expand Down
2 changes: 2 additions & 0 deletions etc/im.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ OIDC_ISSUERS = https://aai.egi.eu/auth/realms/egi
#OIDC_INSTROSPECT_PATH = "/introspect"
# List of OIDC groups that will be allowed to access the IM service
#OIDC_GROUPS =
# Claim where the groups are stored in the OIDC token
# OIDC_GROUPS_CLAIM = groups
# Force the users to pass a valid OIDC token
#FORCE_OIDC_AUTH = False

Expand Down

0 comments on commit c0a914c

Please sign in to comment.