EAP Python Middleware
External Authentication Proxy (EAP) Middleware and Client SDK for Python.
Installation
pip install eap-middleware
Usage
from eap import EapEngine
# Automatically loads configuration from environment variables
engine = EapEngine.from_env()
# In a FastAPI/Starlette app:
app.add_middleware(engine.asgi_middleware())
Configuration (Environment Variables)
When initializing the engine with EapEngine.from_env(), EAP reads configuration directly from environment variables. Configure these variables in your host environment or .env file:
| Variable | Description | Default |
|---|---|---|
JWT_SECRET |
Cryptographic secret used to sign session cookies (HS256). |
Required |
ALLOWED_EMAILS |
Comma-separated whitelist of allowed user emails or domains (e.g. admin@gmail.com, @iiitkota.ac.in). |
Required |
GOOGLE_CLIENT_ID |
Client ID from your Google Cloud Console Credentials. | Required for Web OAuth |
GOOGLE_CLIENT_SECRET |
Client Secret from your Google Cloud Console Credentials. | Required for Web OAuth |
GOOGLE_REDIRECT_URL |
Redirect URI registered in your Google Console (e.g., http://localhost:8080/auth/callback). |
Required for Web OAuth |
TARGET_URL |
Set to "tunnel" to use localtunnel gateway, or backend service URL. |
None |
TUNNEL_TOKEN |
Secure token required to authenticate tunnel clients (if TARGET_URL=tunnel). |
None |
RATE_LIMIT_PER_SEC |
Requests per second limit for web users. | 3.0 |
RATE_BURST |
Max burst capacity for web users. | 5.0 |
S2S_RATE_LIMIT_PER_SEC |
Requests per second limit for Server-to-Server API clients. | 30.0 |
S2S_RATE_BURST |
Max burst capacity for Server-to-Server API clients. | 100.0 |
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
eap_middleware-1.0.0.tar.gz
(6.7 kB
view details)
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 eap_middleware-1.0.0.tar.gz.
File metadata
- Download URL: eap_middleware-1.0.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82afcb880546e92755953796364bed1f6537ff5699e3af896e233735193a354d
|
|
| MD5 |
33e46fa75067cf39cfaee8a296e195c0
|
|
| BLAKE2b-256 |
30445547940f35b216757de543cccdcdc7b87e6ed06d9a14ccfb11256eb53943
|
File details
Details for the file eap_middleware-1.0.0-py3-none-any.whl.
File metadata
- Download URL: eap_middleware-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c98aa52b232a3ef2b09d758fe8c97b5d4e4fc303b54976fcc50c30058f7e6fb8
|
|
| MD5 |
17f0b8dbf9bb0612974596f90558e3cb
|
|
| BLAKE2b-256 |
6630e8669edefd94342ce179704ddc9e95383b10b9b0f00824c96b466c6f6c8c
|