javax.net.ssl

Interface HostnameVerifier

public interface HostnameVerifier

The interface for classes that perform hostname verification for cases when the hostname used to begin the connection (such as in a URL) does not match the hostname used in the SSL handshake. Implementations of this interface should provide an implementation of the verify(java.lang.String,javax.net.ssl.SSLSession) method that accepts or rejects hostnames as appropriate.
Author:
Casey Marshall (rsdio@metastatic.org)

Method Summary

boolean
verify(String hostname, SSLSession session)
Verifies a hostname given a particular SSL session.

Method Details

verify

public boolean verify(String hostname,
                      SSLSession session)
Verifies a hostname given a particular SSL session. This method should return true if the hostname is an accepted alias for the hostname negotiated in the SSL handshake.
Parameters:
hostname - The hostname in question.
session - The current SSL session.
Returns:
true if the hostname is acceptable.