Skip to main content

Authentication

A Django app for multi-token authentication.

Installation

pip install authentication

Usage

Add authentication to your INSTALLED_APPS in your Django settings.

INSTALLED_APPS = [
   'authentication',
]

Custom User Validation

To add custom validation to the login process, follow these steps:

  1. Define the Custom Validation Function:

    Create a custom validation function in a module. This function should accept a user object and perform the necessary validation.

    # authentication/custom_validations.py
    from django.core.exceptions import PermissionDenied
    from django.utils.translation import gettext as _
    
    def custom_user_validation(user):
        if not user.is_active:
            raise PermissionDenied(_("User is not active."), 'inactive_user')
    
  2. Update the Settings:

    In your settings.py file, add the MORE_USER_VALIDATION setting and set it to the path of your custom validation function.

    # cha_auth/settings.py
    MORE_USER_VALIDATION = 'authentication.custom_validations.custom_user_validation'
    

By following these steps, you can add custom validation to the login process without modifying the URL configuration. Users can specify their custom validation function in the MORE_USER_VALIDATION setting, and it will be called during the login process.

Metadata

Release files for cha-authentication 0.8.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 cha-authentication 0.8.0
File Size Uploaded Provenance Actions
cha_authentication-0.8.0.tar.gz 14.1 kB Without provenance Details for cha_authentication-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cha-authentication 0.8.0
File Interpreter ABI Platform Actions
cha_authentication-0.8.0-py3-none-any.whl Python 3 none any Details for cha_authentication-0.8.0-py3-none-any.whl

Total release size: 30.5 kB

Release files / cha_authentication-0.8.0.tar.gz

Download URL cha_authentication-0.8.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
db3fa040ec7183c8a72212096d5f42eb226990823b25c1edf782bc78221005f0
BLAKE2b-256 checksum
How to use checksums
ba111802bf5a5fcd1a34b0cd41539c1ac81ce0491ae1a424b052c9cacc4a75a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release files / cha_authentication-0.8.0-py3-none-any.whl

Download URL cha_authentication-0.8.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
014de9b56d600b5d6959cb4fce24eba8033c99792fe037cf7e70914df1c0679b
BLAKE2b-256 checksum
How to use checksums
9478a4ce1eff7d52a9fa0bfa2e290f4e2572e0b75dee983e4b97c36ffc080d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Security for cha-authentication 0.8.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