docs: add comprehensive OAuth2/OIDC integration guide - #866
Conversation
Covers issuer configuration, traffic policy integration, JWT claims to headers mapping, and denial of redirects for API/AJAX requests. Closes kgateway-dev#735, Closes kgateway-dev#739, Addresses kgateway-dev#730 Signed-off-by: ApurveKaranwal <apurvekaranwal282@gmail.com>
|
@kristin-kronstain-brown ma'am, @artberger sir, please review my PR and do let me know if i need to change anything. |
kristin-kronstain-brown
left a comment
There was a problem hiding this comment.
This PR is great for filling in some holes that we have and closes some issues. Just a few minor issues to still work through.
|
|
||
| ### 2. Create a GatewayExtension for OAuth2 | ||
|
|
||
| Create a `GatewayExtension` specifying your OIDC provider settings in the `spec.oauth2` block. The following example uses Keycloak as the Identity Provider: |
There was a problem hiding this comment.
This section references a keycloak Service in keycloak-system, a Gateway named http, and an HTTPRoute — none of which the guide creates, and the prereq snippet won't deploy an IdP. At minimum add a prerequisite line like: "This guide requires an OIDC IdP, such as Keycloak, deployed in-cluster and reachable, and an HTTPRoute for your app."
| name: keycloak | ||
| namespace: keycloak-system | ||
| port: 8080 | ||
| issuerURI: https://keycloak.example.com/realms/master |
There was a problem hiding this comment.
issuerURI vs backendRef mismatch will confuse readers. issuerURI: https://keycloak.example.com/... (public host) but backendRef points to in-cluster keycloak.keycloak-system:8080. That's valid (backendRef = network path, issuerURI = issuer identity), but it reads like a contradiction. One sentence explaining the distinction would help.
| sequenceDiagram | ||
| autonumber | ||
| participant Client as User Browser | ||
| participant AGW as Kgateway Proxy |
There was a problem hiding this comment.
Should this be Gateway rather than AGW?
| autonumber | ||
| participant Client as User Browser | ||
| participant AGW as Kgateway Proxy | ||
| participant IdP as Identity Provider (e.g. Keycloak) |
There was a problem hiding this comment.
Avoid e.g.. It's part of our style guidelines to write out something like "for example" or "such as" instead. It's in here a few more times.
Signed-off-by: ApurveKaranwal <apurvekaranwal282@gmail.com>
|
Thank you for the review, @kristin-kronstain-brown maam! I have addressed all the feedback and pushed the updates:
Let me know if there's anything else needed! |
|
@npolshakova ma'am, please check my PR and tell me if i need to fix anything. |
Signed-off-by: Kristin Brown <kristin.brown@solo.io> # Conflicts: # assets/kgw-docs/pages/security/oauth2-auth.md
Align the OAuth2/OIDC guide with the assets/docs -> assets/kgw-docs rename from main. Updates the shared page include path in the main, latest, and 2.2.x versioned pages. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Kristin Brown <kristin.brown@solo.io>
- Lowercase 'kgateway proxy' in the mermaid diagram participant label to match product style. - Expand the four advanced-config examples into complete, applyable GatewayExtension manifests (consistent with step 2) so they are copy-paste runnable and can be exercised by doc tests. Each re-applies the same-named resource to layer on the advanced field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Kristin Brown <kristin.brown@solo.io>
|
Thanks @ApurveKaranwal! I pushed a few updates directly to the branch to get it merge-ready:
Everything else is your work — nice, thorough guide. 🙌 |
|
thank you so much @kristin-kronstain-brown ma'am. |
* docs: add curl examples to OAuth2/OIDC guide Signed-off-by: MIKE-4-prog <uzukwuekene.michael@gmail.com> * docs: add OAuth2/OIDC authentication flow screenshots - Add 4 screenshots for OAuth2/OIDC authentication flow verification - Include dark mode support with reuse-image-dark shortcode - Use correct inline shortcode syntax matching ArgoCD pattern - Remove unsupported caption parameter to fix image rendering Signed-off-by: MIKE-4-prog <uzukwuekene.michael@gmail.com> * docs: address Nina's feedback for OAuth2/OIDC guide - Add screenshots with dark mode support - Replace curl examples with OAuth2 browser flow - Add Keycloak setup section (Helm and YAML) - Add client secret note and API reference link - Fix hostname consistency and expected outputs Signed-off-by: MIKE-4-prog <uzukwuekene.michael@gmail.com> --------- Signed-off-by: MIKE-4-prog <uzukwuekene.michael@gmail.com>
Description
This PR introduces a brand-new, comprehensive documentation guide for configuring and utilizing native OAuth2 and OpenID Connect (OIDC) authentication in
kgateway.Motivation
Developers need clear instruction and architecture guidance to delegate authentication to external Identity Providers (IdPs) like Keycloak, Auth0, or Okta. Previously, security documentation lacked a detailed guide for OIDC configurations, cookie customization, claim propagation, and endpoint exemptions.
What changed
kgatewayacting as the OAuth2 client.GatewayExtension(spec.oauth2), and enforcing policies viaTrafficPolicy.forwardAccessToken), custom cookie naming/domains (cookies), extracting JWT claims to upstream headers (jwt.idToken.claimsToHeaders), and preventing redirects for API/AJAX requests (denyRedirect).main,latest, and2.2.x.Related issues
Change Type
/kind documentation
Changelog