socks.server
Class IdentAuthenticator

java.lang.Object
  |
  +--socks.server.ServerAuthenticatorNone
        |
        +--socks.server.IdentAuthenticator

public class IdentAuthenticator
extends ServerAuthenticatorNone

An implementation of socks.ServerAuthentication which provides simple authentication based on the host from which the connection is made and the name of the user on the remote machine, as reported by identd daemon on the remote machine.

It can also be used to provide authentication based only on the contacting host address.


Constructor Summary
IdentAuthenticator()
          Constructs empty IdentAuthenticator.
 
Method Summary
 void add(InetRange hostRange, java.util.Hashtable users)
          Adds range of addresses from which connection is allowed.
 boolean checkRequest(ProxyMessage msg, java.net.Socket s)
          For SOCKS5 requests allways returns true.
 ServerAuthenticator startSession(java.net.Socket s)
          Grants permission only to those users, who connect from one of the hosts registered with add(InetRange,Hashtable) and whose names, as reported by identd daemon, are listed for the host the connection came from.
 java.lang.String toString()
          Get String representaion of the IdentAuthenticator.
 
Methods inherited from class socks.server.ServerAuthenticatorNone
checkRequest, checkRequest, endSession, getInputStream, getOutputStream, getUdpEncapsulation, selectSocks5Authentication
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IdentAuthenticator

public IdentAuthenticator()
Constructs empty IdentAuthenticator.
Method Detail

add

public void add(InetRange hostRange,
                java.util.Hashtable users)
Adds range of addresses from which connection is allowed. Hashtable users should contain user names as keys and anything as values (value is not used and will be ignored).
Parameters:
hostRange - Range of ip addresses from which connection is allowed.
users - Hashtable of users for whom connection is allowed, or null to indicate that anybody is allowed to connect from the hosts within given range.

startSession

public ServerAuthenticator startSession(java.net.Socket s)
                                 throws java.io.IOException
Grants permission only to those users, who connect from one of the hosts registered with add(InetRange,Hashtable) and whose names, as reported by identd daemon, are listed for the host the connection came from.
Overrides:
startSession in class ServerAuthenticatorNone
Tags copied from interface: ServerAuthenticator
Parameters:
s - Accepted Socket.
Returns:
An instance of ServerAuthenticator to be used for this connection or null

checkRequest

public boolean checkRequest(ProxyMessage msg,
                            java.net.Socket s)
For SOCKS5 requests allways returns true. For SOCKS4 requests checks wether the user name supplied in the request corresponds to the name obtained from the ident daemon.

toString

public java.lang.String toString()
Get String representaion of the IdentAuthenticator.
Overrides:
toString in class java.lang.Object