Projet

Général

Profil

0001-misc-rename-authentication-frontend-to-authenticator.patch

Serghei Mihai (congés, retour 15/05), 30 janvier 2019 16:19

Télécharger (7,76 ko)

Voir les différences:

Subject: [PATCH] misc: rename authentication "frontend" to "authenticator"
 (#14475)

 src/authentic2/auth2_auth/auth2_ssl/__init__.py  |  4 ++--
 .../{frontends.py => authenticators.py}          |  2 +-
 .../{auth_frontends.py => authenticators.py}     |  2 +-
 src/authentic2/plugins.py                        | 16 ++++++++--------
 src/authentic2/settings.py                       |  4 ++--
 src/authentic2_auth_oidc/__init__.py             |  5 ++---
 .../{auth_frontends.py => authenticators.py}     |  2 +-
 src/authentic2_auth_saml/__init__.py             |  4 ++--
 .../{auth_frontends.py => authenticators.py}     |  2 +-
 9 files changed, 20 insertions(+), 21 deletions(-)
 rename src/authentic2/auth2_auth/auth2_ssl/{frontends.py => authenticators.py} (95%)
 rename src/authentic2/{auth_frontends.py => authenticators.py} (97%)
 rename src/authentic2_auth_oidc/{auth_frontends.py => authenticators.py} (94%)
 rename src/authentic2_auth_saml/{auth_frontends.py => authenticators.py} (97%)
src/authentic2/auth2_auth/auth2_ssl/__init__.py
15 15
    def get_authentication_backends(self):
16 16
        return ['authentic2.auth2_auth.auth2_ssl.backends.SSLBackend']
17 17

  
18
    def get_auth_frontends(self):
19
        return ['authentic2.auth2_auth.auth2_ssl.frontends.SSLFrontend']
18
    def get_authenticators(self):
19
        return ['authentic2.auth2_auth.auth2_ssl.authenticators.SSLAuthenticator']
src/authentic2/auth2_auth/auth2_ssl/frontends.py → src/authentic2/auth2_auth/auth2_ssl/authenticators.py
5 5
from authentic2.utils import redirect_to_login
6 6

  
7 7

  
8
class SSLFrontend(object):
8
class SSLAuthenticator(object):
9 9
    def enabled(self):
10 10
        return app_settings.ENABLE
11 11

  
src/authentic2/auth_frontends.py → src/authentic2/authenticators.py
4 4
from . import views, app_settings, utils, constants, forms
5 5

  
6 6

  
7
class LoginPasswordBackend(object):
7
class LoginPasswordAuthenticator(object):
8 8
    submit_name = 'login-password-submit'
9 9

  
10 10
    def enabled(self):
src/authentic2/plugins.py
64 64

  
65 65
def register_plugins_installed_apps(installed_apps, group_name=DEFAULT_GROUP_NAME):
66 66
    '''Call get_apps() on all plugins of group_name and add the returned
67
       applications path to the installed_apps sequence. 
67
       applications path to the installed_apps sequence.
68 68

  
69 69
       Applications already present are ignored.
70 70
    '''
......
104 104
                    authentication_backends.append(cls)
105 105
    return tuple(authentication_backends)
106 106

  
107
def register_plugins_auth_frontends(auth_frontends=(),
107
def register_plugins_authenticators(authenticators=(),
108 108
        group_name=DEFAULT_GROUP_NAME):
109
    auth_frontends = list(auth_frontends)
109
    authenticators = list(authenticators)
110 110
    for plugin in get_plugins(group_name):
111
        if hasattr(plugin, 'get_auth_frontends'):
112
            cls = plugin.get_auth_frontends()
111
        if hasattr(plugin, 'get_authenticators'):
112
            cls = plugin.get_authenticators()
113 113
            for cls in cls:
114
                if cls not in auth_frontends:
115
                    auth_frontends.append(cls)
116
    return tuple(auth_frontends)
114
                if cls not in authenticators:
115
                    authenticators.append(cls)
116
    return tuple(authenticators)
117 117

  
118 118
def register_plugins_idp_backends(idp_backends,
119 119
        group_name=DEFAULT_GROUP_NAME):
src/authentic2/settings.py
164 164
# Authentication settings
165 165
###########################
166 166
AUTH_USER_MODEL = 'custom_user.User'
167
AUTH_FRONTENDS = plugins.register_plugins_auth_frontends((
168
    'authentic2.auth_frontends.LoginPasswordBackend',))
167
AUTH_FRONTENDS = plugins.register_plugins_authenticators((
168
    'authentic2.authenticators.LoginPasswordAuthenticator',))
169 169

  
170 170
###########################
171 171
# RBAC settings
src/authentic2_auth_oidc/__init__.py
17 17
    def get_authentication_backends(self):
18 18
        return ['authentic2_auth_oidc.backends.OIDCBackend']
19 19

  
20
    def get_auth_frontends(self):
21
        return ['authentic2_auth_oidc.auth_frontends.OIDCFrontend']
20
    def get_authenticators(self):
21
        return ['authentic2_auth_oidc.authenticators.OIDCAuthenticator']
22 22

  
23 23
    def redirect_logout_list(self, request, next=None):
24 24
        from .models import OIDCProvider
......
65 65
                           provider.issuer, e, content)
66 66
            return
67 67
        logger.info(u'revoked token from OIDC provider %s', provider.issuer)
68

  
src/authentic2_auth_oidc/auth_frontends.py → src/authentic2_auth_oidc/authenticators.py
4 4
from . import app_settings, utils
5 5

  
6 6

  
7
class OIDCFrontend(object):
7
class OIDCAuthenticator(object):
8 8
    def enabled(self):
9 9
        return app_settings.ENABLE and utils.has_providers()
10 10

  
src/authentic2_auth_saml/__init__.py
9 9
    def get_authentication_backends(self):
10 10
        return ['authentic2_auth_saml.backends.SAMLBackend']
11 11

  
12
    def get_auth_frontends(self):
13
        return ['authentic2_auth_saml.auth_frontends.SAMLFrontend']
12
    def get_authenticators(self):
13
        return ['authentic2_auth_saml.authenticators.SAMLAuthenticator']
14 14

  
15 15
    def redirect_logout_list(self, request, next_url=None):
16 16
        from mellon.views import logout
src/authentic2_auth_saml/auth_frontends.py → src/authentic2_auth_saml/authenticators.py
8 8
from . import app_settings
9 9

  
10 10

  
11
class SAMLFrontend(object):
11
class SAMLAuthenticator(object):
12 12
    id = 'saml'
13 13

  
14 14
    def enabled(self):
15
-