Show More
@@ -41,7 +41,7 b' def _import_legacy_plugin(plugin_id):' | |||||
41 | return module.plugin_factory(plugin_id=plugin_id) |
|
41 | return module.plugin_factory(plugin_id=plugin_id) | |
42 |
|
42 | |||
43 |
|
43 | |||
44 |
def |
|
44 | def discover_legacy_plugins(config, prefix=legacy_plugin_prefix): | |
45 | """ |
|
45 | """ | |
46 | Function that imports the legacy plugins stored in the 'auth_plugins' |
|
46 | Function that imports the legacy plugins stored in the 'auth_plugins' | |
47 | setting in database which are using the specified prefix. Normally 'py:' is |
|
47 | setting in database which are using the specified prefix. Normally 'py:' is | |
@@ -97,15 +97,3 b' def includeme(config):' | |||||
97 | request_method='POST', |
|
97 | request_method='POST', | |
98 | route_name='auth_home', |
|
98 | route_name='auth_home', | |
99 | context=AuthnRootResource) |
|
99 | context=AuthnRootResource) | |
100 |
|
||||
101 | # load CE authentication plugins |
|
|||
102 | config.include('rhodecode.authentication.plugins.auth_crowd') |
|
|||
103 | config.include('rhodecode.authentication.plugins.auth_headers') |
|
|||
104 | config.include('rhodecode.authentication.plugins.auth_jasig_cas') |
|
|||
105 | config.include('rhodecode.authentication.plugins.auth_ldap') |
|
|||
106 | config.include('rhodecode.authentication.plugins.auth_pam') |
|
|||
107 | config.include('rhodecode.authentication.plugins.auth_rhodecode') |
|
|||
108 | config.include('rhodecode.authentication.plugins.auth_token') |
|
|||
109 |
|
||||
110 | # Auto discover authentication plugins and include their configuration. |
|
|||
111 | _discover_legacy_plugins(config) |
|
@@ -64,6 +64,14 b' def is_http_error(response):' | |||||
64 | return response.status_code > 499 |
|
64 | return response.status_code > 499 | |
65 |
|
65 | |||
66 |
|
66 | |||
|
67 | def should_load_all(): | |||
|
68 | """ | |||
|
69 | Returns if all application components should be loaded. In some cases it's | |||
|
70 | desired to skip apps loading for faster shell script execution | |||
|
71 | """ | |||
|
72 | return True | |||
|
73 | ||||
|
74 | ||||
67 | def make_pyramid_app(global_config, **settings): |
|
75 | def make_pyramid_app(global_config, **settings): | |
68 | """ |
|
76 | """ | |
69 | Constructs the WSGI application based on Pyramid. |
|
77 | Constructs the WSGI application based on Pyramid. | |
@@ -233,6 +241,8 b' def includeme(config):' | |||||
233 | if asbool(settings.get('appenlight', 'false')): |
|
241 | if asbool(settings.get('appenlight', 'false')): | |
234 | config.include('appenlight_client.ext.pyramid_tween') |
|
242 | config.include('appenlight_client.ext.pyramid_tween') | |
235 |
|
243 | |||
|
244 | load_all = should_load_all() | |||
|
245 | ||||
236 | # Includes which are required. The application would fail without them. |
|
246 | # Includes which are required. The application would fail without them. | |
237 | config.include('pyramid_mako') |
|
247 | config.include('pyramid_mako') | |
238 | config.include('pyramid_beaker') |
|
248 | config.include('pyramid_beaker') | |
@@ -245,8 +255,24 b' def includeme(config):' | |||||
245 | config.include('rhodecode.integrations') |
|
255 | config.include('rhodecode.integrations') | |
246 | config.include('rhodecode.authentication') |
|
256 | config.include('rhodecode.authentication') | |
247 |
|
257 | |||
|
258 | if load_all: | |||
|
259 | from rhodecode.authentication import discover_legacy_plugins | |||
|
260 | # load CE authentication plugins | |||
|
261 | config.include('rhodecode.authentication.plugins.auth_crowd') | |||
|
262 | config.include('rhodecode.authentication.plugins.auth_headers') | |||
|
263 | config.include('rhodecode.authentication.plugins.auth_jasig_cas') | |||
|
264 | config.include('rhodecode.authentication.plugins.auth_ldap') | |||
|
265 | config.include('rhodecode.authentication.plugins.auth_pam') | |||
|
266 | config.include('rhodecode.authentication.plugins.auth_rhodecode') | |||
|
267 | config.include('rhodecode.authentication.plugins.auth_token') | |||
|
268 | ||||
|
269 | # Auto discover authentication plugins and include their configuration. | |||
|
270 | discover_legacy_plugins(config) | |||
|
271 | ||||
248 | # apps |
|
272 | # apps | |
249 | config.include('rhodecode.apps._base') |
|
273 | config.include('rhodecode.apps._base') | |
|
274 | ||||
|
275 | if load_all: | |||
250 | config.include('rhodecode.apps.ops') |
|
276 | config.include('rhodecode.apps.ops') | |
251 | config.include('rhodecode.apps.admin') |
|
277 | config.include('rhodecode.apps.admin') | |
252 | config.include('rhodecode.apps.channelstream') |
|
278 | config.include('rhodecode.apps.channelstream') |
@@ -77,6 +77,8 b' class StubVCSController(simplevcs.Simple' | |||||
77 | def vcscontroller(baseapp, config_stub, request_stub): |
|
77 | def vcscontroller(baseapp, config_stub, request_stub): | |
78 | config_stub.testing_securitypolicy() |
|
78 | config_stub.testing_securitypolicy() | |
79 | config_stub.include('rhodecode.authentication') |
|
79 | config_stub.include('rhodecode.authentication') | |
|
80 | config_stub.include('rhodecode.authentication.plugins.auth_rhodecode') | |||
|
81 | config_stub.include('rhodecode.authentication.plugins.auth_token') | |||
80 |
|
82 | |||
81 | controller = StubVCSController( |
|
83 | controller = StubVCSController( | |
82 | baseapp.config.get_settings(), request_stub.registry) |
|
84 | baseapp.config.get_settings(), request_stub.registry) |
@@ -193,6 +193,8 b' def test_ValidPasswordsMatch(localizer):' | |||||
193 | def test_ValidAuth(localizer, config_stub): |
|
193 | def test_ValidAuth(localizer, config_stub): | |
194 | config_stub.testing_securitypolicy() |
|
194 | config_stub.testing_securitypolicy() | |
195 | config_stub.include('rhodecode.authentication') |
|
195 | config_stub.include('rhodecode.authentication') | |
|
196 | config_stub.include('rhodecode.authentication.plugins.auth_rhodecode') | |||
|
197 | config_stub.include('rhodecode.authentication.plugins.auth_token') | |||
196 |
|
198 | |||
197 | validator = v.ValidAuth(localizer) |
|
199 | validator = v.ValidAuth(localizer) | |
198 | valid_creds = { |
|
200 | valid_creds = { |
General Comments 0
You need to be logged in to leave comments.
Login now