Skip to content

Instantly share code, notes, and snippets.

@ejoful
ejoful / auth.py
Created June 15, 2017 03:20 — forked from ibeex/auth.py
Python LDAP (ActiveDirectory) authentication
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%s@xxx.xx' % username