|
AXL RADIUS Server API V3 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
ObjectPacketInfo
AuthInfo
Class to pass information to and from an Access-Request or Access-Challenge.
This is passed to the AccessImpl authenticate() method. It contains methods
for determining if the packet is an Access-Request isAccessRequest() or a response to
an Access-Challenge isAccessChallengeResponse().
Request attributes are accessed using getRequestAttributeList().
To determine if the packet's password matches the authoritative backing store password there are two options.
A) Encode the backing store's password and compare it to the packet's password using encode() or
B) decode the packet's password and compare it to the authoritative password using decode().
the cmp() method can be used to compare the two passwords.
Decoded passwords that will be compared to plain text password should have the trailing padding bytes
removed using the trim() method.
An Access-Request may result in several responses.
void authenticate(AuthInfo auth) {
...
AttributeList resp = new AttributeList();
resp.addAttribute(....);
auth.setReponseAttribute(resp);
auth.setAccessAccept();
return;
void authenticate(AuthInfo auth) {
...
AttributeList resp = new AttributeList();
resp.addAttribute(....);
// A State Attribute MUST be added. This is how an Access-Challenge will
// be recognized when the Access-Request reply is returned in response to the
// Access-Challenge. Typically the State attribute contains information for matching
// the Access-Challenge response with this Access-Request.
resp.addAttribute(Attribute.State, "State Attribute contents");
auth.setReponseAttribute(resp);
auth.setAccessChallenge();
return;
AccessRejectException are = new AccessRejectException("Some Reason for rejection");
// Attributes may be returned.
AttributeList alist = new AttributeList();
alist.addAttribute(Attribute.Reply_Message, "Bad Password");
are.setAttributes(alist);
throw are;
throw new AccessDropException("Some Reason for the drop");
AccessImpl| Field Summary | |
static int |
AUTHENTICATION_MSCHAP
Indicator that the authentication method is MS-CHAP, value = 1. |
static int |
AUTHENTICATION_MSCHAPV2
Indicator that the authentication method is MS-CHAP V2, value = 2. |
static int |
AUTHENTICATION_NEITHER
Indicator that the authentication method is neither MS-CHAP nor MS_CHAPV2, value = 3. |
static boolean |
NTHASH_PASSWORD
Indicates that the MSCHAPV2 password is an NT Hash of the plain text password. |
static boolean |
PLAINTEXT_PASSWORD
Indicates that the MSCHAPV2 password is plain text. |
| Fields inherited from class PacketInfo |
AUTH_LENGTH, AUTH_STATE_OBJECT |
| Method Summary | |
boolean |
cmp(byte[] a,
int startA,
byte[] b,
int startB,
int length)
Compare two byte arrays over a region. |
boolean |
cmpCHAP(byte[] plaintextPassword)
Decode and compare a CHAP challenge. |
boolean |
cmpMSCHAP(byte[] password)
Decode and compare an MS-CHAP or MS-CHAP 2 challenge. |
boolean |
cmpMSCHAP(byte[] password,
boolean ntHash)
Decode and compare an MS-CHAP or MS-CHAP 2 challenge. |
boolean |
cmpMSCHAPV2(byte[] ntHashPassword)
Decode and compare an MS-CHAP 2 challenge using a NT Hash password. |
Attribute |
createTunnelPassword(int tag,
byte[] password)
Create a Tunnel-Password attribute. |
EAPInfo |
getEAP()
Get the EAP packet information (if the EAP-Message attribute exists). |
InputStream |
getEAPTLSData()
Get EAP-TLS data. |
int |
getEAPTLSDataLength()
Get EAP-TLS data. |
AttributeList |
getState()
Get the State attribute(s) from the incoming attributes. |
Object |
getStateObject()
Get the persistent State attribute object from the request attribute list. |
Object |
getStateObject(byte code)
Get the persistent State attribute object from the request attribute list. |
boolean |
isAccessChallengeResponse()
Determine if this is a response to an Access-Challenge. |
boolean |
isAccessRequest()
Determine if this is an answer to an Access-Request. |
void |
setAccessAccept()
Indicate that the return packet is an Access-Accept. |
void |
setAccessChallenge()
Indicate that the return packet is an Access-Challenge. |
void |
setAccessReject()
Indicate that the return packet is an Access-Reject. |
void |
setMSCHAPErrorCode(String errorCode)
Set the MS-CHAP error code (Microsoft VSA containing the MS-CHAP-Error sub-attribute). |
void |
setStateObject(byte code,
Object o)
Set the persistent State object and create a State attribute tracking the object. |
void |
setStateObject(Object o)
Set the persistent State object and create a State attribute tracking the object. |
int |
testForMSCHAP()
Return an indicator that this is MS-CHAP or MS-CHAPV2. |
| Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int AUTHENTICATION_MSCHAP
public static final int AUTHENTICATION_MSCHAPV2
public static final int AUTHENTICATION_NEITHER
public static final boolean NTHASH_PASSWORD
public static final boolean PLAINTEXT_PASSWORD
| Method Detail |
public boolean cmp(byte[] a,
int startA,
byte[] b,
int startB,
int length)
a - Array A.startA - The start position for comparing A.b - Array B.startB - The start position for comparing B.length - Length of region.
public boolean cmpCHAP(byte[] plaintextPassword)
plaintextPassword - Plain text password to compare.
public boolean cmpMSCHAP(byte[] password)
throws AccessRejectException,
AccessDropException
password - Plaintext password to compare.
AccessRejectException - if the authentication failed. The Microsoft Vendor-Specific failure
message is placed in the exceptions attribute list.
AccessDropException - if there are any other problems.
public boolean cmpMSCHAP(byte[] password,
boolean ntHash)
throws AccessRejectException,
AccessDropException
password - Password to compare.
AccessRejectException - if the authentication failed. The Microsoft Vendor-Specific failure
message is placed in the exceptions attribute list.
AccessDropException - if there are any other problems.
public boolean cmpMSCHAPV2(byte[] ntHashPassword)
throws AccessRejectException,
AccessDropException
ntHashPassword - NT Hashed Password to compare.
AccessRejectException - if the authentication failed. The Microsoft Vendor-Specific failure
message is placed in the exceptions attribute list.
AccessDropException - if there are any other problems.
public Attribute createTunnelPassword(int tag,
byte[] password)
tag - Tunnel tag.password - Plain text password to encode.
If the password is longer than 255 bytes the client will probably not decode it properly.public EAPInfo getEAP()
public InputStream getEAPTLSData()
public int getEAPTLSDataLength()
public AttributeList getState()
public Object getStateObject()
This associates an object with a State attribute. The object is saved for a period of time or until explicitly removed.
This is used to associate a State attribute with some locally held information. For example the expected EAP data like the identifier, perhaps the original MD5 challenge, and the anticipated EAP type the client must send.
Note: The object is removed from the persistent session after it is collected. If the object must persist over another session it must be added again. You cannot access it more than once as it will return null on subsequent attempts.
RADIUSServer.setStateTTL(),
setStateObject()public Object getStateObject(byte code)
getStateObject in class PacketInfocode - Code for the particular type of state object to retrieve.
public boolean isAccessChallengeResponse()
public boolean isAccessRequest()
public void setAccessAccept()
public void setAccessChallenge()
public void setAccessReject()
public void setMSCHAPErrorCode(String errorCode)
The error code can be applied after a successful authentication but before the response packet has been sent. For example the name and password are correct but the account is locked out - in this case the error code might be set to "E=3D647 R=3D0".
The error code is set with the side effect that all Microsoft VSA's are dropped from the internally maintained AuthInfo response AttributeList and only the Microsoft VSA containing the MS-CHAP-Error will be sent. The new internal response list is returned for examination only.
A draft of RFC 2548 (Microsoft Vendor-specific RADIUS Attributes) includes the format of the error code and some typical RADIUS error codes. Typically the 'C' and 'V' fields are not present.
This field contains up to 48 octets of specially formatted ASCII
text, which is interpreted by the authenticating peer. The format
of this field is as follows:
"E=eeeeeeeeee R=r C=cccccccccccccccc V=vvvvvvvvvv"
where the "eeeeeeeeee" represents an ASCII representation of a
decimal error code of up to 10 digits corresponding to one of the
following:
646 ERROR_RESTRICTED_LOGON_HOURS
647 ERROR_ACCT_DISABLED
648 ERROR_PASSWD_EXPIRED
649 ERROR_NO_DIALIN_PERMISSION
691 ERROR_AUTHENTICATION_FAILURE
709 ERROR_CHANGING_PASSWORD
Implementations should deal with codes not on this list grace-
fully, however. Please note that (unlike PPP CHAP), the receipt
of some of these error codes (in particular, the
ERROR_PASSWD_EXPIRED code) will modify the subsequent operation of
the MS-CHAP protocol. The 'r' is a retry flag (set to '1' if a
retry is allowed and '0' otherwise), the "cccccccccccccccc" repre-
sents 16 hexadecimal digits ('0'-'F') specifying a new challenge
value, and the "vvvvvvvvvv" is a decimal version code signifying
the version of MS-CHAP supported by the server.
errorCode - Error code.
public void setStateObject(byte code,
Object o)
This is used to associate a State attribute with some locally held information. For example the expected EAP data like the identifier, perhaps the original MD5 challenge, and the anticipated EAP type the client must send. Code values of greater than 127 (negative code values) are for general use. Positive values are for AXL RADIUS server internal use.
setStateObject in class PacketInfocode - Code for this object.o - Object to persist.RADIUSServer.setStateTTL(),
getStateObject(byte code)public void setStateObject(Object o)
This is used to associate a State attribute with some locally held information. For example the expected EAP data like the identifier, perhaps the original MD5 challenge, and the anticipated EAP type the client must send.
o - Object to persist.RADIUSServer.setStateTTL(),
getStateObject()public int testForMSCHAP()
AUTHENTICATION_MSCHAP, AUTHENTICATION_MSCHAPV2,
or AUTHENTICATION_NEITHER.
|
AXL RADIUS Server API V3 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||