Show More
@@ -37,6 +37,7 b' log = logging.getLogger(__name__)' | |||
|
37 | 37 | # Plugin ID prefixes to distinct between normal and legacy plugins. |
|
38 | 38 | plugin_prefix = 'egg:' |
|
39 | 39 | legacy_plugin_prefix = 'py:' |
|
40 | plugin_default_auth_ttl = 30 | |
|
40 | 41 | |
|
41 | 42 | |
|
42 | 43 | # TODO: Currently this is only used to discover the authentication plugins. |
@@ -439,7 +439,11 b' class RhodeCodeAuthPluginBase(object):' | |||
|
439 | 439 | |
|
440 | 440 | def get_ttl_cache(self, settings=None): |
|
441 | 441 | plugin_settings = settings or self.get_settings() |
|
442 | cache_ttl = 0 | |
|
442 | # we set default to 30, we make a compromise here, | |
|
443 | # performance > security, mostly due to LDAP/SVN, majority | |
|
444 | # of users pick cache_ttl to be enabled | |
|
445 | from rhodecode.authentication import plugin_default_auth_ttl | |
|
446 | cache_ttl = plugin_default_auth_ttl | |
|
443 | 447 | |
|
444 | 448 | if isinstance(self.AUTH_CACHE_TTL, (int, long)): |
|
445 | 449 | # plugin cache set inside is more important than the settings value |
@@ -20,6 +20,7 b'' | |||
|
20 | 20 | |
|
21 | 21 | import colander |
|
22 | 22 | |
|
23 | from rhodecode.authentication import plugin_default_auth_ttl | |
|
23 | 24 | from rhodecode.translation import _ |
|
24 | 25 | |
|
25 | 26 | |
@@ -39,7 +40,7 b' class AuthnPluginSettingsSchemaBase(cola' | |||
|
39 | 40 | ) |
|
40 | 41 | cache_ttl = colander.SchemaNode( |
|
41 | 42 | colander.Int(), |
|
42 | default=0, | |
|
43 | default=plugin_default_auth_ttl, | |
|
43 | 44 | description=_('Amount of seconds to cache the authentication and ' |
|
44 | 45 | 'permissions check response call for this plugin. \n' |
|
45 | 46 | 'Useful for expensive calls like LDAP to improve the ' |
@@ -30,10 +30,7 b' class EnabledAuthPlugin(object):' | |||
|
30 | 30 | """ |
|
31 | 31 | |
|
32 | 32 | def __init__(self, plugin): |
|
33 | self.new_value = set([ | |
|
34 | 'egg:rhodecode-enterprise-ce#rhodecode', | |
|
35 | plugin.get_id() | |
|
36 | ]) | |
|
33 | self.new_value = {'egg:rhodecode-enterprise-ce#rhodecode', plugin.get_id()} | |
|
37 | 34 | |
|
38 | 35 | def __enter__(self): |
|
39 | 36 | from rhodecode.model.settings import SettingsModel |
@@ -47,7 +44,7 b' class EnabledAuthPlugin(object):' | |||
|
47 | 44 | 'auth_plugins', ','.join(self._old_value)) |
|
48 | 45 | |
|
49 | 46 | |
|
50 | class DisabledAuthPlugin(): | |
|
47 | class DisabledAuthPlugin(object): | |
|
51 | 48 | """ |
|
52 | 49 | Context manager that updates the 'auth_plugins' setting in DB to disable |
|
53 | 50 | a plugin. Previous setting is restored on exit. |
@@ -18,12 +18,10 b'' | |||
|
18 | 18 | # RhodeCode Enterprise Edition, including its added features, Support services, |
|
19 | 19 | # and proprietary license terms, please see https://rhodecode.com/licenses/ |
|
20 | 20 | |
|
21 | ||
|
22 | 21 | import os |
|
23 | 22 | import logging |
|
24 | 23 | import rhodecode |
|
25 | 24 | |
|
26 | ||
|
27 | 25 | from rhodecode.config import utils |
|
28 | 26 | |
|
29 | 27 | from rhodecode.lib.utils import load_rcextensions |
@@ -52,6 +50,8 b' def load_pyramid_environment(global_conf' | |||
|
52 | 50 | if settings['is_test']: |
|
53 | 51 | rhodecode.is_test = True |
|
54 | 52 | rhodecode.disable_error_handler = True |
|
53 | from rhodecode import authentication | |
|
54 | authentication.plugin_default_auth_ttl = 0 | |
|
55 | 55 | |
|
56 | 56 | utils.initialize_test_environment(settings_merged) |
|
57 | 57 |
General Comments 0
You need to be logged in to leave comments.
Login now