|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.jradiusclient.RadiusClient
Released under the LGPL
This class provides basic functionality required to implement a NAS as
defined by the RADIUS protocol as specified in RFC 2865 and RFC 2866.
This implementation is stateless and not thread safe, i.e. since the
user name could be changed by the current thread or any other thread,
it is difficult to ensure that the responseAttributes correlate to the
request we think we are dealing with. It is up to the user of this class
to ensure these things at this point. A future release may change this class
to a stateful, threadsafe object, but it works for now. Users of this class
must also manage building their own request attributes and submitting them with
their call to authenticate. For example a programmer using this library, wanting
to do chap authentication needs to generate the random challenge, send it to
the user, who generates the MD5 of
Constructor Summary | |
RadiusClient(java.lang.String hostname,
int authPort,
int acctPort,
java.lang.String sharedSecret)
Constructor allows the user to specify an alternate port for the radius server |
|
RadiusClient(java.lang.String hostname,
int authPort,
int acctPort,
java.lang.String sharedSecret,
int sockTimeout)
Constructor allows the user to specify an alternate port for the radius server |
|
RadiusClient(java.lang.String hostname,
java.lang.String sharedSecret)
Constructor - uses the default port 1812 for authentication and 1813 for accounting |
Method Summary | |
RadiusPacket |
account(RadiusPacket requestPacket)
This method performs the job of sending accounting information for the current user to the radius accounting server. |
RadiusPacket |
authenticate(RadiusPacket accessRequest)
This method performs the job of authenticating the given RadiusPacket against
the radius server. |
RadiusPacket |
authenticate(RadiusPacket accessRequest,
int retries)
This method performs the job of authenticating the given RadiusPacket against
the radius server. |
protected void |
closeSocket()
closes the socket |
boolean |
equals(java.lang.Object object)
Compares the specified Object with this RadiusClient
for equality. |
void |
finalize()
overrides finalize to close socket and then normal finalize on super class |
int |
getAcctPort()
This method returns the current port to be used for accounting |
int |
getAuthPort()
This method returns the current port to be used for authentication |
java.lang.String |
getHostname()
This method returns the current Host Name to be used for RADIUS authentication or accounting |
java.lang.String |
getSharedSecret()
This method returns the current secret value that the Radius Client shares with the RADIUS Server. |
int |
getTimeout()
This method returns the current timeout period on a recieve of a response from the RADIUS Server. |
int |
hashCode()
|
java.lang.String |
toString()
This method returns a string representation of this RadiusClient . |
Methods inherited from class java.lang.Object |
clone, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RadiusClient(java.lang.String hostname, java.lang.String sharedSecret) throws RadiusException, InvalidParameterException
hostname
- java.lang.StringsharedSecret
- java.lang.String
java.net.SocketException
- If we could not create the necessary socket
java.security.NoSuchAlgorithmException
- If we could not get an
instance of the MD5 algorithm.
InvalidParameterException
- If an invalid hostname
(null or empty string), an invalid port
(port < 0 or port > 65536) or an invalid
shared secret (null, shared secret can be
empty string) is passed in.
RadiusException
public RadiusClient(java.lang.String hostname, int authPort, int acctPort, java.lang.String sharedSecret) throws RadiusException, InvalidParameterException
hostname
- java.lang.StringauthPort
- int the port to use for authentication requestsacctPort
- int the port to use for accounting requestssharedSecret
- java.lang.String
java.net.SocketException
- If we could not create the necessary socket
java.security.NoSuchAlgorithmException
- If we could not get an
instance of the MD5 algorithm.
InvalidParameterException
- If an invalid hostname
(null or empty string), an invalid
port ( port < 0 or port > 65536)
or an invalid shared secret (null, shared
secret can be empty string) is passed in.
RadiusException
public RadiusClient(java.lang.String hostname, int authPort, int acctPort, java.lang.String sharedSecret, int sockTimeout) throws RadiusException, InvalidParameterException
hostname
- java.lang.StringauthPort
- int the port to use for authentication requestsacctPort
- int the port to use for accounting requestssharedSecret
- java.lang.String
RadiusException
- If we could not create the necessary socket,
If we could not get an instance of the MD5 algorithm, or the hostname did not pass validation
InvalidParameterException
- If an invalid hostname
(null or empty string), an invalid
port ( port < 0 or port > 65536)
or an invalid shared secret (null, shared
secret can be empty string) is passed in.Method Detail |
public RadiusPacket authenticate(RadiusPacket accessRequest) throws RadiusException, InvalidParameterException
RadiusPacket
against
the radius server.
RadiusException
InvalidParameterException
public RadiusPacket authenticate(RadiusPacket accessRequest, int retries) throws RadiusException, InvalidParameterException
RadiusPacket
against
the radius server.
RadiusException
InvalidParameterException
public RadiusPacket account(RadiusPacket requestPacket) throws InvalidParameterException, RadiusException
requestPacket
- Any request attributes to add to the accounting packet.
RadiusException
InvalidParameterException
public java.lang.String getHostname()
public int getAuthPort()
public int getAcctPort()
public java.lang.String getSharedSecret()
public int getTimeout()
public java.lang.String toString()
RadiusClient
.
toString
in class java.lang.Object
public boolean equals(java.lang.Object object)
RadiusClient
for equality. Returns true if the given object is also a
RadiusClient
and the two RadiusClient
have the same host, port, sharedSecret & username.
equals
in class java.lang.Object
object
- Object to be compared for equality with this
RadiusClient
.
RadiusClient
.public int hashCode()
hashCode
in class java.lang.Object
RadiusClient
protected void closeSocket()
public void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |