rename OIDC_POST_END_SESSION_HOOK to OIDC_AFTER_END_SESSION_HOOK
This commit is contained in:
parent
d392a14223
commit
9ddbdbf294
|
@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
##### Added
|
||||
- Signals when user accept/decline the authorization page.
|
||||
- `OIDC_POST_END_SESSION_HOOK` setting for additional bussiness logic
|
||||
- `OIDC_AFTER_END_SESSION_HOOK` setting for additional business logic
|
||||
- Feature granttype password
|
||||
|
||||
##### Fixed
|
||||
|
|
|
@ -85,9 +85,9 @@ def default_after_userlogin_hook(request, user, client):
|
|||
return None
|
||||
|
||||
|
||||
def default_post_end_session_hook(request, id_token=None, post_logout_redirect_uri=None, state=None, client=None, next_page=None):
|
||||
def default_after_end_session_hook(request, id_token=None, post_logout_redirect_uri=None, state=None, client=None, next_page=None):
|
||||
"""
|
||||
Default function for setting OIDC_POST_END_SESSION_HOOK.
|
||||
Default function for setting OIDC_AFTER_END_SESSION_HOOK.
|
||||
|
||||
:param request: Django request object
|
||||
:type request: django.http.HttpRequest
|
||||
|
|
|
@ -31,12 +31,12 @@ class DefaultSettings(object):
|
|||
return 'oidc_provider.lib.utils.common.default_after_userlogin_hook'
|
||||
|
||||
@property
|
||||
def OIDC_POST_END_SESSION_HOOK(self):
|
||||
def OIDC_AFTER_END_SESSION_HOOK(self):
|
||||
"""
|
||||
OPTIONAL. Provide a way to plug into the end session process just before calling
|
||||
Django's logout function, typically to perform some business logic.
|
||||
"""
|
||||
return 'oidc_provider.lib.utils.common.default_post_end_session_hook'
|
||||
return 'oidc_provider.lib.utils.common.default_after_end_session_hook'
|
||||
|
||||
@property
|
||||
def OIDC_CODE_EXPIRE(self):
|
||||
|
|
|
@ -46,9 +46,9 @@ class EndSessionTestCase(TestCase):
|
|||
response = self.client.get(self.url, query_params)
|
||||
self.assertRedirects(response, self.LOGOUT_URL, fetch_redirect_response=False)
|
||||
|
||||
@mock.patch(settings.get('OIDC_POST_END_SESSION_HOOK'))
|
||||
@mock.patch(settings.get('OIDC_AFTER_END_SESSION_HOOK'))
|
||||
def test_call_post_end_session_hook(self, hook_function):
|
||||
self.client.get(self.url)
|
||||
self.assertTrue(hook_function.called, 'OIDC_POST_END_SESSION_HOOK should be called')
|
||||
self.assertTrue(hook_function.call_count == 1, 'OIDC_POST_END_SESSION_HOOK should be called once but was {}'.format(hook_function.call_count))
|
||||
self.assertTrue(hook_function.called, 'OIDC_AFTER_END_SESSION_HOOK should be called')
|
||||
self.assertTrue(hook_function.call_count == 1, 'OIDC_AFTER_END_SESSION_HOOK should be called once but was {}'.format(hook_function.call_count))
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ class EndSessionView(View):
|
|||
client = None
|
||||
|
||||
next_page = settings.get('LOGIN_URL')
|
||||
post_end_session_hook = settings.get('OIDC_POST_END_SESSION_HOOK', import_str=True)
|
||||
after_end_session_hook = settings.get('OIDC_AFTER_END_SESSION_HOOK', import_str=True)
|
||||
|
||||
if id_token_hint:
|
||||
client_id = client_id_from_id_token(id_token_hint)
|
||||
|
@ -287,7 +287,7 @@ class EndSessionView(View):
|
|||
except Client.DoesNotExist:
|
||||
pass
|
||||
|
||||
post_end_session_hook(
|
||||
after_end_session_hook(
|
||||
request=request,
|
||||
id_token=id_token_hint,
|
||||
post_logout_redirect_uri=post_logout_redirect_uri,
|
||||
|
|
Loading…
Reference in a new issue