ID_TOKEN_PROCESSING_HOOK gets user argument
This commit is contained in:
parent
e3ccc2a8f6
commit
49e19e7493
2 changed files with 4 additions and 2 deletions
|
@ -49,12 +49,14 @@ def default_after_userlogin_hook(request, user, client):
|
||||||
"""
|
"""
|
||||||
return None
|
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.
|
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`
|
:param id_token: dictionary contains values that going to be serialized into `id_token`
|
||||||
:type id_token: dict
|
: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`
|
:return: custom modified dictionary of values for `id_token`
|
||||||
:rtype dict
|
:rtype dict
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -44,7 +44,7 @@ def create_id_token(user, aud, nonce):
|
||||||
if nonce:
|
if nonce:
|
||||||
dic['nonce'] = str(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
|
return dic
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue