ID_TOKEN_PROCESSING_HOOK gets user argument

This commit is contained in:
Ilya 2016-02-25 09:46:10 +00:00
parent e3ccc2a8f6
commit 49e19e7493
2 changed files with 4 additions and 2 deletions

View file

@ -49,12 +49,14 @@ def default_after_userlogin_hook(request, user, client):
"""
return None
def default_idtoken_processing_hook(id_token):
def default_idtoken_processing_hook(id_token, user):
"""
Hook to perform some additional actions ti `id_token` dictionary just before serialization.
:param id_token: dictionary contains values that going to be serialized into `id_token`
:type id_token: dict
:param user: user for whom id_token is generated
:type user: User
:return: custom modified dictionary of values for `id_token`
:rtype dict
"""

View file

@ -44,7 +44,7 @@ def create_id_token(user, aud, nonce):
if nonce:
dic['nonce'] = str(nonce)
dic = settings.get('OIDC_IDTOKEN_PROCESSING_HOOK', import_str=True)(dic)
dic = settings.get('OIDC_IDTOKEN_PROCESSING_HOOK', import_str=True)(dic, user=user)
return dic