From a0c7ad9a96dcfc932f149ce172e6303328d1ca7b Mon Sep 17 00:00:00 2001
From: Serghei Mihai <smihai@entrouvert.com>
Date: Wed, 21 Nov 2018 15:34:51 +0100
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%)

diff --git a/src/authentic2/auth2_auth/auth2_ssl/__init__.py b/src/authentic2/auth2_auth/auth2_ssl/__init__.py
index 631986b3..b62b71a8 100644
--- a/src/authentic2/auth2_auth/auth2_ssl/__init__.py
+++ b/src/authentic2/auth2_auth/auth2_ssl/__init__.py
@@ -15,5 +15,5 @@ class Plugin(object):
     def get_authentication_backends(self):
         return ['authentic2.auth2_auth.auth2_ssl.backends.SSLBackend']
 
-    def get_auth_frontends(self):
-        return ['authentic2.auth2_auth.auth2_ssl.frontends.SSLFrontend']
+    def get_authenticators(self):
+        return ['authentic2.auth2_auth.auth2_ssl.authenticators.SSLAuthenticator']
diff --git a/src/authentic2/auth2_auth/auth2_ssl/frontends.py b/src/authentic2/auth2_auth/auth2_ssl/authenticators.py
similarity index 95%
rename from src/authentic2/auth2_auth/auth2_ssl/frontends.py
rename to src/authentic2/auth2_auth/auth2_ssl/authenticators.py
index cc1b094d..5332b93b 100644
--- a/src/authentic2/auth2_auth/auth2_ssl/frontends.py
+++ b/src/authentic2/auth2_auth/auth2_ssl/authenticators.py
@@ -5,7 +5,7 @@ from . import views, app_settings
 from authentic2.utils import redirect_to_login
 
 
-class SSLFrontend(object):
+class SSLAuthenticator(object):
     def enabled(self):
         return app_settings.ENABLE
 
diff --git a/src/authentic2/auth_frontends.py b/src/authentic2/authenticators.py
similarity index 97%
rename from src/authentic2/auth_frontends.py
rename to src/authentic2/authenticators.py
index 0a66e57d..0944d7b6 100644
--- a/src/authentic2/auth_frontends.py
+++ b/src/authentic2/authenticators.py
@@ -4,7 +4,7 @@ from django.utils.translation import ugettext as _, ugettext_lazy
 from . import views, app_settings, utils, constants, forms
 
 
-class LoginPasswordBackend(object):
+class LoginPasswordAuthenticator(object):
     submit_name = 'login-password-submit'
 
     def enabled(self):
