mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-16 09:41:23 +00:00
fix: require a groups claim on token exchange when group management is on (#33846)
Token exchange now refuses the sign-in with a 403 when group management is on, the user is in at least one group and no groups claim can be read from the provider response or the token, the same way the roles check on that path already does.
This commit is contained in:
parent
b31ae40d2e
commit
184eada9ec
1 changed files with 3 additions and 0 deletions
|
|
@ -1753,6 +1753,9 @@ class OAuthManager:
|
|||
user_oauth_groups = []
|
||||
|
||||
user_current_groups: list[GroupModel] = await Groups.get_groups_by_member_id(user.id, db=db)
|
||||
if oauth_claim and claim_data is None and token_claims is not None and user_current_groups:
|
||||
log.warning('Token exchange denied: no readable groups claim in userinfo or the token')
|
||||
raise HTTPException(status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED)
|
||||
all_available_groups: list[GroupModel] = await Groups.get_all_groups(db=db)
|
||||
|
||||
# Create groups if they don't exist and creation is enabled
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue