Metadata-Version: 2.4
Name: drf-pyseto
Version: 0.1.0
Summary: Django REST Framework authentication using PASETO (pyseto)
Author: Pravin
License: MIT
Keywords: django,drf,paseto,pyseto,auth
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=4.2
Requires-Dist: djangorestframework>=3.16
Requires-Dist: pyseto>=1.7
Provides-Extra: test
Requires-Dist: pytest>=7.4; extra == "test"
Requires-Dist: pytest-django>=4.7; extra == "test"
Requires-Dist: tox>=4.15; extra == "test"
Dynamic: license-file

# 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

```bash
pip install drf-pyseto
```

## Dev Install

```bash
pip install -e ".[test]"
```

## Settings

```python
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

```python
from django.urls import path, include

urlpatterns = [
    path("api/auth/", include("drf_pyseto.urls")),
]
```

## DRF Authentication

```python
REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": [
        "drf_pyseto.authentication.PASETOAuthentication",
    ]
}
```

## Endpoints

- `POST /token/` with `username` and `password`
- `POST /token/refresh/` with `refresh`

## Tests

```bash
pytest
```
