Repository navigation
docs: Make doc and code consistent - #72
Conversation
Signed-off-by: Hai Huang <[email protected]>
43aaa02 to
de6f409
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the AuthProxy README to reposition the documentation focus from JWT validation to token exchange functionality. The changes attempt to simplify the architecture description by presenting AuthProxy as a "token exchange sidecar" and repositioning main.go as an "example application."
Changes:
- Removed JWT validation terminology from the main description and flow diagrams
- Restructured the Components section to emphasize Envoy + Ext Proc as the core sidecar
- Repositioned main.go as an example application rather than a core component
- Simplified configuration documentation to focus on token exchange parameters
- Updated terminology throughout (e.g., "Standalone Quickstart" to "Quickstart")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # AuthProxy | ||
|
|
||
| AuthProxy is a **JWT validation and token exchange proxy** for Kubernetes workloads. It enables secure service-to-service communication by intercepting outgoing requests, validating tokens, and transparently exchanging them for tokens with the correct audience for downstream services. | ||
| AuthProxy is a **token exchange sidecar** for Kubernetes workloads. It enables secure service-to-service communication by intercepting outgoing requests and transparently exchanging tokens for ones with the correct audience for downstream services. |
There was a problem hiding this comment.
The updated description removes mention of "JWT validation" functionality, but the codebase still includes JWT validation logic in main.go (lines 71-122). The main.go file validates JWT tokens using JWKS, checks issuer, audience, and scope claims. Removing this from the description makes the documentation inconsistent with the actual implementation.
| ### The Solution | ||
|
|
||
| AuthProxy intercepts outgoing requests, validates the caller's token, and exchanges it for a new token with the correct audience: | ||
| AuthProxy intercepts outgoing requests and exchanges the token for a new one with the correct audience: |
There was a problem hiding this comment.
The updated solution description removes "validates the caller's token" but the actual implementation in main.go includes comprehensive JWT validation (signature, issuer, audience, scope). This creates a mismatch between the documentation and the actual behavior of the system.
| ┌─────────────┐ ┌──────────────────────────┐ ┌─────────────┐ | ||
| │ Caller │ ── Token A ──►│ AuthProxy │─ Token B ──► │ Target │ ✅ AUTHORIZED | ||
| │ │ │ 1. Validate token │ │ │ | ||
| │ │ │ 1. Intercept request │ │ │ |
There was a problem hiding this comment.
The diagram step "1. Intercept request" replaces "1. Validate token" but this is misleading. Based on the main.go implementation, the system does validate tokens (JWT signature, issuer, and optionally audience) before performing token exchange. The updated text undersells the security features actually implemented in the code.
| │ │ │ 1. Intercept request │ │ │ | |
| │ │ │ 1. Validate & intercept │ │ │ |
|
|
||
| ``` | ||
| ┌─────────────────────────────────────────────────────────────────┐ | ||
| │ POD │ | ||
| │ ┌──────────────┐ ┌─────────────────────────────────────┐ │ | ||
| │ │ │ │ AuthProxy Sidecar │ │ | ||
| │ │ Application │ │ ┌───────────┐ ┌──────────────┐ │ │ | ||
| │ │ │───►│ │ Envoy │───►│ Ext Proc │ │ │ | ||
| │ │ │ │ │ :15123 │ │ :9090 │ │ │ | ||
| │ └──────────────┘ │ └───────────┘ └──────────────┘ │ │ | ||
| │ │ │ │ │ │ │ | ||
| │ │ │ ▼ ▼ │ │ | ||
| │ ┌──────┴───────┐ │ ┌───────────┐ ┌──────────────┐ │ │ | ||
| │ │ proxy-init │ │ │AuthProxy │ │ Keycloak │ │ │ | ||
| │ │ (iptables) │ │ │ :8080 │ │ (exchange) │ │ │ | ||
| │ └──────────────┘ │ └───────────┘ └──────────────┘ │ │ | ||
| │ └─────────────────────────────────────┘ │ | ||
| └─────────────────────────────────────────────────────────────────┘ | ||
| ``` | ||
| The `main.go` file in this directory is **not** a core component of AuthProxy. It is an **example application** that demonstrates how to use the AuthProxy sidecar. Any application can benefit from AuthProxy simply by being deployed alongside the sidecar—no code changes required. |
There was a problem hiding this comment.
The documentation now describes main.go as "not a core component" and just an "example application," but main.go contains the JWT validation proxy logic that runs on port 8080. This is a functional component, not just an example. The file includes production-grade JWT validation using JWKS, token caching, and proper error handling. Characterizing it as merely an example is misleading about the system's architecture.
Signed-off-by: Mariusz Sabath <[email protected]> Co-authored-by: Copilot <[email protected]>
|
@mrsabath all of these comments by co-pilot is due to not understanding that main.go is actually an example app, which is not supposed to be a part of the authproxy sidecar. |
This PR is to bring the doc and code consistent again.