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.

Version:
$Revision: 1.11 $ $Date: 2000/02/09 00:02:34 $
See Also:
Socket, AuthenticatedSocket, MessageDigest

Field Summary
private  int challengeSize
           
private  java.util.Vector filterList
           
private  int maxConnections
           
private  MessageDigest md
           
private  java.util.Random random
           
private  byte[] secret
           
private  long seed
           
 
Fields inherited from class java.net.ServerSocket
factory, impl
 
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.
private  boolean isAuthenticated(java.net.Socket socket)
          Used internally to authenticate a newly connected socket
 
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, registerNatives, wait, wait, wait
 

Field Detail

secret

private byte[] secret

seed

private long seed

md

private MessageDigest md

random

private java.util.Random random

challengeSize

private int challengeSize

maxConnections

private int maxConnections

filterList

private java.util.Vector filterList
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. filterList can be null if security.allowedAddresses=DISABLED
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.
Throws:
AuthenticationException - when the connection is not authenticated.
Overrides:
accept in class java.net.ServerSocket

isAuthenticated

private boolean isAuthenticated(java.net.Socket socket)
Used internally to authenticate a newly connected socket

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.