Skip to content

Commit

Permalink
Update scopesclaims.rst
Browse files Browse the repository at this point in the history
Nits: Mention vital OIDC_IDTOKEN_INCLUDE_CLAIMS setting & add commonly used 'preferred_username' claim.
  • Loading branch information
fzzylogic authored and juanifioren committed Dec 24, 2023
1 parent f7c3134 commit 7bd513f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/sections/scopesclaims.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ Somewhere in your Django ``settings.py``::

OIDC_USERINFO = 'myproject.oidc_provider_settings.userinfo'

Note that for OIDC_USERINFO to be used at all, you should also set::

OIDC_IDTOKEN_INCLUDE_CLAIMS = True

Then inside your ``oidc_provider_settings.py`` file create the function for the ``OIDC_USERINFO`` setting::

def userinfo(claims, user):
# Populate claims dict.
claims['preferred_username'] = user.username
claims['name'] = '{0} {1}'.format(user.first_name, user.last_name)
claims['given_name'] = user.first_name
claims['family_name'] = user.last_name
Expand Down

0 comments on commit 7bd513f

Please sign in to comment.