From 99d51241677266450ea93b74ee8c797640fc6226 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 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/authentic2_auth_fedict/__init__.py b/src/authentic2_auth_fedict/__init__.py index 9186c8a..1f7303e 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) + if 'Location' in response: + return [response['Location']] + return [] + default_app_config = 'authentic2_auth_fedict.AppConfig' @@ -52,6 +61,8 @@ 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: -- 2.37.2