Projet

Général

Profil

0001-remove-authentic2_auth_saml-from-plugin-system-44320.patch

Emmanuel Cazenave, 22 juin 2020 15:57

Télécharger (4,68 ko)

Voir les différences:

Subject: [PATCH] remove authentic2_auth_saml from plugin system (#44320)

 setup.py                             |  1 -
 src/authentic2/settings.py           |  8 ++++++--
 src/authentic2/urls.py               |  3 ++-
 src/authentic2_auth_saml/__init__.py | 23 -----------------------
 src/authentic2_auth_saml/backends.py |  8 ++++++++
 5 files changed, 16 insertions(+), 27 deletions(-)
setup.py
169 169
      },
170 170
      entry_points={
171 171
          'authentic2.plugin': [
172
              'authentic2-auth-saml = authentic2_auth_saml:Plugin',
173 172
              'authentic2-auth-oidc = authentic2_auth_oidc:Plugin',
174 173
              'authentic2-idp-cas = authentic2_idp_cas:Plugin',
175 174
              'authentic2-idp-oidc = authentic2_idp_oidc:Plugin',
src/authentic2/settings.py
128 128
    'django.contrib.humanize',
129 129
    'django_select2',
130 130
    'django_tables2',
131
    'mellon',
132
    'authentic2_auth_saml',
131 133
    'authentic2.nonce',
132 134
    'authentic2.saml',
133 135
    'authentic2.idp',
......
155 157
    'authentic2.backends.ldap_backend.LDAPBackendPasswordLost',
156 158
    'authentic2.backends.models_backend.DummyModelBackend',
157 159
    'django_rbac.backends.DjangoRBACBackend',
160
    'authentic2_auth_saml.backends.SAMLBackend',
158 161
)
159 162
AUTHENTICATION_BACKENDS = plugins.register_plugins_authentication_backends(AUTHENTICATION_BACKENDS)
160 163
CSRF_FAILURE_VIEW = 'authentic2.views.csrf_failure_view'
......
173 176
# Authentication settings
174 177
###########################
175 178
AUTH_USER_MODEL = 'custom_user.User'
176
AUTH_FRONTENDS = plugins.register_plugins_authenticators((
177
    'authentic2.authenticators.LoginPasswordAuthenticator',))
179
AUTH_FRONTENDS = ('authentic2_auth_saml.authenticators.SAMLAuthenticator',) + \
180
    plugins.register_plugins_authenticators((
181
        'authentic2.authenticators.LoginPasswordAuthenticator',))
178 182

  
179 183
###########################
180 184
# RBAC settings
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_saml.urls
28 29
import authentic2.idp.saml.app_settings
29 30

  
30 31

  
......
155 156
    ),
156 157
    [url(r'^idp/saml2/', include('authentic2.idp.saml.urls'))]
157 158
)
158
urlpatterns = authentic2_idp_saml_urls + urlpatterns
159
urlpatterns = authentic2_auth_saml.urls.urlpatterns + authentic2_idp_saml_urls + urlpatterns
src/authentic2_auth_saml/__init__.py
13 13
#
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16

  
17

  
18
class Plugin(object):
19
    def get_before_urls(self):
20
        from . import urls
21
        return urls.urlpatterns
22

  
23
    def get_apps(self):
24
        return ['mellon', __name__]
25

  
26
    def get_authentication_backends(self):
27
        return ['authentic2_auth_saml.backends.SAMLBackend']
28

  
29
    def get_authenticators(self):
30
        return ['authentic2_auth_saml.authenticators.SAMLAuthenticator']
31

  
32
    def redirect_logout_list(self, request, next_url=None):
33
        from mellon.views import logout
34
        if 'mellon_session' in request.session:
35
            response = logout(request)
36
            if 'Location' in response:
37
                return [response['Location']]
38
        return []
src/authentic2_auth_saml/backends.py
38 38

  
39 39
        import lasso
40 40
        return lasso.SAML2_AUTHN_CONTEXT_PREVIOUS_SESSION
41

  
42
    def redirect_logout_list(self, request, next_url=None):
43
        from mellon.views import logout
44
        if 'mellon_session' in request.session:
45
            response = logout(request)
46
            if 'Location' in response:
47
                return [response['Location']]
48
        return []
41
-