org.jboss.security.ssl
Class DomainSocketFactory

java.lang.Object
  extended byjavax.net.SocketFactory
      extended byjavax.net.ssl.SSLSocketFactory
          extended byorg.jboss.security.ssl.DomainSocketFactory
All Implemented Interfaces:
EventListener, HandshakeCompletedListener

public class DomainSocketFactory
extends SSLSocketFactory
implements HandshakeCompletedListener

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

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

Constructor Summary
DomainSocketFactory()
          A default constructor for use when created by Class.newInstance.
DomainSocketFactory(org.jboss.security.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()
           
 org.jboss.security.SecurityDomain getSecurityDomain()
           
 String[] getSupportedCipherSuites()
           
 void handshakeCompleted(HandshakeCompletedEvent handshakeCompletedEvent)
           
 boolean isNeedsClientAuth()
           
 boolean isWantsClientAuth()
           
 void setNeedsClientAuth(boolean needsClientAuth)
           
 void setSecurityDomain(org.jboss.security.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
 

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(org.jboss.security.SecurityDomain securityDomain)
                    throws IOException
Create a socket factory instance that uses the given SecurityDomain as the source for the SSL KeyManagerFactory and TrustManagerFactory.

Method Detail

getSecurityDomain

public org.jboss.security.SecurityDomain getSecurityDomain()

setSecurityDomain

public void setSecurityDomain(org.jboss.security.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.

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
Throws:
IOException
UnknownHostException

createSocket

public Socket createSocket(InetAddress serverAddr,
                           int serverPort)
                    throws IOException
Throws:
IOException

createSocket

public Socket createSocket(InetAddress serverAddr,
                           int serverPort,
                           InetAddress clientAddr,
                           int clientPort)
                    throws IOException
Throws:
IOException

createSocket

public Socket createSocket(Socket s,
                           String host,
                           int port,
                           boolean autoClose)
                    throws IOException
Throws:
IOException

getDefaultCipherSuites

public String[] getDefaultCipherSuites()

getSupportedCipherSuites

public String[] getSupportedCipherSuites()

getDefault

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


handshakeCompleted

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


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