JWT authentication plugin for python-auth-proxy
Project description
JWT Authentication Plugin for auth-proxy
A JWT (JSON Web Token) authentication plugin for the Modular Authenticating Reverse Proxy.
Installation
pip install auth-proxy-jwt
Features
- Validates JWT tokens from the Authorization header
- Configurable secret key and algorithm
- Optional audience and issuer validation
- Customizable claims mapping
- Forwards user identity and role information to backend services
Configuration
Add the JWT plugin to your auth-proxy configuration:
auth_plugins:
jwt:
secret: "your-secret-key"
algorithm: "HS256"
audience: "your-api"
issuer: "your-identity-provider"
require_exp: true
leeway: 10
header_prefix: "Bearer"
user_claim: "sub"
role_claim: "roles"
forward_claims: ["email", "permissions"]
paths:
- path: "^/api/.*$"
regex: true
authenticate: true
plugins: [jwt]
Configuration Options
| Option | Description | Default |
|---|---|---|
secret |
Secret key for validating token signatures | (required) |
algorithm |
JWT algorithm to use | "HS256" |
audience |
Expected audience claim | null |
issuer |
Expected issuer claim | null |
require_exp |
Whether to require expiration time | true |
leeway |
Leeway in seconds for expiration time | 0 |
header_prefix |
Authorization header prefix | "Bearer" |
user_claim |
Claim to use for user identity | "sub" |
role_claim |
Claim to use for role information | "role" |
forward_claims |
Additional claims to forward as headers | [] |
Headers Added to Backend Requests
When authentication succeeds, the plugin adds the following headers to the proxied request:
X-Auth-User: The user identity from the token (from the configureduser_claim)X-Auth-Role: The role or roles from the token (from the configuredrole_claim)X-Auth-Claim-{name}: Additional claims specified inforward_claims
License
This project is licensed under the MIT License - see the LICENSE file for details.
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 auth_proxy_jwt-0.1.0.tar.gz.
File metadata
- Download URL: auth_proxy_jwt-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a04f4273bbb9c1041146b1a53b7b0bb2c4e846a70b4a7483deeca405c11828e8
|
|
| MD5 |
3a65abf2a89966149c398c54f0129c6c
|
|
| BLAKE2b-256 |
bbc7d5cd081d505e26c7ce4611c20403dc94b67c82f0f0ee5befc0f242b9af15
|
File details
Details for the file auth_proxy_jwt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: auth_proxy_jwt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64353f11681c356d173687e49a74531fd73741e26d6ed1878a679f0f1e59cccf
|
|
| MD5 |
9f73b045064ca2da3cdd57f00bd66240
|
|
| BLAKE2b-256 |
6aa660d95aa2c4569e90500302803f043ab6cdd18fee9e0eb7c28dbbca3cef0d
|