|
@@ -37,7 +37,7 @@ class LDAPAuth(Auth):
|
37
|
37
|
self._config['sa_auth'].authmetadata = LDAPApplicationAuthMetadata(self._config.get('sa_auth'))
|
38
|
38
|
|
39
|
39
|
def _get_ldap_auth(self):
|
40
|
|
- return LDAPSearchAuthenticatorPlugin(
|
|
40
|
+ auth_plug = LDAPSearchAuthenticatorPlugin(
|
41
|
41
|
url=self._config.get('ldap_url'),
|
42
|
42
|
base_dn=self._config.get('ldap_base_dn'),
|
43
|
43
|
bind_dn=self._config.get('ldap_bind_dn'),
|
|
@@ -47,6 +47,8 @@ class LDAPAuth(Auth):
|
47
|
47
|
naming_attribute=self._config.get('ldap_naming_attribute'),
|
48
|
48
|
start_tls=ini_conf_to_bool(self._config.get('ldap_tls', False)),
|
49
|
49
|
)
|
|
50
|
+ auth_plug.set_auth(self)
|
|
51
|
+ return auth_plug
|
50
|
52
|
|
51
|
53
|
def _get_ldap_user_provider(self):
|
52
|
54
|
return LDAPAttributesPlugin(
|
|
@@ -74,6 +76,14 @@ class LDAPAuth(Auth):
|
74
|
76
|
|
75
|
77
|
class LDAPSearchAuthenticatorPlugin(BaseLDAPSearchAuthenticatorPlugin):
|
76
|
78
|
|
|
79
|
+ def __init__(self, *args, **kwargs):
|
|
80
|
+ super().__init__(*args, **kwargs)
|
|
81
|
+ self._auth = None
|
|
82
|
+ self._user_api = UserApi(None)
|
|
83
|
+
|
|
84
|
+ def set_auth(self, auth):
|
|
85
|
+ self._auth = auth
|
|
86
|
+
|
77
|
87
|
def authenticate(self, environ, identity):
|
78
|
88
|
# Note: super().authenticate return None if already authenticated or not found
|
79
|
89
|
email = super().authenticate(environ, identity)
|