Add support for External Authentication for HTTPRoutes#5145
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5145 +/- ##
==========================================
+ Coverage 85.76% 85.83% +0.06%
==========================================
Files 150 150
Lines 20601 20815 +214
Branches 35 35
==========================================
+ Hits 17669 17866 +197
- Misses 2578 2590 +12
- Partials 354 359 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds initial support for Gateway API HTTPRoute HTTPExternalAuthFilter by plumbing the filter through graph/state resolution into the dataplane model and NGINX config generation, plus adding tests and examples.
Changes:
- Add
ExternalAuthfilter parsing/validation and route backend-ref tracking for HTTPRoutes. - Convert resolved ExternalAuth config into dataplane types and render NGINX
auth_requestplus internal auth subrequest locations. - Add unit/integration-style tests and an
examples/external-authenticationmanifest set.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/controller/state/graph/route_common.go | Adds tracking for ExternalAuth filter backend-ref indices. |
| internal/controller/state/graph/common_filter.go | Introduces ExternalAuth filter type, conversion, validation, and duplicate handling. |
| internal/controller/state/graph/httproute.go | Collects ExternalAuth backendRefs and validates conflicts with ClientSettingsPolicy body sizing. |
| internal/controller/state/graph/graph.go | Invokes ExternalAuth-vs-policy conflict validation during graph build. |
| internal/controller/state/graph/backend_refs.go | Marks external-auth backends and excludes them from certain backend-TLS consistency checks. |
| internal/controller/state/dataplane/types.go | Adds dataplane representation for ExternalAuth filter. |
| internal/controller/state/dataplane/convert.go | Converts Gateway API ExternalAuth filter + resolved backend into dataplane config. |
| internal/controller/state/dataplane/configuration.go | Wires ExternalAuth filter into HTTP filter creation and skips ext-auth backends in backend groups. |
| internal/controller/nginx/config/http/config.go | Extends location model to carry external auth config + body sizing + proxy body forwarding toggle. |
| internal/controller/nginx/config/servers.go | Generates auth_request locations and updates locations with external auth config. |
| internal/controller/nginx/config/servers_template.go | Renders auth_request, auth_request_set, client_max_body_size, and proxy_pass_request_body. |
| internal/controller/state/graph/*_test.go | Adds unit tests for filter validation, duplicates, and route/policy conflicts. |
| internal/controller/state/dataplane/*_test.go | Adds conversion and filter-creation tests for ExternalAuth. |
| internal/controller/nginx/config/servers_test.go | Adds NGINX rendering coverage for ExternalAuth scenarios (headers/body/TLS/mirror). |
| examples/external-authentication/* | Adds example manifests and a short README linking to docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
31dfc56 to
5e62429
Compare
sjberman
left a comment
There was a problem hiding this comment.
Did you manually verify that BackendTLSPolicy works with the auth server?
bjee19
left a comment
There was a problem hiding this comment.
nice job looks pretty good to me, just one question, and i'll wait for other comments to be resolved, then i'll re-review the changes
65161bd to
47aa500
Compare
19796dd to
c323aaf
Compare
|
Follow-up on the BTP verification I had initially confirmed BTP behavior on the upstream and validated that we could authorize requests against it. Code review feedback surfaced that external auth can also have its own BTP, so I went back and tested this, the same BTP applied to both the secure app and external-auth backends works as expected. Note: used the same BTP for both services secure-app and external-auth NGINX conf |
|
@salonichf5 And if you use two different policies, that also works? |
yes These two cases generate the same config and Also to note, note both cases hostname is same because according to spec, we pass client hostname to the ext auth server as well |
132ef87 to
ba55779
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ock request method and path to internal auth block and rebase
30c5c20 to
e766a70
Compare
bjee19
left a comment
There was a problem hiding this comment.
lgtm, just one small comment. nice job!
Proposed changes
Write a clear and concise description that helps reviewers understand the purpose and impact of your changes. Use the
following format:
Problem: Users want to be able to specify the external authorization backends for their HTTPRoutes
Solution: Adds support for external authentication filter for HTTPRoutes.
Testing: Describe any testing that you did.
Please focus on (optional): If you any specific areas where you would like reviewers to focus their attention or provide
specific feedback, add them here.
Closes #5134
Checklist
Before creating a PR, run through this checklist and mark each as complete.
Release notes
If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.