mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
be able to mock ldap uri
This commit is contained in:
parent
32711aa034
commit
142081a934
1 changed files with 5 additions and 2 deletions
|
@ -43,7 +43,7 @@ class Authenticator(BaseAuthenticator):
|
||||||
"initialize authenticator '%s' with: uri='%s', "
|
"initialize authenticator '%s' with: uri='%s', "
|
||||||
"base_dn='%s', user_rdn='%s'",
|
"base_dn='%s', user_rdn='%s'",
|
||||||
name,
|
name,
|
||||||
self.uri,
|
self._get_uri(),
|
||||||
self.basedn,
|
self.basedn,
|
||||||
self.userdn,
|
self.userdn,
|
||||||
)
|
)
|
||||||
|
@ -68,7 +68,7 @@ class Authenticator(BaseAuthenticator):
|
||||||
def authenticate(self, password=None):
|
def authenticate(self, password=None):
|
||||||
try:
|
try:
|
||||||
con = ldap.ldapobject.ReconnectLDAPObject(
|
con = ldap.ldapobject.ReconnectLDAPObject(
|
||||||
self.uri, retry_max=10, retry_delay=0.5
|
self._get_uri(), retry_max=10, retry_delay=0.5
|
||||||
)
|
)
|
||||||
if self.userdn:
|
if self.userdn:
|
||||||
if "cn=external,cn=auth" in self.userdn:
|
if "cn=external,cn=auth" in self.userdn:
|
||||||
|
@ -301,6 +301,9 @@ class Authenticator(BaseAuthenticator):
|
||||||
return (attr, value)
|
return (attr, value)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def _get_uri(self):
|
||||||
|
return self.uri
|
||||||
|
|
||||||
def _encode_dict(self, _dict):
|
def _encode_dict(self, _dict):
|
||||||
return {k: self._encode_list(v) for k, v in _dict.items()}
|
return {k: self._encode_list(v) for k, v in _dict.items()}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue