Skip to main content

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 configured user_claim)
  • X-Auth-Role: The role or roles from the token (from the configured role_claim)
  • X-Auth-Claim-{name}: Additional claims specified in forward_claims

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

auth_proxy_jwt-0.2.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auth_proxy_jwt-0.2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file auth_proxy_jwt-0.2.0.tar.gz.

File metadata

  • Download URL: auth_proxy_jwt-0.2.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for auth_proxy_jwt-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0d80bf04c8672fb5891e3b52384c65221ec38257e78fca8370cbd6a431828f4a
MD5 f718f1c9127fae55d8de31b7401a1734
BLAKE2b-256 8d2f2b0cdcbd8684b1e66c72a10702dc956dd0b18842625b958c4b18761d4817

See more details on using hashes here.

File details

Details for the file auth_proxy_jwt-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: auth_proxy_jwt-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for auth_proxy_jwt-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fdb06b00f3df4b1477eb217e112b4c273fee3caf643e749d69afc25444f6f3a
MD5 5ca76988a19244a7248872731fd6748e
BLAKE2b-256 5823ac7c2030d5b896e08c02c0bbc95fbdf88b6dd4d213c5fe368f8516917772

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page