Projet

Général

Profil

0003-authentic2_auth_oidc-rely-on-get_plugins-for-beeing-.patch

Emmanuel Cazenave, 09 septembre 2020 15:20

Télécharger (1,85 ko)

Voir les différences:

Subject: [PATCH 3/6] authentic2_auth_oidc: rely on get_plugins for beeing
 discovered (#46474)

 src/authentic2/utils/__init__.py |  7 -------
 src/authentic2_auth_oidc/apps.py | 12 +++++++++---
 2 files changed, 9 insertions(+), 10 deletions(-)
src/authentic2/utils/__init__.py
146 146
            if callable(method):
147 147
                list += method(request, **kwargs)
148 148

  
149
    # now try app config
150
    for app_config in django.apps.apps.get_app_configs():
151
        if hasattr(app_config, method_name):
152
            method = getattr(app_config, method_name)
153
            if callable(method):
154
                list += method(request, **kwargs)
155

  
156 149
    return list
157 150

  
158 151

  
src/authentic2_auth_oidc/apps.py
17 17
import django.apps
18 18

  
19 19

  
20
class AppConfig(django.apps.AppConfig):
21

  
22
    name = 'authentic2_auth_oidc'
20
class Plugin(object):
23 21

  
24 22
    def revoke_token(self, provider, access_token):
25 23
        import logging
......
69 67
                params['post_logout_redirect_uri'] = request.build_absolute_uri(reverse('auth_logout'))
70 68
                urls.append(make_url(provider.end_session_endpoint, params=params))
71 69
        return urls
70

  
71

  
72
class AppConfig(django.apps.AppConfig):
73

  
74
    name = 'authentic2_auth_oidc'
75

  
76
    def get_a2_plugin(self):
77
        return Plugin()
72
-