Django REST Framework authentication using PASETO (pyseto)
Project description
drf-pyseto
Simple PASETO (v4.local) authentication for Django REST Framework using pyseto.
Targeted for Django 4.2–6.x and Python 3.10–3.14.
Install
pip install drf-pyseto
Dev Install
pip install -e ".[test]"
Settings
DRF_PYSETO = {
"KEY": "<32-byte key or base64url>",
"ACCESS_LIFETIME": 300, # seconds
"REFRESH_LIFETIME": 86400, # seconds
"USER_ID_FIELD": "id",
"USER_ID_CLAIM": "user_id",
"TOKEN_TYPE_CLAIM": "typ",
"AUTH_HEADER_TYPE": "Bearer",
# Optional:
# "ISSUER": "your-service",
# "AUDIENCE": "your-clients",
}
URLs
from django.urls import path, include
urlpatterns = [
path("api/auth/", include("drf_pyseto.urls")),
]
DRF Authentication
REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": [
"drf_pyseto.authentication.PASETOAuthentication",
]
}
Endpoints
POST /token/withusernameandpasswordPOST /token/refresh/withrefresh
Tests
pytest
Project details
Release history Release notifications | RSS feed
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 drf_pyseto-0.1.0.tar.gz.
File metadata
- Download URL: drf_pyseto-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
489f9b36cd4ec187f76d147755de294c13e418fa85ea474ff60ff6cf9e88f0f5
|
|
| MD5 |
c3a773a69892df36f6786470d71ff3c9
|
|
| BLAKE2b-256 |
a52187845b059827c983c090f8302ef1f5efe53dd37e1a8bf8bd6563a00754c0
|
Provenance
The following attestation bundles were made for drf_pyseto-0.1.0.tar.gz:
Publisher:
release.yml on p-r-a-v-i-n/drf-pyseto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drf_pyseto-0.1.0.tar.gz -
Subject digest:
489f9b36cd4ec187f76d147755de294c13e418fa85ea474ff60ff6cf9e88f0f5 - Sigstore transparency entry: 1262278362
- Sigstore integration time:
-
Permalink:
p-r-a-v-i-n/drf-pyseto@d95ad8860dfdd51dd5e8f5ee9bbbcfa05d733c11 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/p-r-a-v-i-n
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d95ad8860dfdd51dd5e8f5ee9bbbcfa05d733c11 -
Trigger Event:
push
-
Statement type:
File details
Details for the file drf_pyseto-0.1.0-py3-none-any.whl.
File metadata
- Download URL: drf_pyseto-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57b632d1cec39c365895528ab5515ef66de523eee4992e5077c8cd5e791aa045
|
|
| MD5 |
5a078601458f0e6c6395848fbf6e8e6a
|
|
| BLAKE2b-256 |
57c429933ade4abe3eac73cfb1cd98437c00dc0e09ed9554ac9af5ca252a8873
|
Provenance
The following attestation bundles were made for drf_pyseto-0.1.0-py3-none-any.whl:
Publisher:
release.yml on p-r-a-v-i-n/drf-pyseto
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drf_pyseto-0.1.0-py3-none-any.whl -
Subject digest:
57b632d1cec39c365895528ab5515ef66de523eee4992e5077c8cd5e791aa045 - Sigstore transparency entry: 1262278371
- Sigstore integration time:
-
Permalink:
p-r-a-v-i-n/drf-pyseto@d95ad8860dfdd51dd5e8f5ee9bbbcfa05d733c11 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/p-r-a-v-i-n
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d95ad8860dfdd51dd5e8f5ee9bbbcfa05d733c11 -
Trigger Event:
push
-
Statement type: