Skip to main content

Django-adtools

Django-adtools is a package with a set of utilities for integrating web applications based on the django framework with MS ActiveDirectory.

All documentation is in the “docs/build” directory and online at http://django-adtools.readthedocs.org

Short example of using Active Directory authentication system

# views.py
from django_adtools.ad.ad_tools import ad_login, ad_clear_username

def post(self, request):
    form = LoginForm(request.POST)
    if form.is_valid():
        if ad_login(  # checking, if user is able to login using Active Directory credentials
            dc=DomainController.get(),  # A hostname or an ip address of a Domain Controller
            username=form.cleaned_data['username'],
            password=form.cleaned_data['password'],
            domain=settings.ADTOOLS_DOMAIN,  # A name of domain, e.g. domain.com
            group=settings.ADTOOLS_GROUP,  # A group name of valid users
        ):
            # get full domain username like user@domain.ru
            username_without_domain = ad_clear_username(form.cleaned_data['username'])
            username = f"{username_without_domain}@{settings.ADTOOLS_DOMAIN}"
            try:
                # looking for existing user profile (case insensitive)
                user = User.objects.get(username__iexact=username)
            except User.DoesNotExist:
                # create a new user profile, if it does not exist
                user = User(username=username)
                user.save()
            login(request=request, user=user)
            return redirect(reverse(f'{__package__}:index'))
    context = {'package': __package__, 'form': form, 'login_failed': True, }
    return render(request, f"{__package__}/login.html", context)

Metadata

Release files for django-adtools 1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-adtools 1.7
File Size Uploaded Provenance Actions
django-adtools-1.7.tar.gz 10.9 kB Without provenance Details for django-adtools-1.7.tar.gz

Release files / django-adtools-1.7.tar.gz

Download URL django-adtools-1.7.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7c0100740c8fb1d93ab138338739314fd03c70f49f2a1fb3bc8b5bf01152fe07
BLAKE2b-256 checksum
How to use checksums
6723347bc1b3c333320cd76797803dcaefeaae182b34da5fe1faf8990e8cf54c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Security for django-adtools 1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page