Class JsseDefaultHostnameAuthorizer

  • All Implemented Interfaces:
    JsseHostnameAuthorizer

    public class JsseDefaultHostnameAuthorizer
    extends java.lang.Object
    implements JsseHostnameAuthorizer
    A typical hostname authorizer for verifying a hostname against the available certificates.
    • Constructor Summary

      Constructors 
      Constructor Description
      JsseDefaultHostnameAuthorizer​(java.util.Set<java.lang.String> knownSuffixes)
      Base constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isValidNameMatch​(java.lang.String name, java.lang.String dnsName, java.util.Set<java.lang.String> suffixes)  
      boolean verified​(java.lang.String name, javax.net.ssl.SSLSession context)
      Verify the passed in host name according to the context object.
      boolean verify​(java.lang.String name, java.security.cert.X509Certificate cert)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JsseDefaultHostnameAuthorizer

        public JsseDefaultHostnameAuthorizer​(java.util.Set<java.lang.String> knownSuffixes)
        Base constructor.

        The authorizer attempts to perform matching (including the use of the wildcard) in accordance with RFC 6125.

        Known suffixes is a list of public domain suffixes that can't be used as wild cards for example *.com, or c*c.com, as a dns wildcard could match every/most .com domains if a registrar were issue it. If *.com is in the known suffixes list will not be allowed to match.

        Parameters:
        knownSuffixes - a set of suffixes that cannot be wild-carded, e.g. { ".com", ".net", ".org" }
    • Method Detail

      • verified

        public boolean verified​(java.lang.String name,
                                javax.net.ssl.SSLSession context)
                         throws java.io.IOException
        Description copied from interface: JsseHostnameAuthorizer
        Verify the passed in host name according to the context object.
        Specified by:
        verified in interface JsseHostnameAuthorizer
        Parameters:
        name - name of the host to be verified.
        context - context object to do the verification under.
        Returns:
        true if name verified, false otherwise.
        Throws:
        java.io.IOException
      • verify

        public boolean verify​(java.lang.String name,
                              java.security.cert.X509Certificate cert)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • isValidNameMatch

        public static boolean isValidNameMatch​(java.lang.String name,
                                               java.lang.String dnsName,
                                               java.util.Set<java.lang.String> suffixes)
                                        throws java.io.IOException
        Throws:
        java.io.IOException