apicrud.auth.ldap_func¶
ldap_func
created 4-may-2021 by richb@instantlinux.net
Functions
|
Initialize LDAP server pool |
|
Login using LDAP credentials. |
-
apicrud.auth.ldap_func.
ldap_init
(ldap_conn=None, ldap_mock=None)¶ Initialize LDAP server pool
- Parameters
ldap_conn (obj) – an open connection (for testing)
ldap_mock (obj) – a mock (also for testing)
-
apicrud.auth.ldap_func.
login
(username, password)¶ Login using LDAP credentials. If successful, this passes a sqlalchemy account record back for further processing by SessionAuth.login_accepted. The email identity is either looked up from the LDAP attributes (by default, the attr_identity is ‘mail’), or composed as <attr_name>@<email_domain>.
- Parameters
username (str) – the username or email identity
password (str) – password
- Returns
- 3 items
dict with error message http status (200 if OK) account (sqlalchemy query object)
- Return type
tuple