RADIUS Client API (V3)

com.theorem.radius3.dmcoaclient
Class DMCOAReceiver

Object
  extended byDMCOAReceiver
All Implemented Interfaces:
Runnable

public final class DMCOAReceiver
extends Object
implements Runnable

Class to act as a DM / COA RADIUS packet receiver.

This DMCOA receiver may act with in concert with a RADIUSClient or without one. If a RADIUSClient is used the configuration parameters for the DMCOAReceiver are taken from the RADIUSClient and debugging may be written to a log file. In the stand alone mode the server must be provisioned with the server secret and RADIUS server address, the maximum packet size is fixed at the standard 4096 bytes, and debugging is limited to the standard output. The advantage for stand alone is that there is no RADIUS client port opened and this thread can be run independently under your program's control. Stand alone operation can also allow DM/COA requests to be received for a number of clients using a single server. It cannot be used for multiple RADIUS servers.

A client expecting a Disconnect-Request or CoA-Request message must use this class to start a receiver thread. The thread uses a callback mechanism to alert the application that either of the two messages has been received. The callback will also return an ACK or NAK to the server making the request.

Typical usage:

 // Create the RADIUS client.
 RADIUSClient rc = new RADIUSClient(radiusServer, ...);
 // Create the DMCOACallback.
 DMCOACallback dmc = new MyCallback();
 // Start the DMCOA receiver.
 DMCOAReceiver recvr = new DMCOAReceiver(rc, 0, dmc);
 recvr.start();
 // Perform normal authentication & accounting.
 ...
 // At the end of the application stop the reciever
 // and close the RADIUSClient.
 recvr.stop();
 

The receiver make normal RADIUS security precautions. It requires that the request packet come from the RADIUSClient's server's address, from the correct port, and the packet is either the Disconnect-Request or the CoA-Request. The attributes must be formatted correctly.

If required attributes are missing an error is automatically sent to the server with an Error-Cause attribute with a value of 402 (Missing Attribute).


Field Summary
static int DEFAULT_WINDOW
          Suggested default Event-Timestamp protection window - 300 seconds.
 
Constructor Summary
DMCOAReceiver(InetAddress remoteServer, byte[] radiusSecret, boolean debugEnabled, int port, DMCOACallback callback)
          DM / COA packet receiver without RADIUSClient running in stand alone mode.
 
Method Summary
 void addDictionary(RADIUSDictionary dict)
          Add a dictionary to the DMCOA client's knowledge of vendor Id's and attribute names / types.
 void run()
          Run method for Runnable.
 void start()
          Start the DM / COA receiver.
 void stop()
          Stop the DM / COA receiver.
 boolean useEventTimestamp(boolean enable, int timeWindow)
          Enable Event-Timestamp security.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WINDOW

public static final int DEFAULT_WINDOW
Suggested default Event-Timestamp protection window - 300 seconds.

See Also:
Constant Field Values
Constructor Detail

DMCOAReceiver

public DMCOAReceiver(InetAddress remoteServer,
                     byte[] radiusSecret,
                     boolean debugEnabled,
                     int port,
                     DMCOACallback callback)
DM / COA packet receiver without RADIUSClient running in stand alone mode.

This single thread receiver is able to receive CoA-Requests and Disconnect-Requests. There is a callback class used to notifiy a program that a packet has been received. Request attributes and the packet type are passed to the callback class.

Parameters:
remoteServer - RADIUS server address that will be sending DM/COA packets.
radiusSecret - RADIUS server secret.
debugEnabled - Indicator, if set to true, that that debugging will be displayed.
port - Port this receiver will use. If 0 the default port of RADIUSClient.DMCOA_PORT will be used.
callback - The DMCOACallback class.
Method Detail

start

public void start()
           throws RADIUSException
Start the DM / COA receiver. This server is started as a daemon thread.

Throws:
RADIUSException - if the receiver fails to start in a reasonable length of time.

stop

public void stop()
Stop the DM / COA receiver.


useEventTimestamp

public boolean useEventTimestamp(boolean enable,
                                 int timeWindow)
Enable Event-Timestamp security.

This security measure help prevent replay attacks by making sure that the Event-Timestamp Attribute current. If it is not the message will be discarded. If enable a packet lacking an Event-Timestamp will be discarded.

Parameters:
enable - Enable or disable the event timestamp check.
timeWindow - Maximum time that may elapse between the Event-Timestamp attribute value and the current time. This requires that all computers use sychrnonized time. This is measured in seconds. The suggested value is 300 seconds or DEFAULT_WINDOW.
Returns:
the last enabled state.

addDictionary

public void addDictionary(RADIUSDictionary dict)
Add a dictionary to the DMCOA client's knowledge of vendor Id's and attribute names / types. The server is aware of standard RADIUS attributes.

The dictionary aids the server in displaying attribute names and values.

Parameters:
dict - RADIUSDictionary.

run

public void run()
Run method for Runnable.

Specified by:
run in interface Runnable

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.