##// END OF EJS Templates
authn: Import legacy authentication modules and invoke their includeme.
johbo -
r130:8bc9b961 default
parent child Browse files
Show More
@@ -19,6 +19,7 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import logging
22 import importlib
22 23
23 24 from pkg_resources import iter_entry_points
24 25 from pyramid.authentication import SessionAuthenticationPolicy
@@ -56,9 +57,21 b' def _discover_legacy_plugins(config, pre'
56 57 enabled_plugins = auth_plugins.app_settings_value
57 58 legacy_plugins = [id_ for id_ in enabled_plugins if id_.startswith(prefix)]
58 59
59 log.debug('Trying to load these legacy authentication plugins {}'.format(
60 log.debug('Importing these legacy authentication plugins {}'.format(
60 61 legacy_plugins))
61 62
63 for plugin_id in legacy_plugins:
64 module_name = plugin_id.split(prefix, 1)[-1]
65 try:
66 log.debug('Import %s', module_name)
67 module = importlib.import_module(module_name)
68 plugin = module.plugin_factory(plugin_id=plugin_id)
69 config.include(plugin.includeme)
70 except ImportError as e:
71 log.error(
72 'Error while importing legacy authentication plugin '
73 '"{}": {}'.format(plugin_id, e.message))
74
62 75
63 76 def includeme(config):
64 77 # Set authentication policy.
General Comments 0
You need to be logged in to leave comments. Login now