##// END OF EJS Templates
app: disconect auth plugin loading from authentication registry....
marcink -
r3241:611f6ed0 default
parent child Browse files
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 _discover_legacy_plugins(config, prefix=legacy_plugin_prefix):
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,26 +255,42 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')
250 config.include('rhodecode.apps.ops')
274
251 config.include('rhodecode.apps.admin')
275 if load_all:
252 config.include('rhodecode.apps.channelstream')
276 config.include('rhodecode.apps.ops')
253 config.include('rhodecode.apps.login')
277 config.include('rhodecode.apps.admin')
254 config.include('rhodecode.apps.home')
278 config.include('rhodecode.apps.channelstream')
255 config.include('rhodecode.apps.journal')
279 config.include('rhodecode.apps.login')
256 config.include('rhodecode.apps.repository')
280 config.include('rhodecode.apps.home')
257 config.include('rhodecode.apps.repo_group')
281 config.include('rhodecode.apps.journal')
258 config.include('rhodecode.apps.user_group')
282 config.include('rhodecode.apps.repository')
259 config.include('rhodecode.apps.search')
283 config.include('rhodecode.apps.repo_group')
260 config.include('rhodecode.apps.user_profile')
284 config.include('rhodecode.apps.user_group')
261 config.include('rhodecode.apps.user_group_profile')
285 config.include('rhodecode.apps.search')
262 config.include('rhodecode.apps.my_account')
286 config.include('rhodecode.apps.user_profile')
263 config.include('rhodecode.apps.svn_support')
287 config.include('rhodecode.apps.user_group_profile')
264 config.include('rhodecode.apps.ssh_support')
288 config.include('rhodecode.apps.my_account')
265 config.include('rhodecode.apps.gist')
289 config.include('rhodecode.apps.svn_support')
266 config.include('rhodecode.apps.debug_style')
290 config.include('rhodecode.apps.ssh_support')
267 config.include('rhodecode.api')
291 config.include('rhodecode.apps.gist')
292 config.include('rhodecode.apps.debug_style')
293 config.include('rhodecode.api')
268
294
269 config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True)
295 config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True)
270 config.add_translation_dirs('rhodecode:i18n/')
296 config.add_translation_dirs('rhodecode:i18n/')
@@ -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