Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Implementation of Hostname Verification when connecting to any endpoint #401

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

arindamhit
Copy link
Contributor

When we connecting to any end point, we were allowing any hostname. But there are request where we need to mandate host name verification. We are providing option to enable/disable hostname verification. By default, it will be disabled or go with the default behavior.

@arindamhit arindamhit requested review from ysd24 and graju256 November 1, 2021 09:07
@arindamhit arindamhit self-assigned this Nov 1, 2021
return true;
} else {
try {
throw new SSLPeerUnverifiedException("Cannot verify hostname: " + hostname);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing the exception and catching it immediately doesn't make any sense.
You can remove this try-catch block.

@@ -162,4 +165,22 @@ public void checkServerTrusted(X509Certificate[] chain, String s) throws Certifi
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}

@Override
public boolean verify(String hostname, SSLSession session) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was not called anywhere.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants