Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mortbay.http
Class JsseListener  view JsseListener download JsseListener.java

java.lang.Object
  extended byorg.mortbay.util.ThreadPool
      extended byorg.mortbay.util.ThreadedServer
          extended byorg.mortbay.http.SocketListener
              extended byorg.mortbay.http.JsseListener
All Implemented Interfaces:
HttpListener, org.mortbay.util.LifeCycle, java.io.Serializable
Direct Known Subclasses:
SunJsseListener

public abstract class JsseListener
extends SocketListener

JSSE Socket Listener. This specialization of HttpListener is an abstract listener that can be used as the basis for a specific JSSE listener. This is heavily based on the work from Court Demas, which in turn is based on the work from Forge Research.

Version:
$Id: JsseListener.java,v 1.15 2003/09/18 13:29:21 gregwilkins Exp $

Nested Class Summary
private  class JsseListener.CachedInfo
          Simple bundle of information that is cached in the SSLSession.
 
Nested classes inherited from class org.mortbay.util.ThreadedServer
 
Nested classes inherited from class org.mortbay.util.ThreadPool
org.mortbay.util.ThreadPool.PoolThread
 
Field Summary
private  boolean _needClientAuth
          Set to true if we require client certificate authentication.
(package private) static java.lang.String CACHED_INFO_ATTR
          The name of the SSLSession attribute that will contain any cached information.
static java.lang.String DEFAULT_KEYSTORE
          Default value for the keystore location path.
static java.lang.String DEFAULT_KEYSTORE_PROVIDER_CLASS
          Default value for keystore provider class.
static java.lang.String DEFAULT_KEYSTORE_PROVIDER_NAME
          Default value for keystore provider name.
static java.lang.String DEFAULT_KEYSTORE_TYPE
          Default keystore type
static java.lang.String KEYPASSWORD_PROPERTY
          String name of key password property.
static java.lang.String KEYSTORE_PROPERTY
          String name of keystore location path property.
static java.lang.String KEYSTORE_PROVIDER_CLASS_PROPERTY
          String name of keystore provider class property
static java.lang.String KEYSTORE_PROVIDER_NAME_PROPERTY
          String name of keystore provider name property
static java.lang.String KEYSTORE_TYPE_PROPERTY
          String name of keystore type property
private static org.apache.commons.logging.Log log
           
static java.lang.String PASSWORD_PROPERTY
          String name of keystore password property.
 
Fields inherited from class org.mortbay.http.SocketListener
 
Fields inherited from class org.mortbay.util.ThreadedServer
 
Fields inherited from class org.mortbay.util.ThreadPool
__DAEMON, __PRIORITY
 
Fields inherited from interface org.mortbay.http.HttpListener
ATTRIBUTE
 
Constructor Summary
JsseListener()
          Constructor.
JsseListener(org.mortbay.util.InetAddrPort p_address)
          Constructor.
 
Method Summary
protected  java.net.Socket accept(java.net.ServerSocket p_serverSocket)
           
protected abstract  javax.net.ssl.SSLServerSocketFactory createFactory()
           
protected  void customizeRequest(java.net.Socket socket, HttpRequest request)
          Allow the Listener a chance to customise the request.
private static java.security.cert.X509Certificate[] getCertChain(javax.net.ssl.SSLSession sslSession)
          Return the chain of X509 certificates used to negotiate the SSL Session.
 boolean getNeedClientAuth()
           
 boolean isConfidential(HttpConnection connection)
          Get the confidential status of a connection.
 boolean isIntegral(HttpConnection connection)
          Get the integral status of a connection.
protected  java.net.ServerSocket newServerSocket(org.mortbay.util.InetAddrPort p_address, int p_acceptQueueSize)
          New server socket.
 void setNeedClientAuth(boolean needClientAuth)
          Set the value of the needClientAuth property
 
Methods inherited from class org.mortbay.http.SocketListener
createConnection, customizeRequest, getBufferReserve, getBufferSize, getConfidentialPort, getConfidentialScheme, getDefaultScheme, getHttpHandler, getHttpServer, getIdentifyListener, getIntegralPort, getIntegralScheme, getLowResourcePersistTimeMs, handleConnection, isLowOnResources, isOutOfResources, persistConnection, setBufferReserve, setBufferSize, setConfidentialPort, setConfidentialScheme, setDefaultScheme, setHttpHandler, setHttpServer, setIdentifyListener, setIntegralPort, setIntegralScheme, setLowResourcePersistTimeMs, start, stop
 
Methods inherited from class org.mortbay.util.ThreadedServer
acceptSocket, getHost, getInetAddress, getInetAddrPort, getLingerTimeSecs, getMaxReadTimeMs, getPort, getServerSocket, getTcpNoDelay, handle, handleConnection, open, setHost, setInetAddress, setInetAddrPort, setLingerTimeSecs, setMaxReadTimeMs, setPort, setTcpNoDelay, stopJob, toString
 
Methods inherited from class org.mortbay.util.ThreadPool
getIdleThreads, getMaxIdleTimeMs, getMaxThreads, getMinThreads, getName, getPoolName, getThreads, getThreadsPriority, isDaemon, isStarted, join, run, setDaemon, setMaxIdleTimeMs, setMaxStopTimeMs, setMaxThreads, setMinThreads, setName, setPoolName, setThreadsPriority, shrink
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mortbay.http.HttpListener
getHost, getPort, setHost, setPort
 
Methods inherited from interface org.mortbay.util.LifeCycle
isStarted
 

Field Detail

log

private static org.apache.commons.logging.Log log

KEYSTORE_PROPERTY

public static final java.lang.String KEYSTORE_PROPERTY
String name of keystore location path property.

See Also:
Constant Field Values

KEYSTORE_TYPE_PROPERTY

public static final java.lang.String KEYSTORE_TYPE_PROPERTY
String name of keystore type property

See Also:
Constant Field Values

DEFAULT_KEYSTORE_TYPE

public static final java.lang.String DEFAULT_KEYSTORE_TYPE
Default keystore type


KEYSTORE_PROVIDER_NAME_PROPERTY

public static final java.lang.String KEYSTORE_PROVIDER_NAME_PROPERTY
String name of keystore provider name property

See Also:
Constant Field Values

KEYSTORE_PROVIDER_CLASS_PROPERTY

public static final java.lang.String KEYSTORE_PROVIDER_CLASS_PROPERTY
String name of keystore provider class property

See Also:
Constant Field Values

DEFAULT_KEYSTORE_PROVIDER_CLASS

public static final java.lang.String DEFAULT_KEYSTORE_PROVIDER_CLASS
Default value for keystore provider class. null = use default


DEFAULT_KEYSTORE

public static final java.lang.String DEFAULT_KEYSTORE
Default value for the keystore location path.


DEFAULT_KEYSTORE_PROVIDER_NAME

public static final java.lang.String DEFAULT_KEYSTORE_PROVIDER_NAME
Default value for keystore provider name. null = use default


PASSWORD_PROPERTY

public static final java.lang.String PASSWORD_PROPERTY
String name of keystore password property.

See Also:
Constant Field Values

KEYPASSWORD_PROPERTY

public static final java.lang.String KEYPASSWORD_PROPERTY
String name of key password property.

See Also:
Constant Field Values

CACHED_INFO_ATTR

static final java.lang.String CACHED_INFO_ATTR
The name of the SSLSession attribute that will contain any cached information.


_needClientAuth

private boolean _needClientAuth
Set to true if we require client certificate authentication.

Constructor Detail

JsseListener

public JsseListener()
Constructor.


JsseListener

public JsseListener(org.mortbay.util.InetAddrPort p_address)
Constructor.

Method Detail

setNeedClientAuth

public void setNeedClientAuth(boolean needClientAuth)
Set the value of the needClientAuth property


getNeedClientAuth

public boolean getNeedClientAuth()

isIntegral

public boolean isIntegral(HttpConnection connection)
Description copied from interface: HttpListener
Get the integral status of a connection.

Specified by:
isIntegral in interface HttpListener
Overrides:
isIntegral in class SocketListener

isConfidential

public boolean isConfidential(HttpConnection connection)
Description copied from interface: HttpListener
Get the confidential status of a connection.

Specified by:
isConfidential in interface HttpListener
Overrides:
isConfidential in class SocketListener

createFactory

protected abstract javax.net.ssl.SSLServerSocketFactory createFactory()
                                                               throws java.lang.Exception

newServerSocket

protected java.net.ServerSocket newServerSocket(org.mortbay.util.InetAddrPort p_address,
                                                int p_acceptQueueSize)
                                         throws java.io.IOException
Description copied from class: org.mortbay.util.ThreadedServer
New server socket. Creates a new servers socket. May be overriden by derived class to create specialist serversockets (eg SSL).


accept

protected java.net.Socket accept(java.net.ServerSocket p_serverSocket)
                          throws java.io.IOException

customizeRequest

protected void customizeRequest(java.net.Socket socket,
                                HttpRequest request)
Allow the Listener a chance to customise the request. before the server does its stuff.
This allows the required attributes to be set for SSL requests.
The requirements of the Servlet specs are:
  • an attribute named "javax.servlet.request.cipher_suite" of type String.
  • an attribute named "javax.servlet.request.key_size" of type Integer.
  • an attribute named "javax.servlet.request.X509Certificate" of type java.security.cert.X509Certificate[]. This is an array of objects of type X509Certificate, the order of this array is defined as being in ascending order of trust. The first certificate in the chain is the one set by the client, the next is the one used to authenticate the first, and so on.

Overrides:
customizeRequest in class SocketListener

getCertChain

private static java.security.cert.X509Certificate[] getCertChain(javax.net.ssl.SSLSession sslSession)
Return the chain of X509 certificates used to negotiate the SSL Session.

Note: in order to do this we must convert a javax.security.cert.X509Certificate[], as used by JSSE to a java.security.cert.X509Certificate[],as required by the Servlet specs.