##// 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,8 +255,24 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')
274
275 if load_all:
250 276 config.include('rhodecode.apps.ops')
251 277 config.include('rhodecode.apps.admin')
252 278 config.include('rhodecode.apps.channelstream')
@@ -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