-
-
Notifications
You must be signed in to change notification settings - Fork 221
feat: Add OAuth2 proxy support for authentication requests #1540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes kafbat#196 - Add SimpleOAuthProxyConfig to handle proxy configuration for OAuth2 - Support both system proxy properties and explicit proxy configuration - Wire proxy-aware WebClient into OAuth2 user services - Add unit tests following repository patterns OAuth2 authentication now respects proxy settings when enabled, allowing Kafbat UI to work behind corporate firewalls. The feature is disabled by default to maintain backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi joshuaNathaniel! 👋
Welcome, and thank you for opening your first PR in the repo!
Please wait for triaging by our maintainers.
Please take a look at our contributing guide.
api/src/main/java/io/kafbat/ui/config/auth/SimpleOAuthProxyConfig.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds OAuth2 proxy support to Kafka UI, allowing authentication requests to be routed through an HTTP proxy. This is particularly useful for environments where direct internet access is restricted.
Key changes:
- Added
SimpleOAuthProxyConfigclass for configuring OAuth2 proxy settings with explicit or system proxy properties - Integrated proxy-configured WebClient into
OAuthSecurityConfigfor OAuth2 user services - Provided unit and integration tests for the proxy configuration
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| api/src/main/java/io/kafbat/ui/config/auth/SimpleOAuthProxyConfig.java | Implements OAuth2 proxy configuration with support for explicit proxy settings or system properties |
| api/src/main/java/io/kafbat/ui/config/auth/OAuthSecurityConfig.java | Integrates proxy-enabled WebClient into OAuth2 user services for both OIDC and standard OAuth2 flows |
| api/src/test/java/io/kafbat/ui/config/auth/SimpleOAuthProxyConfigTest.java | Unit tests validating proxy properties configuration and WebClient creation |
| api/src/test/java/io/kafbat/ui/config/auth/SimpleOAuthProxyConfigIntegrationTest.java | Integration tests attempting to validate proxy behavior, though tests expect failures due to test infrastructure limitations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
api/src/test/java/io/kafbat/ui/config/auth/SimpleOAuthProxyConfigIntegrationTest.java
Outdated
Show resolved
Hide resolved
api/src/test/java/io/kafbat/ui/config/auth/SimpleOAuthProxyConfigIntegrationTest.java
Outdated
Show resolved
Hide resolved
api/src/test/java/io/kafbat/ui/config/auth/SimpleOAuthProxyConfigIntegrationTest.java
Outdated
Show resolved
Hide resolved
api/src/main/java/io/kafbat/ui/config/auth/SimpleOAuthProxyConfig.java
Outdated
Show resolved
Hide resolved
Simplify OAuth2 authentication to automatically respect JVM proxy settings (e.g., -Dhttps.proxyHost, -Dhttps.proxyPort). The implementation uses Reactor Netty's built-in proxyWithSystemProperties() method, which gracefully handles both proxy and non-proxy scenarios without additional configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
api/src/main/java/io/kafbat/ui/config/auth/OAuthSecurityConfig.java
Outdated
Show resolved
Hide resolved
Add proxy-aware WebClient configuration for JWT decoder, opaque token introspection, and OIDC authentication manager. All OAuth2 HTTP calls now respect JVM system proxy properties. - Add ReactiveJwtDecoder bean with proxy-aware JWKS fetching - Add ReactiveOpaqueTokenIntrospector bean with proxy support - Add ReactiveOAuth2AccessTokenResponseClient for token endpoint - Configure OidcAuthorizationCodeReactiveAuthenticationManager - Add WireMock integration tests for with/without proxy scenarios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
api/src/main/java/io/kafbat/ui/config/auth/OAuthSecurityConfig.java
Outdated
Show resolved
Hide resolved
|
I've setup a manual testing environment with docker compose that sets up kafka-ui, keycloak, and mitmproxy. I've validated that everything is working through the proxy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I believe there my be a flaky pre-existing test here: https://github.com/kafbat/kafka-ui/actions/runs/19882548937/job/56983401628?pr=1540 edit: yup, looks like it. |
bc58374 to
7f49065
Compare
What changes did you make? (Give an overview)
This PR adds OAuth2 proxy support by configuring the OAuth2 WebClient to respect JVM system proxy properties. The implementation is minimal and uses Reactor Netty's built-in
proxyWithSystemProperties()method.Key changes:
OAuthSecurityConfigto configure OAuth2 WebClient with system proxy support-Dhttps.proxyHost,-Dhttps.proxyPort, etc.)Is there anything you'd like reviewers to focus on?
The implementation is intentionally minimal - just 4 lines of actual code that leverage Reactor Netty's built-in proxy support.
How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)
Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)
Check out Contributing and Code of Conduct
A picture of a cute animal (not mandatory but encouraged)
🦦