authentication: use registerd UID for plugin definition for more consistent loading of auth plugins.
This commit is contained in:
parent
4c48c95c23
commit
c258d66e7b
8 changed files with 17 additions and 8 deletions
|
|
@ -94,6 +94,9 @@ class LazyFormencode(object):
|
|||
|
||||
|
||||
class RhodeCodeAuthPluginBase(object):
|
||||
# UID is used to register plugin to the registry
|
||||
uid = None
|
||||
|
||||
# cache the authentication request for N amount of seconds. Some kind
|
||||
# of authentication methods are very heavy and it's very efficient to cache
|
||||
# the result of a call. If it's set to None (default) cache is off
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ class CrowdServer(object):
|
|||
|
||||
|
||||
class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
||||
uid = 'crowd'
|
||||
_settings_unsafe_keys = ['app_password']
|
||||
|
||||
def includeme(self, config):
|
||||
|
|
@ -290,5 +291,5 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
|||
|
||||
|
||||
def includeme(config):
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format('crowd')
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format(RhodeCodeAuthPlugin.uid)
|
||||
plugin_factory(plugin_id).includeme(config)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class HeadersSettingsSchema(AuthnPluginSettingsSchemaBase):
|
|||
|
||||
|
||||
class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
||||
|
||||
uid = 'headers'
|
||||
def includeme(self, config):
|
||||
config.add_authn_plugin(self)
|
||||
config.add_authn_resource(self.get_id(), HeadersAuthnResource(self))
|
||||
|
|
@ -226,5 +226,5 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
|||
|
||||
|
||||
def includeme(config):
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format('headers')
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format(RhodeCodeAuthPlugin.uid)
|
||||
plugin_factory(plugin_id).includeme(config)
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ class JasigCasSettingsSchema(AuthnPluginSettingsSchemaBase):
|
|||
|
||||
|
||||
class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
||||
uid = 'jasig_cas'
|
||||
|
||||
def includeme(self, config):
|
||||
config.add_authn_plugin(self)
|
||||
|
|
@ -168,5 +169,5 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
|||
|
||||
|
||||
def includeme(config):
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format('jasig_cas')
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format(RhodeCodeAuthPlugin.uid)
|
||||
plugin_factory(plugin_id).includeme(config)
|
||||
|
|
|
|||
|
|
@ -379,6 +379,7 @@ class LdapSettingsSchema(AuthnPluginSettingsSchemaBase):
|
|||
|
||||
|
||||
class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
||||
uid = 'ldap'
|
||||
# used to define dynamic binding in the
|
||||
DYNAMIC_BIND_VAR = '$login'
|
||||
_settings_unsafe_keys = ['dn_pass']
|
||||
|
|
@ -529,5 +530,5 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
|||
|
||||
|
||||
def includeme(config):
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format('ldap')
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format(RhodeCodeAuthPlugin.uid)
|
||||
plugin_factory(plugin_id).includeme(config)
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ class PamSettingsSchema(AuthnPluginSettingsSchemaBase):
|
|||
|
||||
|
||||
class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
||||
uid = 'pam'
|
||||
# PAM authentication can be slow. Repository operations involve a lot of
|
||||
# auth calls. Little caching helps speedup push/pull operations significantly
|
||||
AUTH_CACHE_TTL = 4
|
||||
|
|
@ -166,5 +167,5 @@ class RhodeCodeAuthPlugin(RhodeCodeExternalAuthPlugin):
|
|||
|
||||
|
||||
def includeme(config):
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format('pam')
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format(RhodeCodeAuthPlugin.uid)
|
||||
plugin_factory(plugin_id).includeme(config)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class RhodecodeAuthnResource(AuthnPluginResourceBase):
|
|||
|
||||
|
||||
class RhodeCodeAuthPlugin(RhodeCodeAuthPluginBase):
|
||||
uid = 'rhodecode'
|
||||
|
||||
def includeme(self, config):
|
||||
config.add_authn_plugin(self)
|
||||
|
|
@ -144,5 +145,5 @@ class RhodeCodeAuthPlugin(RhodeCodeAuthPluginBase):
|
|||
|
||||
|
||||
def includeme(config):
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format('rhodecode')
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format(RhodeCodeAuthPlugin.uid)
|
||||
plugin_factory(plugin_id).includeme(config)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class RhodeCodeAuthPlugin(RhodeCodeAuthPluginBase):
|
|||
"""
|
||||
Enables usage of authentication tokens for vcs operations.
|
||||
"""
|
||||
uid = 'token'
|
||||
|
||||
def includeme(self, config):
|
||||
config.add_authn_plugin(self)
|
||||
|
|
@ -152,5 +153,5 @@ class RhodeCodeAuthPlugin(RhodeCodeAuthPluginBase):
|
|||
|
||||
|
||||
def includeme(config):
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format('token')
|
||||
plugin_id = 'egg:rhodecode-enterprise-ce#{}'.format(RhodeCodeAuthPlugin.uid)
|
||||
plugin_factory(plugin_id).includeme(config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue