org.openmdx.base.net.ssl
Class AbstractHostnameVerifier

java.lang.Object
  extended by org.openmdx.base.net.ssl.AbstractHostnameVerifier
All Implemented Interfaces:
HostnameVerifier
Direct Known Subclasses:
LenientHostnameVerifier

public class AbstractHostnameVerifier
extends Object
implements HostnameVerifier

Abstract Hostname Verifier

Accepts for example a certificate with the common name "*.openmdx.org" to access "any-sub-domain.openmdx.org".


Constructor Summary
protected AbstractHostnameVerifier()
          Constructor
 
Method Summary
protected static String getCommonName(String distinguishedName)
          Retrieves the common name from an X.500 principal
protected  boolean matches(String hostName, String commonName)
          Tests whether the host name matches a given wildcard common name
 boolean verify(String hostName, SSLSession sslSession)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHostnameVerifier

protected AbstractHostnameVerifier()
Constructor

Method Detail

verify

public boolean verify(String hostName,
                      SSLSession sslSession)
Specified by:
verify in interface HostnameVerifier

matches

protected boolean matches(String hostName,
                          String commonName)
Tests whether the host name matches a given wildcard common name

This method is usually overridden by a subclass as JSSE does not call the HostnameVerifier interceptor if the given expression evaluates to true.

Parameters:
hostName -
commonName -
Returns:
true if the host name matches the given common name

getCommonName

protected static String getCommonName(String distinguishedName)
Retrieves the common name from an X.500 principal

Parameters:
principal -
Returns:
the principal's common name


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.