org.jboss.security.ssl
Class DomainSocketFactory

java.lang.Object
  extended by javax.net.SocketFactory
      extended by javax.net.ssl.SSLSocketFactory
          extended by org.jboss.security.ssl.DomainSocketFactory
All Implemented Interfaces:
Serializable, EventListener, HandshakeCompletedListener

public class DomainSocketFactory
extends SSLSocketFactory
implements HandshakeCompletedListener, Serializable

An implementation of SocketFactory that creates SSL sockets using the JSSE SSLContext and a JBossSX SecurityDomain for the KeyManagerFactory and TrustManagerFactory objects.

Version:
$Revision: 57203 $
Author:
Scott.Stark@jboss.org, Francisco Reverbel
See Also:
SSLContext, SecurityDomain, Serialized Form

Field Summary
static String HANDSHAKE_COMPLETE_LISTENER
           
 
Constructor Summary
DomainSocketFactory()
          A default constructor for use when created by Class.newInstance.
DomainSocketFactory(SecurityDomain securityDomain)
          Create a socket factory instance that uses the given SecurityDomain as the source for the SSL KeyManagerFactory and TrustManagerFactory.
 
Method Summary
 Socket createSocket(InetAddress serverAddr, int serverPort)
           
 Socket createSocket(InetAddress serverAddr, int serverPort, InetAddress clientAddr, int clientPort)
           
 Socket createSocket(Socket s, String host, int port, boolean autoClose)
           
 Socket createSocket(String serverHost, int serverPort)
          Create a client socket connected to the specified host and port.
 Socket createSocket(String serverHost, int serverPort, InetAddress clientAddr, int clientPort)
           
static SocketFactory getDefault()
          The default SocketFactory which looks to the java:/jaas/other security domain configuration.
 String[] getDefaultCipherSuites()
           
 SecurityDomain getSecurityDomain()
           
 String[] getSupportedCipherSuites()
           
 void handshakeCompleted(HandshakeCompletedEvent event)
           
 boolean isNeedsClientAuth()
           
 boolean isWantsClientAuth()
           
 void setNeedsClientAuth(boolean needsClientAuth)
           
 void setSecurityDomain(SecurityDomain securityDomain)
           
 void setWantsClientAuth(boolean wantsClientAuth)
           
 
Methods inherited from class javax.net.SocketFactory
createSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HANDSHAKE_COMPLETE_LISTENER

public static final String HANDSHAKE_COMPLETE_LISTENER
See Also:
Constant Field Values
Constructor Detail

DomainSocketFactory

public DomainSocketFactory()
A default constructor for use when created by Class.newInstance. The factory is not usable until its SecurityDomain has been established.


DomainSocketFactory

public DomainSocketFactory(SecurityDomain securityDomain)
                    throws IOException
Create a socket factory instance that uses the given SecurityDomain as the source for the SSL KeyManagerFactory and TrustManagerFactory.

Throws:
IOException
Method Detail

getSecurityDomain

public SecurityDomain getSecurityDomain()

setSecurityDomain

public void setSecurityDomain(SecurityDomain securityDomain)

isWantsClientAuth

public boolean isWantsClientAuth()

setWantsClientAuth

public void setWantsClientAuth(boolean wantsClientAuth)

isNeedsClientAuth

public boolean isNeedsClientAuth()

setNeedsClientAuth

public void setNeedsClientAuth(boolean needsClientAuth)

createSocket

public Socket createSocket(String serverHost,
                           int serverPort)
                    throws IOException,
                           UnknownHostException
Create a client socket connected to the specified host and port.

Specified by:
createSocket in class SocketFactory
Parameters:
serverHost - - the host name
serverPort - - the port number
Returns:
a socket connected to the specified host and port.
Throws:
IOException - if an I/O error occurs during socket creation.
UnknownHostException

createSocket

public Socket createSocket(String serverHost,
                           int serverPort,
                           InetAddress clientAddr,
                           int clientPort)
                    throws IOException,
                           UnknownHostException
Specified by:
createSocket in class SocketFactory
Throws:
IOException
UnknownHostException

createSocket

public Socket createSocket(InetAddress serverAddr,
                           int serverPort)
                    throws IOException
Specified by:
createSocket in class SocketFactory
Throws:
IOException

createSocket

public Socket createSocket(InetAddress serverAddr,
                           int serverPort,
                           InetAddress clientAddr,
                           int clientPort)
                    throws IOException
Specified by:
createSocket in class SocketFactory
Throws:
IOException

createSocket

public Socket createSocket(Socket s,
                           String host,
                           int port,
                           boolean autoClose)
                    throws IOException
Specified by:
createSocket in class SSLSocketFactory
Throws:
IOException

getDefaultCipherSuites

public String[] getDefaultCipherSuites()
Specified by:
getDefaultCipherSuites in class SSLSocketFactory

getSupportedCipherSuites

public String[] getSupportedCipherSuites()
Specified by:
getSupportedCipherSuites in class SSLSocketFactory

getDefault

public static SocketFactory getDefault()
The default SocketFactory which looks to the java:/jaas/other security domain configuration.


handshakeCompleted

public void handshakeCompleted(HandshakeCompletedEvent event)
Specified by:
handshakeCompleted in interface HandshakeCompletedListener


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.