跳至正文
Wener Notes

Traefik Forward Auth

约 1 分钟阅读
标签:服务认证授权TraefikOIDC

- Minimal forward authentication service that provides Google/OpenID oauth authentication for Traefik.

Docker Compose Example

bash
version: "3.8"
services:
forward-auth:
image: thomseddon/traefik-forward-auth:2
container_name: traefik-forward-auth
restart: always
environment:
- PROVIDERS_OIDC_CLIENT_ID=traefik-forward-auth
- PROVIDERS_OIDC_CLIENT_SECRET=your_client_secret
- PROVIDERS_OIDC_ISSUER_URL=https://id.example.com/auth/realms/master
- LOG_LEVEL=debug
- DEFAULT_PROVIDER=oidc
- SECRET=your_random_secret
- COOKIE_DOMAIN=example.com
- INSECURE_COOKIE=false

Traefik Configuration labels

yaml
labels:
  - 'traefik.enable=true'
  - 'traefik.http.routers.auth.rule=Host(`auth.example.com`)'
  - 'traefik.http.routers.auth.entrypoints=websecure'
  - 'traefik.http.services.auth.loadbalancer.server.port=4181'
  - 'traefik.http.middlewares.forward-auth.forwardauth.address=http://auth.example.com:4181'
  - 'traefik.http.middlewares.forward-auth.forwardauth.authResponseHeaders=X-Forwarded-User'
  - 'traefik.http.middlewares.forward-auth.forwardauth.trustForwardHeader=true'

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

GitHub1 条
最近更新commit 906e816编辑