Skip to content

feat: add proxy authentication middleware (Authentik, Authelia support)#143

Open
brian-olson wants to merge 1 commit intoEugeny:masterfrom
brian-olson:feat/proxy-auth-middleware
Open

feat: add proxy authentication middleware (Authentik, Authelia support)#143
brian-olson wants to merge 1 commit intoEugeny:masterfrom
brian-olson:feat/proxy-auth-middleware

Conversation

@brian-olson
Copy link
Contributor

Summary

Add ProxyAuthMiddleware for authenticating users via reverse proxy headers. This enables integration with self-hosted identity providers like Authentik, Authelia, and any ForwardAuth-compatible service.

When PROXY_AUTH_ENABLED=true, the middleware:

  • Trusts X-Auth-User-Email header from auth proxies
  • Auto-creates users by email (get-or-create pattern)
  • Logs users in automatically
  • Optionally reads X-Auth-User-Name and X-Auth-Tenant-Id headers

Configuration

environment:
  - PROXY_AUTH_ENABLED=true

The middleware expects these headers from the auth proxy:

Header Required Description
X-Auth-User-Email Yes User's email address
X-Auth-User-Name No Display name
X-Auth-Tenant-Id No Tenant identifier

Use Cases

  • Self-hosted SSO with Authentik or Authelia
  • Integration with existing OIDC/SAML identity providers via proxy
  • Air-gapped deployments without external OAuth
  • Local development with simulated auth

Fixes

Testing

Tested with ForwardAuth proxy setting headers:

curl -H "X-Auth-User-Email: test@example.com" http://localhost:9090/api/1/user
# Returns authenticated user data

Add ProxyAuthMiddleware for authenticating users via reverse proxy headers.
When PROXY_AUTH_ENABLED=true, the middleware:
- Trusts X-Auth-User-Email header from auth proxies (Authentik, Authelia, etc.)
- Auto-creates users by email (get-or-create pattern)
- Logs users in automatically
- Optionally reads X-Auth-User-Name and X-Auth-Tenant-Id headers

This enables integration with self-hosted identity providers and SSO solutions
that use ForwardAuth or similar patterns to pass authenticated user info via headers.

Fixes Eugeny#140, Eugeny#126, Eugeny#116
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant