org.apache.hc.client5.http.ssl

## Class DefaultHostnameVerifier

- java.lang.Object
- - org.apache.hc.client5.http.ssl.DefaultHostnameVerifier

- All Implemented Interfaces:
    HostnameVerifier, HttpClientHostnameVerifier

      @Contract(threading=STATELESS)
      public final class DefaultHostnameVerifier
      extends Object
      implements HttpClientHostnameVerifier

  Default `HostnameVerifier` implementation.
  Since:
    4.4

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultHostnameVerifier()`
    `DefaultHostnameVerifier(PublicSuffixMatcher publicSuffixMatcher)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `verify(String host, SSLSession session)`
    `void` | `verify(String host, X509Certificate cert)` Verifies the supplied server `X509Certificate` and ensures it matches the original host name.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultHostnameVerifier

          public DefaultHostnameVerifier(PublicSuffixMatcher publicSuffixMatcher)

    - #### DefaultHostnameVerifier

          public DefaultHostnameVerifier()

  - ### Method Detail

    - #### verify

          public boolean verify(String host,
                                SSLSession session)

      Specified by:
        `verify` in interface `HostnameVerifier`

    - #### verify

          public void verify(String host,
                             X509Certificate cert)
                      throws SSLException

      Description copied from interface: `HttpClientHostnameVerifier`
      Verifies the supplied server `X509Certificate` and ensures it matches the original host name.
      Specified by:
        `verify` in interface `HttpClientHostnameVerifier`
      Parameters:
        `host` - the original host name.
        `cert` - the server certificate;
      Throws:
        `SSLException`

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.