Add built-in `oidc` browser authentication to the Rust runtime. This PR introduces a self-contained `oidc` traffic policy for local config. The gateway can start the authorization code flow with PKCE, handle the callback itself, exchange the code for tokens, validate the returned ID token, and persist an encrypted browser session cookie. That gives users a built-in browser auth path without requiring an external `oauth2-proxy` sidecar. The feature is route-owned rather than globally dispatched. A route is protected by attaching `oidc` to it, and the route that matches the callback path is the route whose effective OIDC policy completes the flow and owns the resulting browser session. Listener-level OIDC config is lowered into route-phase policy attachments, but callback handling still happens through normal route selection rather than a separate callback registry or listener interception path. Provider setup supports the two expected local-config modes: - issuer-based discovery - fully explicit `authorizationEndpoint`, `tokenEndpoint`, and `jwks` configuration At the config boundary, local OIDC compilation owns discovery, JWKS loading, endpoint validation, and policy construction. The runtime OIDC surface is kept focused on browser-flow behavior: redirects, callback processing, token exchange, ID-token validation, and browser session handling. The stored post-login redirect target is sanitized when captured so callback completion only reflects local in-gateway destinations. This PR also: - wires `OIDC_COOKIE_SECRET` through core config/bootstrap - updates the generated schema and docs for the new policy - adds a local Keycloak-backed `examples/oidc` example - keeps `examples/oauth2-proxy` updated as the documented external sidecar alternative This is local-config only. Built-in logout, post-logout redirects, refresh or access token persistence, and xDS/controller-managed OIDC config remain out of scope for this first cut.
26 lines
764 B
YAML
26 lines
764 B
YAML
services:
|
|
keycloak:
|
|
container_name: oidc-keycloak
|
|
image: quay.io/keycloak/keycloak:26.3
|
|
command: ["start-dev", "--import-realm", "--http-port", "7080", "--https-port", "7443"]
|
|
environment:
|
|
KC_HOSTNAME: localhost
|
|
KC_HOSTNAME_PORT: 7080
|
|
KC_HOSTNAME_STRICT_BACKCHANNEL: "true"
|
|
KEYCLOAK_ADMIN: admin
|
|
KEYCLOAK_ADMIN_PASSWORD: admin
|
|
KC_HEALTH_ENABLED: "true"
|
|
KC_LOG_LEVEL: info
|
|
volumes:
|
|
- ./agentgateway-realm.json:/opt/keycloak/data/import/agentgateway-realm.json:ro
|
|
ports:
|
|
- "7080:7080"
|
|
- "7443:7443"
|
|
|
|
app:
|
|
container_name: oidc-upstream
|
|
image: hashicorp/http-echo:1.0.0
|
|
command: ["-listen=:5678", "-text=hello from the protected upstream app"]
|
|
ports:
|
|
- "18080:5678"
|