net.jradius.client
Class RadiusClientTransport

java.lang.Object
  extended by net.jradius.client.RadiusClientTransport
Direct Known Subclasses:
UDPClientTransport

public abstract class RadiusClientTransport
extends Object


Field Summary
protected  int acctPort
           
protected  int authPort
           
static int defaultTimeout
           
protected  InetAddress localInetAddress
           
protected  RadiusClient radiusClient
           
protected  InetAddress remoteInetAddress
           
protected  String sharedSecret
           
protected  int socketTimeout
           
protected  TransportStatusListener statusListener
           
 
Constructor Summary
RadiusClientTransport()
           
 
Method Summary
abstract  void close()
           
protected  void generateMessageAuthenticator(RadiusPacket request)
          Add the Message-Authentivator attribute to the given RadiusPacket
 int getAcctPort()
           
 int getAuthPort()
           
 InetAddress getLocalInetAddress()
           
 RadiusClient getRadiusClient()
           
 InetAddress getRemoteInetAddress()
           
 String getSharedSecret()
           
 int getSocketTimeout()
           
protected abstract  RadiusResponse receive(RadiusRequest req)
           
protected abstract  void send(RadiusRequest req, int attempt)
           
 RadiusResponse sendReceive(RadiusRequest p, int retries)
          Send and receive RadiusPackets
 void setAcctPort(int acctPort)
           
 void setAuthPort(int authPort)
           
 void setLocalInetAddress(InetAddress localInetAddress)
           
 void setRadiusClient(RadiusClient radiusClient)
           
 void setRemoteInetAddress(InetAddress remoteInetAddress)
           
 void setSharedSecret(String sharedSecret)
           
 void setSocketTimeout(int socketTimeout)
           
 void setStatusListener(TransportStatusListener statusListener)
           
static boolean verifyAuthenticator(byte[] requestAuth, RadiusResponse reply, String sharedSecret)
           
 boolean verifyAuthenticator(RadiusRequest request, RadiusResponse reply)
          Verify the RADIUS Authenticator
static boolean verifyAuthenticator(RadiusRequest request, RadiusResponse reply, String sharedSecret)
           
static boolean verifyMessageAuthenticator(byte[] requestAuth, RadiusResponse reply, String sharedSecret, boolean required)
           
 boolean verifyMessageAuthenticator(RadiusRequest request, RadiusResponse reply, boolean required)
          Verify the Message-Authenticator based on RFC 2869
static boolean verifyMessageAuthenticator(RadiusRequest request, RadiusResponse reply, String sharedSecret, boolean required)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localInetAddress

protected InetAddress localInetAddress

remoteInetAddress

protected InetAddress remoteInetAddress

sharedSecret

protected String sharedSecret

authPort

protected int authPort

acctPort

protected int acctPort

defaultTimeout

public static final int defaultTimeout
See Also:
Constant Field Values

socketTimeout

protected int socketTimeout

radiusClient

protected RadiusClient radiusClient

statusListener

protected TransportStatusListener statusListener
Constructor Detail

RadiusClientTransport

public RadiusClientTransport()
Method Detail

send

protected abstract void send(RadiusRequest req,
                             int attempt)
                      throws Exception
Throws:
Exception

receive

protected abstract RadiusResponse receive(RadiusRequest req)
                                   throws Exception
Throws:
Exception

close

public abstract void close()

sendReceive

public RadiusResponse sendReceive(RadiusRequest p,
                                  int retries)
                           throws RadiusException
Send and receive RadiusPackets

Parameters:
p - The RadiusPacket being sent
a - The Internet Address sending to
port - The port sending to
retries - Number of times to retry (without response)
Returns:
Returns the returned RadiusPacket
Throws:
RadiusException

generateMessageAuthenticator

protected void generateMessageAuthenticator(RadiusPacket request)
                                     throws IOException
Add the Message-Authentivator attribute to the given RadiusPacket

Parameters:
request - The RadiusPacket
Throws:
IOException

verifyMessageAuthenticator

public boolean verifyMessageAuthenticator(RadiusRequest request,
                                          RadiusResponse reply,
                                          boolean required)
Verify the Message-Authenticator based on RFC 2869

Parameters:
request - The RADIUS request send
reply - The RADIUS reply received
required - Whether or not the Message-Authenticator is required (as for EAP)
Returns:
Returns true if there is no Message-Authenticator or if it present and correct

verifyMessageAuthenticator

public static boolean verifyMessageAuthenticator(RadiusRequest request,
                                                 RadiusResponse reply,
                                                 String sharedSecret,
                                                 boolean required)

verifyMessageAuthenticator

public static boolean verifyMessageAuthenticator(byte[] requestAuth,
                                                 RadiusResponse reply,
                                                 String sharedSecret,
                                                 boolean required)

verifyAuthenticator

public boolean verifyAuthenticator(RadiusRequest request,
                                   RadiusResponse reply)
Verify the RADIUS Authenticator

Parameters:
request - The RADIUS request send
reply - The RADIUS reply received
Returns:
Returns true if there is no Authenticator is correct

verifyAuthenticator

public static boolean verifyAuthenticator(RadiusRequest request,
                                          RadiusResponse reply,
                                          String sharedSecret)

verifyAuthenticator

public static boolean verifyAuthenticator(byte[] requestAuth,
                                          RadiusResponse reply,
                                          String sharedSecret)

getRemoteInetAddress

public InetAddress getRemoteInetAddress()

setRemoteInetAddress

public void setRemoteInetAddress(InetAddress remoteInetAddress)

getLocalInetAddress

public InetAddress getLocalInetAddress()

setLocalInetAddress

public void setLocalInetAddress(InetAddress localInetAddress)

getSharedSecret

public String getSharedSecret()

setSharedSecret

public void setSharedSecret(String sharedSecret)

getAuthPort

public int getAuthPort()

setAuthPort

public void setAuthPort(int authPort)

getAcctPort

public int getAcctPort()

setAcctPort

public void setAcctPort(int acctPort)

getSocketTimeout

public int getSocketTimeout()
Returns:
Returns the socket timeout (in seconds)

setSocketTimeout

public void setSocketTimeout(int socketTimeout)
Parameters:
socketTimeout - The socket timeout (in seconds)

getRadiusClient

public RadiusClient getRadiusClient()

setRadiusClient

public void setRadiusClient(RadiusClient radiusClient)

setStatusListener

public void setStatusListener(TransportStatusListener statusListener)


Copyright © 2011 Coova Technologies, LLC, All Rights Reserved.