Rename setting.
This commit is contained in:
parent
73b1cb1efb
commit
782befd6ec
|
@ -49,7 +49,7 @@ def default_after_userlogin_hook(request, user, client):
|
|||
"""
|
||||
return None
|
||||
|
||||
def additional_id_token_processing_hook(id_token):
|
||||
def default_idtoken_processing_hook(id_token):
|
||||
"""
|
||||
Hook to perform some additional actions ti `id_token` dictionary just before serialization.
|
||||
|
||||
|
@ -59,4 +59,3 @@ def additional_id_token_processing_hook(id_token):
|
|||
:rtype dict
|
||||
"""
|
||||
return id_token
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ def create_id_token(user, aud, nonce):
|
|||
if nonce:
|
||||
dic['nonce'] = str(nonce)
|
||||
|
||||
dic = settings.get('OIDC_ID_TOKEN_PROCESSING_HOOK', import_str=True)(dic)
|
||||
dic = settings.get('OIDC_IDTOKEN_PROCESSING_HOOK', import_str=True)(dic)
|
||||
|
||||
return dic
|
||||
|
||||
|
|
|
@ -98,12 +98,12 @@ class DefaultSettings(object):
|
|||
return 'oidc_provider.lib.utils.common.DefaultUserInfo'
|
||||
|
||||
@property
|
||||
def OIDC_ID_TOKEN_PROCESSING_HOOK(self):
|
||||
def OIDC_IDTOKEN_PROCESSING_HOOK(self):
|
||||
"""
|
||||
OPTIONAL. A string with the location of your hook.
|
||||
Used to add extra dictionary values specific for your app into id_token.
|
||||
"""
|
||||
return 'oidc_provider.lib.utils.common.additional_id_token_processing_hook'
|
||||
return 'oidc_provider.lib.utils.common.default_idtoken_processing_hook'
|
||||
|
||||
default_settings = DefaultSettings()
|
||||
|
||||
|
|
|
@ -108,9 +108,9 @@ def fake_sub_generator(user):
|
|||
return user.email
|
||||
|
||||
|
||||
def fake_id_token_processing_hook(id_token):
|
||||
def fake_idtoken_processing_hook(id_token):
|
||||
"""
|
||||
Fake function for inserting some keys into token. Testing OIDC_ID_TOKEN_PROCESSING_HOOK
|
||||
Fake function for inserting some keys into token. Testing OIDC_IDTOKEN_PROCESSING_HOOK.
|
||||
"""
|
||||
id_token['test_id_token_processing_hook'] = FAKE_RANDOM_STRING
|
||||
return id_token
|
||||
id_token['test_idtoken_processing_hook'] = FAKE_RANDOM_STRING
|
||||
return id_token
|
||||
|
|
|
@ -336,10 +336,10 @@ class TokenTestCase(TestCase):
|
|||
|
||||
self.assertEqual(id_token.get('sub'), self.user.email)
|
||||
|
||||
@override_settings(OIDC_ID_TOKEN_PROCESSING_HOOK='oidc_provider.tests.app.utils.fake_id_token_processing_hook')
|
||||
def test_additional_id_token_processing_hook(self):
|
||||
@override_settings(OIDC_IDTOKEN_PROCESSING_HOOK='oidc_provider.tests.app.utils.fake_idtoken_processing_hook')
|
||||
def test_additional_idtoken_processing_hook(self):
|
||||
"""
|
||||
Test custom function for setting OIDC_ID_TOKEN_PROCESSING_HOOK.
|
||||
Test custom function for setting OIDC_IDTOKEN_PROCESSING_HOOK.
|
||||
"""
|
||||
code = self._create_code()
|
||||
|
||||
|
@ -350,4 +350,4 @@ class TokenTestCase(TestCase):
|
|||
response_dic = json.loads(response.content.decode('utf-8'))
|
||||
id_token = JWT().unpack(response_dic['id_token'].encode('utf-8')).payload()
|
||||
|
||||
self.assertEqual(id_token.get('test_id_token_processing_hook'), FAKE_RANDOM_STRING)
|
||||
self.assertEqual(id_token.get('test_idtoken_processing_hook'), FAKE_RANDOM_STRING)
|
||||
|
|
Loading…
Reference in a new issue