mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #784 from YunoHost/simpler-ldap-conf
Propagate change on LDAP conf / authenticator
This commit is contained in:
commit
c12017418a
1 changed files with 11 additions and 7 deletions
|
@ -20,7 +20,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
from moulinette.core import init_authenticator
|
from moulinette.authenticators import ldap
|
||||||
|
|
||||||
# We use a global variable to do some caching
|
# We use a global variable to do some caching
|
||||||
# to avoid re-authenticating in case we call _get_ldap_authenticator multiple times
|
# to avoid re-authenticating in case we call _get_ldap_authenticator multiple times
|
||||||
|
@ -31,12 +31,16 @@ def _get_ldap_interface():
|
||||||
global _ldap_interface
|
global _ldap_interface
|
||||||
|
|
||||||
if _ldap_interface is None:
|
if _ldap_interface is None:
|
||||||
# Instantiate LDAP Authenticator
|
|
||||||
AUTH_IDENTIFIER = ('ldap', 'as-root')
|
conf = { "vendor": "ldap",
|
||||||
AUTH_PARAMETERS = {'uri': 'ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi',
|
"name": "as-root",
|
||||||
'base_dn': 'dc=yunohost,dc=org',
|
"parameters": { 'uri': 'ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi',
|
||||||
'user_rdn': 'gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth'}
|
'base_dn': 'dc=yunohost,dc=org',
|
||||||
_ldap_interface = init_authenticator(AUTH_IDENTIFIER, AUTH_PARAMETERS)
|
'user_rdn': 'gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth' },
|
||||||
|
"extra": {}
|
||||||
|
}
|
||||||
|
|
||||||
|
_ldap_interface = ldap.Authenticator(**conf)
|
||||||
|
|
||||||
return _ldap_interface
|
return _ldap_interface
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue