##// END OF EJS Templates
authn: Fix ordering of authentication plugins.
johbo -
r103:a7d4bfcc default
parent child Browse files
Show More
@@ -25,6 +25,7 b' from zope.interface import implementer'
25
25
26 from rhodecode.authentication.interface import IAuthnPluginRegistry
26 from rhodecode.authentication.interface import IAuthnPluginRegistry
27 from rhodecode.lib.utils2 import safe_str
27 from rhodecode.lib.utils2 import safe_str
28 from rhodecode.model.settings import SettingsModel
28
29
29 log = logging.getLogger(__name__)
30 log = logging.getLogger(__name__)
30
31
@@ -65,14 +66,18 b' class AuthenticationPluginRegistry(objec'
65 `rhodecode.auth_plugin_fallback` is set to a plugin ID.
66 `rhodecode.auth_plugin_fallback` is set to a plugin ID.
66 """
67 """
67 plugins = []
68 plugins = []
68 for plugin in self.get_plugins():
69
69 if (self._fallback_plugin and
70 # Add all enabled and active plugins to the list. We iterate over the
70 plugin.get_id() == self._fallback_plugin):
71 # auth_plugins setting from DB beacuse it also represents the ordering.
71 log.warn(
72 enabled_plugins = SettingsModel().get_auth_plugins()
72 'Using fallback authentication plugin from INI file: "%s"',
73 for plugin_id in enabled_plugins:
73 plugin.get_id())
74 plugin = self.get_plugin(plugin_id)
75 if plugin is not None and plugin.is_active():
74 plugins.append(plugin)
76 plugins.append(plugin)
75 elif plugin.is_enabled() and plugin.is_active():
77
78 # Add the fallback plugin from ini file.
79 plugin = self.get_plugin(self._fallback_plugin)
80 if plugin is not None and plugin not in plugins:
76 plugins.append(plugin)
81 plugins.append(plugin)
77
82
78 return plugins
83 return plugins
General Comments 0
You need to be logged in to leave comments. Login now