Skip to main content

django-basic-auth-decorator

Basic auth decorator for Django.

Installation

You can install the package via pip:

pip install django-basic-auth-decorator

Usage

from django_basic_auth_decorator.decorators import basic_auth

# Define your allowed credentials
CREDENTIALS = [
    ("admin", "adminpass"),
    ("user", "userpass"),
]

# Apply the decorator on a view function
@basic_auth(CREDENTIALS)
def my_view(request):
    ...

# Use a different realm for each set of credentials, otherwise browsers
# reuse the cached credentials of one view on the other and prompt again
@basic_auth(OTHER_CREDENTIALS, realm="Internal Docs")
def other_view(request):
    ...

# Browsers forget basic auth credentials when they restart, set cookie_age
# (seconds) to remember a successful login in a signed cookie
@basic_auth(CREDENTIALS, cookie_age=30 * 24 * 60 * 60)
def remembered_view(request):
    ...

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for django-basic-auth-decorator 1.2.0

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-basic-auth-decorator 1.2.0
File Size Uploaded Provenance
django_basic_auth_decorator-1.2.0.tar.gz 3.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-basic-auth-decorator 1.2.0
File Interpreter ABI Platform
django_basic_auth_decorator-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / django_basic_auth_decorator-1.2.0.tar.gz

Download URL django_basic_auth_decorator-1.2.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f84e9797147e0a7a7ace127fe308676ba1c6ef38ac01793007f418c6831a5421
BLAKE2b-256 checksum
How to use checksums
a43af62284ab6a8d0a0abb3278195e00bd540f34f6fc008144580ff0d6f29642
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / django_basic_auth_decorator-1.2.0-py3-none-any.whl

Download URL django_basic_auth_decorator-1.2.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08c7b47e40f4d72e5ecc511c7c5a77735aa1e615c66bc75da6fcd31d1ede10bc
BLAKE2b-256 checksum
How to use checksums
25553991787440b9b7ea34dfbc42a9f697830644b1a87cdf89c4bc3cf150b858
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for django-basic-auth-decorator 1.2.0

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