diff --git a/src/authentic2/plugins.py b/src/authentic2/plugins.py
index 19c5fb66..1ae3b7fc 100644
--- a/src/authentic2/plugins.py
+++ b/src/authentic2/plugins.py
@@ -64,7 +64,7 @@ def register_plugins_urls(urlpatterns,
 
 def register_plugins_installed_apps(installed_apps, group_name=DEFAULT_GROUP_NAME):
     '''Call get_apps() on all plugins of group_name and add the returned
-       applications path to the installed_apps sequence. 
+       applications path to the installed_apps sequence.
 
        Applications already present are ignored.
     '''
@@ -104,16 +104,16 @@ def register_plugins_authentication_backends(authentication_backends,
                     authentication_backends.append(cls)
     return tuple(authentication_backends)
 
-def register_plugins_auth_frontends(auth_frontends=(),
+def register_plugins_authenticators(authenticators=(),
         group_name=DEFAULT_GROUP_NAME):
-    auth_frontends = list(auth_frontends)
+    authenticators = list(authenticators)
     for plugin in get_plugins(group_name):
-        if hasattr(plugin, 'get_auth_frontends'):
-            cls = plugin.get_auth_frontends()
+        if hasattr(plugin, 'get_authenticators'):
+            cls = plugin.get_authenticators()
             for cls in cls:
-                if cls not in auth_frontends:
-                    auth_frontends.append(cls)
-    return tuple(auth_frontends)
+                if cls not in authenticators:
+                    authenticators.append(cls)
+    return tuple(authenticators)
 
 def register_plugins_idp_backends(idp_backends,
         group_name=DEFAULT_GROUP_NAME):
diff --git a/src/authentic2/settings.py b/src/authentic2/settings.py
index 15a443e2..4c133ccb 100644
--- a/src/authentic2/settings.py
+++ b/src/authentic2/settings.py
@@ -162,8 +162,8 @@ ACCOUNT_ACTIVATION_DAYS = 2
 # Authentication settings
 ###########################
 AUTH_USER_MODEL = 'custom_user.User'
-AUTH_FRONTENDS = plugins.register_plugins_auth_frontends((
-    'authentic2.auth_frontends.LoginPasswordBackend',))
+AUTH_FRONTENDS = plugins.register_plugins_authenticators((
+    'authentic2.authenticators.LoginPasswordAuthenticator',))
 
 ###########################
 # RBAC settings
diff --git a/src/authentic2_auth_oidc/__init__.py b/src/authentic2_auth_oidc/__init__.py
index cfafe280..ae18320d 100644
--- a/src/authentic2_auth_oidc/__init__.py
+++ b/src/authentic2_auth_oidc/__init__.py
@@ -17,8 +17,8 @@ class Plugin(object):
     def get_authentication_backends(self):
         return ['authentic2_auth_oidc.backends.OIDCBackend']
 
-    def get_auth_frontends(self):
-        return ['authentic2_auth_oidc.auth_frontends.OIDCFrontend']
+    def get_authenticators(self):
+        return ['authentic2_auth_oidc.authenticators.OIDCAuthenticator']
 
     def redirect_logout_list(self, request, next=None):
         from .models import OIDCProvider
@@ -65,4 +65,3 @@ class Plugin(object):
                            provider.issuer, e, content)
             return
         logger.info(u'revoked token from OIDC provider %s', provider.issuer)
-
diff --git a/src/authentic2_auth_oidc/auth_frontends.py b/src/authentic2_auth_oidc/authenticators.py
similarity index 94%
rename from src/authentic2_auth_oidc/auth_frontends.py
rename to src/authentic2_auth_oidc/authenticators.py
index 3b47260d..4cac9a77 100644
--- a/src/authentic2_auth_oidc/auth_frontends.py
+++ b/src/authentic2_auth_oidc/authenticators.py
@@ -4,7 +4,7 @@ from django.shortcuts import render
 from . import app_settings, utils
 
 
-class OIDCFrontend(object):
+class OIDCAuthenticator(object):
     def enabled(self):
         return app_settings.ENABLE and utils.has_providers()
 
diff --git a/src/authentic2_auth_saml/__init__.py b/src/authentic2_auth_saml/__init__.py
index 5311a995..eeeee9f5 100644
--- a/src/authentic2_auth_saml/__init__.py
+++ b/src/authentic2_auth_saml/__init__.py
@@ -9,8 +9,8 @@ class Plugin(object):
     def get_authentication_backends(self):
         return ['authentic2_auth_saml.backends.SAMLBackend']
 
-    def get_auth_frontends(self):
-        return ['authentic2_auth_saml.auth_frontends.SAMLFrontend']
+    def get_authenticators(self):
+        return ['authentic2_auth_saml.authenticators.SAMLAuthenticator']
 
     def redirect_logout_list(self, request, next_url=None):
         from mellon.views import logout
diff --git a/src/authentic2_auth_saml/auth_frontends.py b/src/authentic2_auth_saml/authenticators.py
similarity index 97%
rename from src/authentic2_auth_saml/auth_frontends.py
rename to src/authentic2_auth_saml/authenticators.py
index 11ae6e0b..d1f1ffc4 100644
--- a/src/authentic2_auth_saml/auth_frontends.py
+++ b/src/authentic2_auth_saml/authenticators.py
@@ -8,7 +8,7 @@ from authentic2.utils import redirect_to_login
 from . import app_settings
 
 
-class SAMLFrontend(object):
+class SAMLAuthenticator(object):
     id = 'saml'
 
     def enabled(self):
-- 
2.20.1

