From 49e19e749331a6bbcbf19c5ad69ce8ccee458d4a Mon Sep 17 00:00:00 2001 From: Ilya Date: Thu, 25 Feb 2016 09:46:10 +0000 Subject: [PATCH] ID_TOKEN_PROCESSING_HOOK gets user argument --- oidc_provider/lib/utils/common.py | 4 +++- oidc_provider/lib/utils/token.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/oidc_provider/lib/utils/common.py b/oidc_provider/lib/utils/common.py index c97c7e8..8eb0869 100644 --- a/oidc_provider/lib/utils/common.py +++ b/oidc_provider/lib/utils/common.py @@ -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 """ diff --git a/oidc_provider/lib/utils/token.py b/oidc_provider/lib/utils/token.py index 85e243c..4708c28 100644 --- a/oidc_provider/lib/utils/token.py +++ b/oidc_provider/lib/utils/token.py @@ -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