Skip to content

Commit 7f49065

Browse files
test: provide additional comments and guards for oauth test support
1 parent 7964032 commit 7f49065

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

api/src/main/java/io/kafbat/ui/config/auth/OAuthSecurityConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public class OAuthSecurityConfig extends AbstractAuthSecurityConfig {
6262
private final OAuthProperties properties;
6363

6464
/**
65-
* WebClient configured to use system proxy properties (-Dhttps.proxyHost, -Dhttps.proxyPort).
65+
* WebClient configured to use system proxy properties (http.proxyHost/https.proxyHost,
66+
* http.proxyPort/https.proxyPort, http.nonProxyHosts/https.nonProxyHosts).
6667
* Created as a bean to ensure system properties are read after context initialization.
6768
*/
6869
@Bean(name = "oauthWebClient")

api/src/test/java/io/kafbat/ui/config/auth/OAuthTestSupport.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public static synchronized void ensureStarted(boolean enableProxy) {
9696
initialized = true;
9797
}
9898

99+
// Intentionally outside the initialized block - different tests may toggle proxy on/off
99100
// Set or clear proxy system properties based on enableProxy
100101
if (enableProxy) {
101102
System.setProperty("http.proxyHost", "localhost");
@@ -132,7 +133,9 @@ public static void resetServers() {
132133
}
133134
if (proxyServer != null) {
134135
proxyServer.resetAll();
135-
// Re-stub proxy forwarding after reset
136+
}
137+
// Re-stub proxy forwarding after reset
138+
if (proxyServer != null && oauthServer != null) {
136139
proxyServer.stubFor(WireMock.any(urlMatching(".*"))
137140
.willReturn(aResponse().proxiedFrom("http://localhost:" + oauthServer.port())));
138141
}

0 commit comments

Comments
 (0)