-
Notifications
You must be signed in to change notification settings - Fork 70
Howto Authentik proxy auth
This guide connects Authentik's embedded outpost (forward-auth provider) to Bindery's proxy auth mode. Users sign in at Authentik and land in Bindery without a second login prompt.
What you'll have at the end: Authentik's proxy provider protects the Bindery URL. On first visit, users are redirected to Authentik. After authentication, Authentik's outpost forwards X-Authentik-Username to Bindery; Bindery provisions the account and issues a session.
Prerequisites:
- Authentik v2023.x+ running and accessible
- Caddy (preferred) or Traefik as your reverse proxy
- Bindery reachable on your Docker/Kubernetes network
- Admin access to the Authentik UI
- In the Authentik admin UI, go to Applications → Providers → Create.
- Choose Proxy Provider.
- Fill in:
-
Name:
bindery -
Authorization flow: your default authorization flow (e.g.
default-provider-authorization-implicit-consent) -
Mode:
Forward auth (single application) -
External host:
https://bindery.example.com
-
Name:
- Click Finish.
Expected result: the provider appears in the list with type "Proxy".
- Go to Applications → Applications → Create.
- Fill in:
-
Name:
Bindery -
Slug:
bindery - Provider: select the provider created in step 1
-
Name:
- Click Create.
- Go to Applications → Outposts.
- Edit the authentik Embedded Outpost.
- Under Applications, add
Bindery. - Click Update.
Expected result: within ~30 seconds, the outpost picks up the new application. You can verify by checking System → Tasks — look for a recent outpost sync task.
bindery.example.com {
forward_auth authentik:9000 {
uri /outpost.goauthentik.io/auth/caddy
copy_headers X-Authentik-Username X-Authentik-Groups X-Authentik-Email X-Authentik-Name
# Trust only the outpost — do not copy X-Authentik-* from untrusted upstreams
}
reverse_proxy bindery:8787
}# In your Authentik outpost service or a separate middleware definition:
labels:
- traefik.http.middlewares.authentik.forwardauth.address=http://authentik:9000/outpost.goauthentik.io/auth/traefik
- traefik.http.middlewares.authentik.forwardauth.trustForwardHeader=true
- traefik.http.middlewares.authentik.forwardauth.authResponseHeaders=X-Authentik-Username,X-Authentik-Groups,X-Authentik-Email,X-Authentik-Name
# On the Bindery service:
- traefik.http.routers.bindery.middlewares=authentik@docker# Docker Compose or Helm values.yaml
environment:
BINDERY_TRUSTED_PROXY: "172.20.0.0/16" # Docker bridge or pod CIDR
BINDERY_PROXY_AUTH_HEADER: "X-Authentik-Username"
BINDERY_PROXY_AUTO_PROVISION: "true"Stability note:
X-Authentik-Usernamechanges if a user's username is renamed in Authentik. For production installs, configure a custom property mapping that exposes the user's UUID in a header (e.g.X-Authentik-UID) and use that instead. See docs/auth-proxy.md — Header choice.
Start Bindery and confirm the startup log shows:
trusted proxies: [172.20.0.0/16]
Then set auth mode to proxy:
- UI: Settings → General → Security → Authentication Mode → Proxy → Save
-
API:
curl -X PUT http://bindery:8787/api/v1/auth/mode \ -H "X-Api-Key: <your-api-key>" \ -H "Content-Type: application/json" \ -d '{"mode": "proxy"}'
Expected result: {"mode":"proxy"}. The login page shows "Sign in via your SSO provider".
- Open a private/incognito window and navigate to
https://bindery.example.com. - You are redirected to Authentik's login page — log in.
- After authentication, Authentik redirects back. Bindery reads
X-Authentik-Username, provisions your account, and shows the library. - Check Settings → Users — your username should appear as a new
user-role account.
Confirm via API:
curl -s -H "X-Api-Key: <admin-key>" http://bindery:8787/api/v1/auth/users | jq .In Authentik, edit the Policy/Group bindings on the Bindery application to restrict which groups can access it:
- Go to Applications → Applications → Bindery → Policy/Group bindings.
- Click Bind existing group and select the group(s) allowed to use Bindery.
Users outside those groups will be denied at Authentik before Bindery is even reached.
| What you see | Likely cause | Fix |
|---|---|---|
Bindery refuses to start: proxy mode requires BINDERY_TRUSTED_PROXY
|
Env var not set or empty | Add BINDERY_TRUSTED_PROXY matching the outpost/proxy container IP or CIDR |
After Authentik login, Bindery returns 401 Unauthorized
|
Outpost IP not in BINDERY_TRUSTED_PROXY
|
Check startup log for trusted proxies: [...]; widen CIDR to include the Authentik outpost pod/container |
After Authentik login, Bindery returns 401 Unauthorized
|
X-Authentik-Username header not forwarded |
Verify copy_headers (Caddy) or authResponseHeaders (Traefik) includes X-Authentik-Username. Enable BINDERY_LOG_LEVEL=debug to see which headers Bindery receives |
| Login page still shows password form | Auth mode not set to proxy
|
Confirm with GET /api/v1/auth/status; set mode via Settings or API |
Outpost returns 404 on /outpost.goauthentik.io/auth/caddy
|
Bindery not added to the outpost | Go to Authentik → Outposts → Embedded Outpost → add the Bindery application |
| OPDS client / API scripts return 401 | Client bypasses the outpost | Exempt /opds/* and /api/* from the outpost in Authentik's application policy, or configure the proxy to pass those paths through unauthenticated (Bindery's own X-Api-Key auth still applies) |
| New user created after Authentik username rename | Mutable X-Authentik-Username used as identifier |
Switch to a UUID-based header — see docs/auth-proxy.md; merge the orphaned account from Settings → Users |
For more, see Troubleshooting.
Getting started
Setup guides
How-to guides — proxy auth (v1.0)
How-to guides — OIDC (v1.0)
- Google Sign-In
- GitHub OAuth via Dex
- Authelia as OIDC provider
- Authentik
- Keycloak
- Rotate OIDC client secrets
- Recover from broken OIDC
How-to guides — multi-user (v1.0)
Reference
Contributing