Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
Project description
django-light-auth
Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
Install
pip3 install -U django-light-auth
Usage
Basic Usage
settings.py
INSTALLED_APPS = [
# ...
# 'django.contrib.auth',
'django_light_auth.apps.DjangoLightAuthConfig',
# ...
]
MIDDLEWARE = [
# ...
'django.contrib.sessions.middleware.SessionMiddleware',
# 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django_light_auth.LightAuthMiddleware'
# ...
]
# Session
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
# django-light-auth
LIGHT_AUTH_VALIDATE_FUNC = 'your_app.auth.validate_func'
urls.py
from django.urls import path
from django_light_auth import LoginView, LogoutView
urlpatterns = [
# ...
path('login', LoginView.as_view(), name='login'),
path('logout', LogoutView.as_view(), name='logout'),
]
your_app/auth/validate_func.py
#
# example at django_light_auth.light_auth_validate_func
#
from typing import Dict, Any
from your_app.config import config
def light_auth_validate_func(data: Dict[str, Any]) -> bool:
if data.get('username', None) == config.Auth.username and data.get(
'password', None
) == config.Auth.password:
return True
return False
Custom Login View
your_login_view.py
from django_light_auth import LoginView as LoginViewAbs
class LoginView(LoginViewAbs):
template_name = 'your_app/login.html'
History
0.2.3 - 20251112
- Maintenance release
v0.2.2 - 20220809
- Compatible Django 4.1+
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_light_auth-0.2.3.tar.gz.
File metadata
- Download URL: django_light_auth-0.2.3.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55e516ce84aef4e895814189397a36bba8c516c9bd3b813b1bb0dac7e6ee2847
|
|
| MD5 |
ba98d452e6f0debb82b192579fdfc74f
|
|
| BLAKE2b-256 |
617769969f92f47fd78a69c0d4137760bac2d0805ef7080806654f65c5750325
|
Provenance
The following attestation bundles were made for django_light_auth-0.2.3.tar.gz:
Publisher:
release-pypi.yaml on rexzhang/django-light-auth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_light_auth-0.2.3.tar.gz -
Subject digest:
55e516ce84aef4e895814189397a36bba8c516c9bd3b813b1bb0dac7e6ee2847 - Sigstore transparency entry: 696019016
- Sigstore integration time:
-
Permalink:
rexzhang/django-light-auth@524a134bf5907ac05f8b3959439f28af636854a2 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/rexzhang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yaml@524a134bf5907ac05f8b3959439f28af636854a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_light_auth-0.2.3-py3-none-any.whl.
File metadata
- Download URL: django_light_auth-0.2.3-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a2e06575fbf6bcbbe600cf211cf14929748c0f7fdf7d44e997b9d5e271c94d8
|
|
| MD5 |
039ff4d01887bb29d2b922c62b25f6f4
|
|
| BLAKE2b-256 |
e766556990ed508ff834c1a7ac88dfa56cd7121bd4cc15786b65a6e8bc193d54
|
Provenance
The following attestation bundles were made for django_light_auth-0.2.3-py3-none-any.whl:
Publisher:
release-pypi.yaml on rexzhang/django-light-auth
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_light_auth-0.2.3-py3-none-any.whl -
Subject digest:
2a2e06575fbf6bcbbe600cf211cf14929748c0f7fdf7d44e997b9d5e271c94d8 - Sigstore transparency entry: 696019019
- Sigstore integration time:
-
Permalink:
rexzhang/django-light-auth@524a134bf5907ac05f8b3959439f28af636854a2 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/rexzhang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yaml@524a134bf5907ac05f8b3959439f28af636854a2 -
Trigger Event:
push
-
Statement type: