File: auth.py

package info (click to toggle)
django-python3-ldap 0.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 164 kB
  • sloc: python: 590; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""
Django authentication backend.
"""

from django.contrib.auth.backends import ModelBackend

from django_python3_ldap import ldap


class LDAPBackend(ModelBackend):

    """
    An authentication backend that delegates to an LDAP
    server.

    User models authenticated with LDAP are created on
    the fly, and syncronised with the LDAP credentials.
    """

    supports_inactive_user = False

    def authenticate(self, *args, **kwargs):
        return ldap.authenticate(*args, **kwargs)