org.apache.java.net
Class AuthenticatedServerSocket

java.lang.Object
  |
  +--java.net.ServerSocket
        |
        +--org.apache.java.net.AuthenticatedServerSocket

public class AuthenticatedServerSocket
extends java.net.ServerSocket

This class implements an authenticated server socket that binds to port and listens for authenticated connections. A socket connection to be authenticated must come from an IP address contained into a address filter list and go pass the authentication handshake defined in AJPv1.1 protocol specification.

See Also:
Socket, AuthenticatedSocket, MessageDigest

Constructor Summary
AuthenticatedServerSocket(int port, int maxConnections, java.util.Vector filterList)
          Construct the authenticated socket listening to the specified port but with authentication disabled.
AuthenticatedServerSocket(int port, int maxConnections, java.util.Vector filterList, java.net.InetAddress ia)
          Construct the authenticated socket listening to the specified port but with authentication disabled.
AuthenticatedServerSocket(int port, int maxConnections, java.util.Vector filterList, MessageDigest md, byte[] secret, int challengeSize, java.net.InetAddress ia)
          Construct the authenticated socket listening to the specified port.
 
Method Summary
 java.net.Socket accept()
          Blocks until a connection is made to the port.
 int getChallengeSize()
          Return the currently used challenge size.
 java.util.Vector getFilterList()
          Return the IP address filter list used by this server socket.
 int getMaxConnections()
          Return maximum number of connections this socket can handle.
 
Methods inherited from class java.net.ServerSocket
close, getInetAddress, getLocalPort, getSoTimeout, implAccept, setSocketFactory, setSoTimeout, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AuthenticatedServerSocket

public AuthenticatedServerSocket(int port,
                                 int maxConnections,
                                 java.util.Vector filterList)
                          throws java.io.IOException
Construct the authenticated socket listening to the specified port but with authentication disabled. This is used when IP filtering is needed, but the authentication overhead must be avoided (for example for localhost connections where only 127.0.0.1 is allowed). It will attempt to bind the socket to localhost.

AuthenticatedServerSocket

public AuthenticatedServerSocket(int port,
                                 int maxConnections,
                                 java.util.Vector filterList,
                                 java.net.InetAddress ia)
                          throws java.io.IOException
Construct the authenticated socket listening to the specified port but with authentication disabled. This is used when IP filtering is needed, but the authentication overhead must be avoided (for example for localhost connections where only 127.0.0.1 is allowed). It will attempt to bind the socket to the value in ia.

AuthenticatedServerSocket

public AuthenticatedServerSocket(int port,
                                 int maxConnections,
                                 java.util.Vector filterList,
                                 MessageDigest md,
                                 byte[] secret,
                                 int challengeSize,
                                 java.net.InetAddress ia)
                          throws java.io.IOException
Construct the authenticated socket listening to the specified port. It will attempt to bind the socket to the value in ia.
Method Detail

accept

public java.net.Socket accept()
                       throws AuthenticationException
Blocks until a connection is made to the port. If the connection is authenticated is passed to the caller, otherwise an AuthenticationException is thrown.
Overrides:
accept in class java.net.ServerSocket
Throws:
AuthenticationException - when the connection is not authenticated.

getFilterList

public java.util.Vector getFilterList()
Return the IP address filter list used by this server socket.

getChallengeSize

public int getChallengeSize()
Return the currently used challenge size.

getMaxConnections

public int getMaxConnections()
Return maximum number of connections this socket can handle.