From bb6fd831673df50980603fa8cde84dff72e7c2ad Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 29 Sep 2022 19:38:33 +0200 Subject: [PATCH] misc: adapt to change in protocol for redirect_logout_list (#69739) --- src/authentic2_auth_fedict/__init__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/authentic2_auth_fedict/__init__.py b/src/authentic2_auth_fedict/__init__.py index 9186c8a..61a89e1 100644 --- a/src/authentic2_auth_fedict/__init__.py +++ b/src/authentic2_auth_fedict/__init__.py @@ -35,6 +35,15 @@ class AppConfig(django.apps.AppConfig): user = kwargs.get('user') user.backend = 'authentic2_auth_fedict.backends.FedictBackend' + def a2_hook_redirect_logout_list(self, request, **kwargs): + from mellon.views import logout + + if 'mellon_session' in request.session: + response = logout(request, next_url='/logout/') + if 'Location' in response: + return [response['Location']] + return [] + default_app_config = 'authentic2_auth_fedict.AppConfig' @@ -52,10 +61,12 @@ class Plugin: return ['authentic2_auth_fedict.backends.FedictBackend'] def redirect_logout_list(self, request, next_url=None): + # duplicated, should be removed in the future when + # AppConfig.a2_hook_redirect_logout_list is the only one required from mellon.views import logout if 'mellon_session' in request.session: - response = logout(request) + response = logout(request, next_url='/logout/') if 'Location' in response: return [response['Location']] return [] -- 2.37.2