RADIUS Client API (V3)

com.theorem.radius3.eap
Class EAPClient

Object
  extended byEAPClient
Direct Known Subclasses:
EAPMD5Client

public class EAPClient
extends Object

Class to handle EAP information for a client.


Field Summary
 RADIUSClient radClient
           
 
Constructor Summary
EAPClient(byte[] name, InetAddress server, int port, String secret, int timeout, InetAddress nasIPAddress, String nasIdentifier)
          EAP client constructor.
EAPClient(byte[] name, RADIUSClient radClient, InetAddress nasIPAddress, String nasIdentifier)
          EAP client constructor.
EAPClient(RADIUSClient rc, AttributeList commonList)
          EAP client constructor.
 
Method Summary
 void addAttributes(AttributeList list)
          Add some attributes to be sent all the time.
 int createPacketId()
          Generate a random packet identifier.
 void debug(boolean enable)
          Enable client debugging.
 AttributeList getAttributes()
          Get the server response attributes.
 EAPPacket getEAPPacket()
          Get the EAP message packet in the response from the server.
 void logToDebug(String msg)
          Log a message to the debug file or stdout if debugging hasn't been set up.
 void reset(byte[] name)
          Reset the client for a new EAP request.
 int send(AttributeList requestList)
          Perform an authentication with the given attributes.
 boolean setDebug(boolean debug)
          Set debugging on or off.
 void setDebug(boolean debug, String fileName)
          Set debugging on or off.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

radClient

public RADIUSClient radClient
Constructor Detail

EAPClient

public EAPClient(RADIUSClient rc,
                 AttributeList commonList)
          throws EAPException
EAP client constructor. One of the nasIPAddress or the nasIdentifier should exist. It is recommended that both not be defined.

Parameters:
rc - RADIUSClient.
commonList - List of common attributes (User-Name, NAS-IP-Address, NAS-Identifier and so on).
Throws:
EAPException - if the server cannot be found.

EAPClient

public EAPClient(byte[] name,
                 RADIUSClient radClient,
                 InetAddress nasIPAddress,
                 String nasIdentifier)
          throws EAPException
EAP client constructor. One of the nasIPAddress or the nasIdentifier should exist. It is recommended that both not be defined.

Parameters:
name - User-Name attribute value.
radClient - Existing RADIUSClient.
nasIPAddress - Client NAS-IP-Address value or null.
nasIdentifier - Client NAS-Identifier value or null.
Throws:
EAPException - if the server cannot be found.

EAPClient

public EAPClient(byte[] name,
                 InetAddress server,
                 int port,
                 String secret,
                 int timeout,
                 InetAddress nasIPAddress,
                 String nasIdentifier)
          throws EAPException
EAP client constructor. One of the nasIPAddress or the nasIdentifier should exist. It is recommended that both not be defined.

Parameters:
name - User-Name attribute value.
server - RADIUS server address.
port - RADIUS server port
secret - RADIUS server shared secret.
timeout - Packet round trip timeout in milliseconds.
nasIPAddress - Client NAS-IP-Address value or null.
nasIdentifier - Client NAS-Identifier value or null.
Throws:
EAPException - if the server cannot be found.
Method Detail

reset

public final void reset(byte[] name)
                 throws EAPException
Reset the client for a new EAP request. This resets the User-Name attribute and RADIUS client.

Throws:
EAPException - if the client cannot be started or reset.

debug

public final void debug(boolean enable)
Enable client debugging.

Parameters:
enable - True to enable debugging or false to disable.

addAttributes

public final void addAttributes(AttributeList list)
Add some attributes to be sent all the time. By default the User-Name, NAS-IP-Address, Message-Authenticator and EAP-Message are sent. If there are additional attributes to be sent they're added here.

Parameters:
list - Attribute list holding extra attributes.

send

public final int send(AttributeList requestList)
               throws EAPException
Perform an authentication with the given attributes. This method does not perform retries.

Parameters:
requestList - AttributeList containing EAP-Message and Message-Authenticator attributes.
Returns:
packet type from server, either PacketType.Access-Challenge,PacketType.Access-Reject,. or PacketType.Access-Accept.
Throws:
EAPException - if there's a problem.

getAttributes

public final AttributeList getAttributes()
Get the server response attributes.

Returns:
response attributes.

getEAPPacket

public final EAPPacket getEAPPacket()
                             throws EAPException
Get the EAP message packet in the response from the server.

Returns:
EAPPacket.
Throws:
EAPException - if there are no response attributes.

createPacketId

public final int createPacketId()
Generate a random packet identifier.

Returns:
packet ID.

setDebug

public final void setDebug(boolean debug,
                           String fileName)
                    throws IOException
Set debugging on or off. Debugging information is written to a file or the standard output. The information includes the packet contents, attributes, and the reason for the Access_BadPacket result from the authenticate() and accounting() methods. The reason is in the title of the packet display.

Parameters:
debug - Use true to enable debugging, false to disable debugging.
fileName - Debugging information will be written to this file. If the file name is null the standard output is used.
Throws:
IOException - if there's a problem opening the debugging output.
See Also:
logToDebug()

setDebug

public final boolean setDebug(boolean debug)
Set debugging on or off. Debugging information is written to the standard output. The information includes the packet contents, attributes, and the reason for the Access_BadPacket result from the authenticate() and accounting() methods. The reason is in the title of the packet display. If the output is sent to a file the file is overwritten each time the class is instantiated.

Parameters:
debug - Use true to enable debugging, false to disable debugging.
Returns:
False if the standard output can't be opened.
See Also:
PacketType.Access_BadPacket

logToDebug

public final void logToDebug(String msg)
Log a message to the debug file or stdout if debugging hasn't been set up. This is used to log message to the same place the RADIUSClient logs.

Parameters:
msg - Message to write.
See Also:
setDebug()

RADIUS Client API (V3)

Submit a bug report or feature request

Copyright 1998-2008 AXL Software. PO Box 97, Viola, Delaware 19979, U.S.A. All Rights Reserved.