July 2019
Beginner to intermediate
302 pages
9h 38m
English
To enable LDAP authentication for your application, follow these steps:
import ldapapp.config['LDAP_PROVIDER_URL'] = 'ldap://localhost'def get_ldap_connection(): conn = ldap.initialize(app.config['LDAP_PROVIDER_URL']) return conn
In the preceding code snippet, we imported ldap, then created an app configuration option that points to the LDAP server address. This is followed by the creation of a simple function, get_ldap_connection, which creates the LDAP connection object on the server and then returns that connection object.