SmartFrog 3.10.000

org.smartfrog.sfcore.security
Class SFSocket

java.lang.Object
  extended by java.net.Socket
      extended by org.smartfrog.sfcore.security.SFSocket

public class SFSocket
extends java.net.Socket

Extends a Socket so that it contains a reference to the SSL socket that is wrapping it, the security context used to create that socket, and whether it was created using client mode.


Constructor Summary
SFSocket(SFSecurityEnvironment secEnv, boolean useClientMode)
          Constructs SFSocket with security environment.Typically invoked by the server.
SFSocket(java.lang.String host, int port, SFSecurityEnvironment secEnv, boolean useClientMode)
          Constructs SFSocket with host, port and security environment.
 
Method Summary
 java.io.InputStream getInputStream()
          Gets the input stream associated with this socket.
 java.lang.String getPeerAuthenticatedSubjects()
          Gets a list of subjects that we have successfully authenticated for our peer.
 javax.net.ssl.SSLSocket getSSLSocket()
          Gets the SSL socket that wraps this socket.
 boolean getUseClientMode()
          Gets a flag stating whether the wrapping SSL socket is using client mode.
 void setSSLSocket(javax.net.ssl.SSLSocket ssls)
          Sets the SSL socket that wraps this socket.
 
Methods inherited from class java.net.Socket
bind, close, connect, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SFSocket

public SFSocket(SFSecurityEnvironment secEnv,
                boolean useClientMode)
Constructs SFSocket with security environment.Typically invoked by the server.

Parameters:
secEnv - A security environment that configures the SSL socket.
useClientMode - A flag stating whether the wrapping SSL socket is using client mode.

SFSocket

public SFSocket(java.lang.String host,
                int port,
                SFSecurityEnvironment secEnv,
                boolean useClientMode)
         throws java.net.UnknownHostException,
                java.io.IOException
Constructs SFSocket with host, port and security environment. Typically invoked by the server.

Parameters:
host - The host name.
port - The port number.
secEnv - A security environment that configures the SSL socket.
useClientMode - A flag stating whether the wrapping SSL socket is using client mode.
Throws:
java.net.UnknownHostException - If the IP address of the host could not be determined.
java.io.IOException - If an I/O error occurs when creating the socket.
Method Detail

setSSLSocket

public void setSSLSocket(javax.net.ssl.SSLSocket ssls)
Sets the SSL socket that wraps this socket.

Parameters:
ssls - The SSL socket that wraps this socket.
See Also:
getSSLSocket()

getSSLSocket

public javax.net.ssl.SSLSocket getSSLSocket()
Gets the SSL socket that wraps this socket.

Returns:
The SSL socket that wraps this socket.
See Also:
setSSLSocket(javax.net.ssl.SSLSocket)

getUseClientMode

public boolean getUseClientMode()
Gets a flag stating whether the wrapping SSL socket is using client mode.

Returns:
A flag stating whether the wrapping SSL socket is using client mode.

getPeerAuthenticatedSubjects

public java.lang.String getPeerAuthenticatedSubjects()
Gets a list of subjects that we have successfully authenticated for our peer.

Returns:
A list of subjects that we have successfully authenticated for our peer.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Gets the input stream associated with this socket. The motivation to override it is that in the current sun's implementation of RMI the thread that calls the first read (to unmarshal the arguments) actually performs the method invocation. Therefore, by attaching this socket to that thread, it will become available during the method invocation for security checks.

Overrides:
getInputStream in class java.net.Socket
Returns:
A wrapped input stream for this socket.
Throws:
java.io.IOException - If an I/O error ocurrs when creating the input stream.

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP