##// 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 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 46 Function that imports the legacy plugins stored in the 'auth_plugins'
47 47 setting in database which are using the specified prefix. Normally 'py:' is
@@ -97,15 +97,3 b' def includeme(config):'
97 97 request_method='POST',
98 98 route_name='auth_home',
99 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 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 75 def make_pyramid_app(global_config, **settings):
68 76 """
69 77 Constructs the WSGI application based on Pyramid.
@@ -233,6 +241,8 b' def includeme(config):'
233 241 if asbool(settings.get('appenlight', 'false')):
234 242 config.include('appenlight_client.ext.pyramid_tween')
235 243
244 load_all = should_load_all()
245
236 246 # Includes which are required. The application would fail without them.
237 247 config.include('pyramid_mako')
238 248 config.include('pyramid_beaker')
@@ -245,26 +255,42 b' def includeme(config):'
245 255 config.include('rhodecode.integrations')
246 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 272 # apps
249 273 config.include('rhodecode.apps._base')
250 config.include('rhodecode.apps.ops')
251 config.include('rhodecode.apps.admin')
252 config.include('rhodecode.apps.channelstream')
253 config.include('rhodecode.apps.login')
254 config.include('rhodecode.apps.home')
255 config.include('rhodecode.apps.journal')
256 config.include('rhodecode.apps.repository')
257 config.include('rhodecode.apps.repo_group')
258 config.include('rhodecode.apps.user_group')
259 config.include('rhodecode.apps.search')
260 config.include('rhodecode.apps.user_profile')
261 config.include('rhodecode.apps.user_group_profile')
262 config.include('rhodecode.apps.my_account')
263 config.include('rhodecode.apps.svn_support')
264 config.include('rhodecode.apps.ssh_support')
265 config.include('rhodecode.apps.gist')
266 config.include('rhodecode.apps.debug_style')
267 config.include('rhodecode.api')
274
275 if load_all:
276 config.include('rhodecode.apps.ops')
277 config.include('rhodecode.apps.admin')
278 config.include('rhodecode.apps.channelstream')
279 config.include('rhodecode.apps.login')
280 config.include('rhodecode.apps.home')
281 config.include('rhodecode.apps.journal')
282 config.include('rhodecode.apps.repository')
283 config.include('rhodecode.apps.repo_group')
284 config.include('rhodecode.apps.user_group')
285 config.include('rhodecode.apps.search')
286 config.include('rhodecode.apps.user_profile')
287 config.include('rhodecode.apps.user_group_profile')
288 config.include('rhodecode.apps.my_account')
289 config.include('rhodecode.apps.svn_support')
290 config.include('rhodecode.apps.ssh_support')
291 config.include('rhodecode.apps.gist')
292 config.include('rhodecode.apps.debug_style')
293 config.include('rhodecode.api')
268 294
269 295 config.add_route('rhodecode_support', 'https://rhodecode.com/help/', static=True)
270 296 config.add_translation_dirs('rhodecode:i18n/')
@@ -77,6 +77,8 b' class StubVCSController(simplevcs.Simple'
77 77 def vcscontroller(baseapp, config_stub, request_stub):
78 78 config_stub.testing_securitypolicy()
79 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 83 controller = StubVCSController(
82 84 baseapp.config.get_settings(), request_stub.registry)
@@ -193,6 +193,8 b' def test_ValidPasswordsMatch(localizer):'
193 193 def test_ValidAuth(localizer, config_stub):
194 194 config_stub.testing_securitypolicy()
195 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 199 validator = v.ValidAuth(localizer)
198 200 valid_creds = {
General Comments 0
You need to be logged in to leave comments. Login now