-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix TLS configuration for WebClient Eureka transport #4601
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
Closed
yashdotdev13
wants to merge
19
commits into
spring-cloud:5.0.x
from
yashdotdev13:issue-3793-cert-authentication
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7078800
Log health contributor statuses in Eureka health checks
yashdotdev13 4a7b540
Add Dependabot entries for 5.0.x
spring-builds 6bbda54
Updating project versions to 2026.0.0-SNAPSHOT
spring-builds c9d9905
Log individual Eureka health contributor statuses
yashdotdev13 3b6ba97
Merge pull request #4592 from yashdotdev13/issue-4135-log-health-cont…
ryanjbaxter 2ab399a
Merge branch '5.0.x'
ryanjbaxter a48f6f5
Revert "Retarget workflow triggers to 5.0.x [skip actions]"
ryanjbaxter 17e7a17
Bump antora from 3.2.0-rc.3 to 3.2.0 in /docs (#4594)
dependabot[bot] 2d567b1
Merge branch '5.0.x'
ryanjbaxter 4c1b865
Use DiscoveryClient TLS settings for RestClient transport
yashdotdev13 d1032a9
Merge pull request #4597 from yashdotdev13/test-4109-baseline
ryanjbaxter b3c573a
Merge branch '5.0.x'
ryanjbaxter fe1538d
Document Eureka virtual hostname discovery
yashdotdev13 889984c
Merge pull request #4599 from yashdotdev13/docs/1424-eureka-virtual-h…
ryanjbaxter e64ecc7
Merge branch '5.0.x'
ryanjbaxter ede54db
Improve Eureka Server documentation
yashdotdev13 47b2feb
Merge pull request #4600 from yashdotdev13/docs/598-improve-eureka-se…
ryanjbaxter 51884be
Merge branch '5.0.x'
ryanjbaxter 9333af1
Support TLS configuration for WebClient Eureka transport
yashdotdev13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| name: PR | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [5.0.x, 4.3.x] | ||
| branches: [ main, 4.3.x ] | ||
|
|
||
| jobs: | ||
| build: | ||
| uses: spring-cloud/spring-cloud-github-actions/.github/workflows/pr.yml@b6a6b1963b8762420526591c3d363bd7d09e7d4b # v1.1.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...ts/src/test/java/org/springframework/cloud/netflix/eureka/WebClientEurekaClientTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /* | ||
| * Copyright 2018-present the original author or authors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.springframework.cloud.netflix.eureka; | ||
|
|
||
| import java.io.IOException; | ||
| import java.security.GeneralSecurityException; | ||
|
|
||
| import org.apache.commons.logging.Log; | ||
| import org.apache.commons.logging.LogFactory; | ||
| import org.junit.jupiter.api.AfterAll; | ||
| import org.junit.jupiter.api.BeforeAll; | ||
|
|
||
| import org.springframework.boot.SpringBootConfiguration; | ||
| import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
| import org.springframework.cloud.configuration.TlsProperties; | ||
| import org.springframework.cloud.netflix.eureka.http.WebClientDiscoveryClientOptionalArgs; | ||
| import org.springframework.cloud.netflix.eureka.http.WebClientTransportClientFactories; | ||
| import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.web.reactive.function.client.WebClient; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
| import static org.springframework.cloud.netflix.eureka.config.DiscoveryClientOptionalArgsConfiguration.setupTLS; | ||
|
|
||
| /** | ||
| * Tests for verifying TLS setup with {@link WebClientTransportClientFactories}. | ||
| * | ||
| * @author Olga Maciaszek-Sharma | ||
|
yashdotdev13 marked this conversation as resolved.
|
||
| */ | ||
| public class WebClientEurekaClientTests extends BaseCertTests { | ||
|
|
||
| private static final Log LOG = LogFactory.getLog(WebClientEurekaClientTests.class); | ||
|
|
||
| private static EurekaServerRunner server; | ||
|
|
||
| private static EurekaClientRunner service; | ||
|
|
||
| @BeforeAll | ||
| public static void setupAll() { | ||
| server = startEurekaServer(TestEurekaServer.class); | ||
| service = startService(server, TestApp.class); | ||
| assertThat(service.discoveryClientOptionalArgs()).isInstanceOf(WebClientDiscoveryClientOptionalArgs.class); | ||
| LOG.info("Successfully asserted that WebClient will be used"); | ||
| waitForRegistration(() -> new WebClientEurekaClientTests().createEurekaClient()); | ||
| } | ||
|
|
||
| @AfterAll | ||
| public static void tearDownAll() { | ||
| stopService(service); | ||
| stopEurekaServer(server); | ||
| } | ||
|
|
||
| @Override | ||
| EurekaClientRunner createEurekaClient() { | ||
| return new EurekaClientRunner(TestApp.class, server); | ||
| } | ||
|
|
||
| @SpringBootConfiguration | ||
| @EnableAutoConfiguration | ||
| public static class TestApp { | ||
|
|
||
| @Bean | ||
| public WebClientDiscoveryClientOptionalArgs forceWebClientDiscoveryClientOptionalArgs( | ||
| TlsProperties tlsProperties) throws GeneralSecurityException, IOException { | ||
| WebClientDiscoveryClientOptionalArgs result = new WebClientDiscoveryClientOptionalArgs(WebClient::builder); | ||
| setupTLS(result, tlsProperties); | ||
| return result; | ||
| } | ||
|
|
||
| @Bean | ||
| public WebClientTransportClientFactories forceWebClientTransportClientFactories() { | ||
| return new WebClientTransportClientFactories(WebClient::builder); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| @SpringBootConfiguration | ||
| @EnableAutoConfiguration | ||
| @EnableEurekaServer | ||
| public static class TestEurekaServer { | ||
|
|
||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.