Projet

Général

Profil

0001-remove-authentic2_auth_fc-from-plugin-system-44369.patch

Emmanuel Cazenave, 23 juin 2020 15:16

Télécharger (4,69 ko)

Voir les différences:

Subject: [PATCH] remove authentic2_auth_fc from plugin system (#44369)

 setup.py                           |  5 ---
 src/authentic2/settings.py         |  3 ++
 src/authentic2/urls.py             |  2 ++
 src/authentic2_auth_fc/__init__.py | 51 +++++++++++-------------------
 4 files changed, 24 insertions(+), 37 deletions(-)
setup.py
166 166
          'install_lib': install_lib,
167 167
          'compile_translations': compile_translations,
168 168
          'sdist': sdist,
169
      },
170
      entry_points={
171
          'authentic2.plugin': [
172
              'authentic2-auth-fc = authentic2_auth_fc:Plugin',
173
          ],
174 169
      })
src/authentic2/settings.py
129 129
    'django_select2',
130 130
    'django_tables2',
131 131
    'mellon',
132
    'authentic2_auth_fc',
132 133
    'authentic2_auth_saml',
133 134
    'authentic2_auth_oidc',
134 135
    'authentic2_idp_cas',
......
162 163
    'django_rbac.backends.DjangoRBACBackend',
163 164
    'authentic2_auth_saml.backends.SAMLBackend',
164 165
    'authentic2_auth_oidc.backends.OIDCBackend',
166
    'authentic2_auth_fc.backends.FcBackend',
165 167
)
166 168
AUTHENTICATION_BACKENDS = plugins.register_plugins_authentication_backends(AUTHENTICATION_BACKENDS)
167 169
CSRF_FAILURE_VIEW = 'authentic2.views.csrf_failure_view'
......
183 185
AUTH_FRONTENDS = (
184 186
    'authentic2_auth_saml.authenticators.SAMLAuthenticator',
185 187
    'authentic2_auth_oidc.authenticators.OIDCAuthenticator',
188
    'authentic2_auth_fc.authenticators.FcAuthenticator',
186 189
) + plugins.register_plugins_authenticators((
187 190
    'authentic2.authenticators.LoginPasswordAuthenticator',))
188 191

  
src/authentic2/urls.py
25 25

  
26 26
from . import plugins, views
27 27
from authentic2.decorators import setting_enabled, required, lasso_required
28
import authentic2_auth_fc.urls
28 29
import authentic2_auth_oidc.urls
29 30
import authentic2_auth_saml.urls
30 31
import authentic2_idp_cas.app_settings
......
168 169
)
169 170

  
170 171
urlpatterns = (
172
    authentic2_auth_fc.urls.urlpatterns +
171 173
    authentic2_idp_oidc.urls.urlpatterns +
172 174
    authentic2_idp_cas_urls +
173 175
    authentic2_auth_oidc.urls.urlpatterns +
src/authentic2_auth_fc/__init__.py
20 20
import django.apps
21 21

  
22 22

  
23
class Plugin(object):
24
    def get_before_urls(self):
25
        from . import urls
26
        return urls.urlpatterns
27

  
28
    def get_apps(self):
29
        return [__name__]
30

  
31
    def get_authentication_backends(self):
32
        return ['authentic2_auth_fc.backends.FcBackend']
33

  
34
    def get_authenticators(self):
35
        return ['authentic2_auth_fc.authenticators.FcAuthenticator']
36

  
37
    def redirect_logout_list(self, request, **kwargs):
38
        from django.urls import reverse
39
        from . import utils
40

  
41
        url = utils.build_logout_url(request, next_url=reverse('auth_logout'))
42
        # url is assumed empty if no active session on the OP.
43
        if url:
44
            return [url]
45
        return []
46

  
47
    def registration_form_prefill(self, request):
48
        from . import utils
49

  
50
        if app_settings.enable_registration_form_prefill:
51
            return [utils.get_mapped_attributes(request)]
52
        return []
53

  
54

  
55 23
class AppConfig(django.apps.AppConfig):
56 24

  
57 25
    name = __name__
......
105 73
                    return False
106 74
        return True
107 75

  
76
    def redirect_logout_list(self, request, **kwargs):
77
        from django.urls import reverse
78
        from . import utils
79

  
80
        url = utils.build_logout_url(request, next_url=reverse('auth_logout'))
81
        # url is assumed empty if no active session on the OP.
82
        if url:
83
            return [url]
84
        return []
85

  
86
    def registration_form_prefill(self, request):
87
        from . import utils
88

  
89
        if app_settings.enable_registration_form_prefill:
90
            return [utils.get_mapped_attributes(request)]
91
        return []
92

  
93

  
94

  
108 95

  
109 96
default_app_config = '%s.%s' % (__name__, 'AppConfig')
110
-