mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-01-26 22:49:01 -06:00
Enhancement: configurable SSO groups claim (#11841)
--------- Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
@@ -40,15 +40,19 @@ def handle_social_account_updated(sender, request, sociallogin, **kwargs):
|
||||
|
||||
extra_data = sociallogin.account.extra_data or {}
|
||||
social_account_groups = extra_data.get(
|
||||
"groups",
|
||||
settings.SOCIAL_ACCOUNT_SYNC_GROUPS_CLAIM,
|
||||
[],
|
||||
) # pre-allauth 65.11.0 structure
|
||||
|
||||
if not social_account_groups:
|
||||
# allauth 65.11.0+ nests claims under `userinfo`/`id_token`
|
||||
social_account_groups = (
|
||||
extra_data.get("userinfo", {}).get("groups")
|
||||
or extra_data.get("id_token", {}).get("groups")
|
||||
extra_data.get("userinfo", {}).get(
|
||||
settings.SOCIAL_ACCOUNT_SYNC_GROUPS_CLAIM,
|
||||
)
|
||||
or extra_data.get("id_token", {}).get(
|
||||
settings.SOCIAL_ACCOUNT_SYNC_GROUPS_CLAIM,
|
||||
)
|
||||
or []
|
||||
)
|
||||
if settings.SOCIAL_ACCOUNT_SYNC_GROUPS and social_account_groups is not None:
|
||||
|
||||
Reference in New Issue
Block a user