|
AXL RADIUS Server API V3 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
ObjectAttributeList
Provide a list of Attributes and provide the means to perform simple operations on the list.
| Constructor Summary | |
AttributeList()
Construct an empty list. |
|
AttributeList(Attribute[] list)
Construct a list from an array of attributes. |
|
AttributeList(AttributeList list)
Construct a list from a list of attributes. |
|
| Method Summary | |
void |
addAttribute(Attribute att)
Add an attribute to the list. |
void |
addAttribute(int tag)
Add an attribute with no value to the list. |
void |
addAttribute(int tag,
byte[] data)
Add an attribute to the list. |
void |
addAttribute(int tag,
Date value)
Add an attribute to the list. |
void |
addAttribute(int tag,
InetAddress value)
Add an attribute to the list. |
void |
addAttribute(int tag,
int value)
Add an attribute to the list. |
void |
addAttribute(int tag,
int tunnelTag,
byte[] data)
Add a tunneling attribute to the list. |
void |
addAttribute(int tag,
int tunnelTag,
InetAddress data)
Add a tunneling attribute to the list. |
void |
addAttribute(int tag,
int tunnelTag,
int data)
Add a tunneling attribute to the list. |
void |
addAttribute(int tag,
int tunnelTag,
String data)
Add a tunneling attribute to the list. |
void |
addAttribute(int tag,
String value)
Add an attribute to the list. |
void |
addAttribute(VendorSpecific vs)
Add an attribute to the list. |
void |
clearAttributes()
Clear all attributes. |
void |
createCHAPChallenge(byte[] plaintextPassword)
Create an 16 byte CHAP-Challenge / CHAP-Password for a plain text password. |
byte[] |
createRadiusAttributeBlock()
Create a RADIUS attribute block from the attribute list. |
int |
dataSize()
Return the current data size of all attributes. |
void |
decodeAll(byte[] secret,
byte[] authenticator)
Decode all attributes in this AttributeList using a two byte SALT. |
void |
delete(int type)
Delete an attribute. |
void |
deleteAll(int type)
Delete all attributes of a given type.. |
Enumeration |
elements()
Provide an enumeration of attributes. |
void |
encodeAll(byte[] secret,
byte[] authenticator)
Encode all attributes in this AttributeList using a two byte SALT. |
boolean |
exists(int tag)
Determine if an attribute type exists. |
int |
findPosition(int type)
Find the starting position of an attribute in a RADIUS data block. |
byte[][] |
getAllBinaryAttributes(int type)
Return all binary attributes of a particular attribute type. |
String[] |
getAllStringAttributes(int type)
Return all matching String attributes of the given attribute type. |
Attribute[] |
getAttributeArray(int tag)
Get an array of Attributes of a specific type. |
Attribute |
getAttributeAt(int n)
Get the N'th attribute in the list. |
AttributeList |
getAttributeList(int type)
Get a list of specific attributes. |
Attribute[] |
getAttributes()
Get a list of attributes. |
byte[] |
getBinaryAttribute(int type)
Return a binary attribute of a given type. |
int |
getInt(int type)
Get an integer value (four octets) from an attribute. |
InetAddress |
getIPAttribute(int tag)
Return an IP address from a 4 or 16 byte binary attribute (like NAS-IP-Address). |
int |
getShort(int type)
Get a short value (two octets) from an attribute. |
int |
getSize()
Return the size of the current list of attributes. |
String |
getStringAttribute(int type)
Return a particular string attribute. |
VendorSpecific[] |
getVendorSpecific(int vendor)
Get a list of Vendor-Specific attributes by Vendor Id. |
Attribute[] |
getVendorSpecific(int vendor,
int vendorTag)
Get a list of Vendor-Specific attributes by Vendor Id narrowed down to a particular tag. |
boolean |
loadRadiusAttributes(byte[] dataBlock,
int offset,
int len)
Creates an attribute list from a raw attribute block. |
boolean |
loadRadiusAttributes(byte[] dataBlock,
int offset,
int len,
boolean allowEmpty)
Creates an attribute list from a raw attribute block perhaps allowing empty attributes. |
void |
mergeAttributes(Attribute[] a)
Merge an attribute array with the current AttributeList. |
void |
mergeAttributes(AttributeList a)
Merge another AttributeList with the current AttributeList. |
AttributeList |
mergeAttributes(AttributeList a,
Attribute[] b)
Merge two AttributeLists and return the resulting AttributeList. |
AttributeList |
mergeAttributes(AttributeList a,
AttributeList b)
Merge two attribute lists and return the resulting new AttributeList. |
static InetAddress |
parseIPAttribute(byte[] addr)
Parse an IP address from a IPv4 (4 byte) binary attribute (like NAS-IP-Address). |
static InetAddress |
parseIPv6Attribute(byte[] addr)
Parse an IP address from a 16 byte binary attribute (like NAS-IPv6-Address). |
boolean |
setAttribute(int type,
byte[] data)
Reset the value of an existing attribute. |
void |
setAttributeAt(int n,
Attribute a)
Set the N'th attribute in the list. |
int |
size()
Get a count of attributes. |
int |
size(int tag)
Get a count the attributes of this type. |
static String |
toHexString(byte[] buf)
Convert a byte buffer to a hex string. |
String |
toString()
Display the attributes in a string. |
static byte[] |
toUTF8(String s)
Convert a string to bytes encoded using UTF8. |
| Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AttributeList()
public AttributeList(Attribute[] list)
list - array of attributes.public AttributeList(AttributeList list)
list - AttributeList of attributes.| Method Detail |
public final void addAttribute(Attribute att)
att - The attribute to add.public final void addAttribute(int tag)
tag - The attribute tag value.
public final void addAttribute(int tag,
byte[] data)
tag - The attribute tag value.data - The attribute data
public final void addAttribute(int tag,
Date value)
tag - The attribute tag value.value - The attribute Date value
public final void addAttribute(int tag,
InetAddress value)
tag - The attribute tag value.value - The attribute value as an InetAddress.
public final void addAttribute(int tag,
int value)
tag - The attribute tag value.value - The attribute int value
public final void addAttribute(int tag,
int tunnelTag,
byte[] data)
tag - The attribute tag value.tunnelTag - The tunnel tag.data - The attribute data
public final void addAttribute(int tag,
int tunnelTag,
InetAddress data)
tag - The attribute tag value.tunnelTag - The tunnel tag.data - The attribute data
public final void addAttribute(int tag,
int tunnelTag,
int data)
tag - The attribute tag value.tunnelTag - The tunnel tag.data - The attribute data
public final void addAttribute(int tag,
int tunnelTag,
String data)
tag - The attribute tag value.tunnelTag - The tunnel tag.data - The attribute data
public final void addAttribute(int tag,
String value)
tag - The attribute tag value.value - The attribute String value using UTF8 character encoding.public final void addAttribute(VendorSpecific vs)
vs - VendorSpecific attribute.public final void clearAttributes()
public final void createCHAPChallenge(byte[] plaintextPassword)
plaintextPassword - Password.
public byte[] createRadiusAttributeBlock()
throws ArrayIndexOutOfBoundsException
ArrayIndexOutOfBoundsException - if the attributes are mangled.loadRadiusAttributes(byte[], int, int)public final int dataSize()
public final void decodeAll(byte[] secret,
byte[] authenticator)
To decode a single attribute please use saltDecode().
This is an example of an attribute before decoding.
0 1 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
| Type | Length | SALT
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
| SALT | Vendor encoded data ...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
secret - Shared RADIUS secret.authenticator - RADIUS authenticator.public final void delete(int type)
type - Attribute type.public final void deleteAll(int type)
type - Attribute type.public final Enumeration elements()
for (Enumeration e = aList.elements() ; e.hasMoreElements() ;) {
Attribute a = (Attribute)e.nextElement();
}
public final void encodeAll(byte[] secret,
byte[] authenticator)
This is what an attribute will look like after encoding.
0 1 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
| Type | Length | SALT
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
| SALT | Vendor encoded data...
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
To encode a single attribute please use saltDecode().
Cisco refers to this format as 'Encrypted String VSA Format'.
secret - Shared RADIUS secret.authenticator - RADIUS authenticator.public final boolean exists(int tag)
tag - Type of attribute.
public final int findPosition(int type)
type - Attribute number.
public final byte[][] getAllBinaryAttributes(int type)
type - attribute type.
getBinaryAttribute(int)public final String[] getAllStringAttributes(int type)
type - Attribute type.
getStringAttribute(int)public final Attribute[] getAttributeArray(int tag)
tag - Attribute tag.
public final Attribute getAttributeAt(int n)
n - position in list.
setAttributeAt()public final AttributeList getAttributeList(int type)
type - Type of attribute to select.
public final Attribute[] getAttributes()
public final byte[] getBinaryAttribute(int type)
type - attribute type.
getBinaryAttribute(int)
public final int getInt(int type)
throws ArrayIndexOutOfBoundsException
type - attribute type.
ArrayIndexOutOfBoundsException - if there are no attributes present or the attribute type
cannot be found.
Use exists() to determine if the attribute exists.size(int)public final InetAddress getIPAttribute(int tag)
tag - attribute tag.
public final int getShort(int type)
throws ArrayIndexOutOfBoundsException
type - attribute type.
exists() to determine if the attribute exists.
ArrayIndexOutOfBoundsExceptionpublic final int getSize()
public final String getStringAttribute(int type)
type - Attribute type to extract.
getAllStringAttributes(int)public final VendorSpecific[] getVendorSpecific(int vendor)
vendor - Vendor Id.
public final Attribute[] getVendorSpecific(int vendor,
int vendorTag)
vendor - Vendor Id.vendorTag - Vendor-Specific tag number.
public final boolean loadRadiusAttributes(byte[] dataBlock,
int offset,
int len)
throws ArrayIndexOutOfBoundsException
Loads raw data into an attribute list. Useful for loading Vendor-Specific attributes in a TLV format from the Vendor-Specific data.
dataBlock - Radius attribute data blockoffset - Offset into bufferlen - length of RADIUS attribute data block.
ArrayIndexOutOfBoundsException - when an attribute block is corrupt or there is an empty attribute
present.createRadiusAttributeBlock()
public final boolean loadRadiusAttributes(byte[] dataBlock,
int offset,
int len,
boolean allowEmpty)
throws ArrayIndexOutOfBoundsException
Loads raw data into an attribute list. Useful for loading Vendor-Specific attributes in a TLV format from the Vendor-Specific data.
dataBlock - Radius attribute data blockoffset - Offset into bufferlen - Length of RADIUS attribute data block.allowEmpty - If true empty attributes are permitted. If false empty attributes will throw
an ArrayIndexOutOfBoundsException.
ArrayIndexOutOfBoundsException - when an attribute block is corrupt or there is an empty attribute
present (not thrown if allowEmpty is set to true).createRadiusAttributeBlock()public final void mergeAttributes(Attribute[] a)
a - Attribute array a.
public final void mergeAttributes(AttributeList a)
a - Attribute list a.
public final AttributeList mergeAttributes(AttributeList a,
Attribute[] b)
a - Attribute list ab - Attribute array b
public final AttributeList mergeAttributes(AttributeList a,
AttributeList b)
a - Attribute list a.b - Attribute list b.
public static final InetAddress parseIPAttribute(byte[] addr)
public static final InetAddress parseIPv6Attribute(byte[] addr)
addr - Byte representation of an IP address.
public final boolean setAttribute(int type,
byte[] data)
type - Attribute type.data - binary data replacement value
public final void setAttributeAt(int n,
Attribute a)
n - position in list.a - Replacement attributegetAttributeAt()public final int size()
public final int size(int tag)
tag - attribute tag.
public static final String toHexString(byte[] buf)
buf - Byte array.
public String toString()
public static final byte[] toUTF8(String s)
s - String to convert to a UTF8 byte array.
|
AXL RADIUS Server API V3 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||