Show More
@@ -19,6 +19,7 b'' | |||||
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |
20 |
|
20 | |||
21 | import logging |
|
21 | import logging | |
|
22 | import importlib | |||
22 |
|
23 | |||
23 | from pkg_resources import iter_entry_points |
|
24 | from pkg_resources import iter_entry_points | |
24 | from pyramid.authentication import SessionAuthenticationPolicy |
|
25 | from pyramid.authentication import SessionAuthenticationPolicy | |
@@ -56,9 +57,21 b' def _discover_legacy_plugins(config, pre' | |||||
56 | enabled_plugins = auth_plugins.app_settings_value |
|
57 | enabled_plugins = auth_plugins.app_settings_value | |
57 | legacy_plugins = [id_ for id_ in enabled_plugins if id_.startswith(prefix)] |
|
58 | legacy_plugins = [id_ for id_ in enabled_plugins if id_.startswith(prefix)] | |
58 |
|
59 | |||
59 |
log.debug(' |
|
60 | log.debug('Importing these legacy authentication plugins {}'.format( | |
60 | legacy_plugins)) |
|
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 | def includeme(config): |
|
76 | def includeme(config): | |
64 | # Set authentication policy. |
|
77 | # Set authentication policy. |
General Comments 0
You need to be logged in to leave comments.
Login now