-
Notifications
You must be signed in to change notification settings - Fork 1.1k
doc: document how to Disable hostname verification in ssl config #11526
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f39deb1
doc: document how to Disable hostname verification in ssl config
sdelamo ce3703d
Update http-client/src/main/java/io/micronaut/http/client/netty/ssl/N…
sdelamo f6eaeec
Update src/main/docs/guide/httpClient/httpClientImplementations/netty…
sdelamo 5a812f8
Update src/main/docs/guide/httpClient/httpClientImplementations/netty…
sdelamo 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
30 changes: 30 additions & 0 deletions
30
...nt/src/test/java/io/micronaut/http/client/netty/ssl/NettyClientSslBuilderReplacement.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,30 @@ | ||
package io.micronaut.http.client.netty.ssl; | ||
|
||
import io.micronaut.context.annotation.BootstrapContextCompatible; | ||
import io.micronaut.context.annotation.Replaces; | ||
import io.micronaut.context.annotation.Requires; | ||
import io.micronaut.context.annotation.Secondary; | ||
import io.micronaut.context.env.Environment; | ||
import io.micronaut.core.io.ResourceResolver; | ||
import io.micronaut.http.client.HttpVersionSelection; | ||
import io.micronaut.http.ssl.SslConfiguration; | ||
import io.netty.handler.ssl.SslContextBuilder; | ||
import jakarta.inject.Singleton; | ||
|
||
@Requires(env = Environment.TEST) | ||
@Singleton | ||
@BootstrapContextCompatible | ||
@Secondary | ||
@Replaces(NettyClientSslBuilder.class) | ||
class NettyClientSslBuilderReplacement extends NettyClientSslBuilder { | ||
NettyClientSslBuilderReplacement(ResourceResolver resourceResolver) { | ||
super(resourceResolver); | ||
} | ||
|
||
@Override | ||
protected SslContextBuilder createSslContextBuilder(SslConfiguration ssl, HttpVersionSelection versionSelection) { | ||
SslContextBuilder builder = super.createSslContextBuilder(ssl, versionSelection); | ||
builder.endpointIdentificationAlgorithm(null); | ||
return builder; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/docs/guide/httpClient/httpClientImplementations/nettyHttpClient.adoc
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,3 +1,15 @@ | ||
To use an implementation based on https://netty.io[Netty], add the following dependency to your build: | ||
|
||
dependency:micronaut-http-client[] | ||
|
||
== Disable hostname verification in ssl config | ||
|
||
It may be necessary in a testing or development environment to disable hostname verification. | ||
|
||
To disable hostname verification in your test classpath, you could create a <<replaces, Bean Replacement>> in `src/test/java`: | ||
|
||
[source,java] | ||
---- | ||
include::http-client/src/test/java/io/micronaut/http/client/netty/ssl/NettyClientSslBuilderReplacement.java[indent=0] | ||
---- | ||
WARNING: Disabling host name verification leaves your application potentially vulnerable to Man-in-the-Middle attacks and should only be done with the utmost care typically only in a development / testing environment. Never disable host name verification in production or in a scenario where you are making remote calls over the internet. |
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.