Class VendorSpecificAttribute
java.lang.Object
org.tinyradius.core.attribute.type.OctetsAttribute
org.tinyradius.core.attribute.type.VendorSpecificAttribute
- All Implemented Interfaces:
AttributeHolder<VendorSpecificAttribute>
,RadiusAttribute
public class VendorSpecificAttribute extends OctetsAttribute implements AttributeHolder<VendorSpecificAttribute>
Vendor-Specific attribute. Both an attribute itself and an attribute container for sub-attributes.
-
Field Summary
Fields Modifier and Type Field Description static byte
VENDOR_SPECIFIC
-
Constructor Summary
Constructors Constructor Description VendorSpecificAttribute(Dictionary dictionary, int vendorId, int attributeId, byte[] data)
VendorSpecificAttribute(Dictionary dictionary, int vendorId, int attributeId, java.lang.String data)
VendorSpecificAttribute(Dictionary dictionary, int childVendorId, java.util.List<RadiusAttribute> attributes)
Constructs a new Vendor-Specific attribute -
Method Summary
Modifier and Type Method Description RadiusAttribute
decode(byte[] requestAuth, java.lang.String secret)
Decodes attribute.RadiusAttribute
encode(byte[] requestAuth, java.lang.String secret)
Encodes attribute.java.util.List<RadiusAttribute>
flatten()
Returns set of all nested attributes if contains sub-attributes, otherwise singleton set of current attribute.java.util.List<RadiusAttribute>
getAttributes()
int
getChildVendorId()
java.lang.String
toString()
VendorSpecificAttribute
withAttributes(java.util.List<RadiusAttribute> attributes)
Methods inherited from class org.tinyradius.core.attribute.type.OctetsAttribute
equals, getDictionary, getTag, getType, getValue, getValueString, getVendorId, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tinyradius.core.attribute.AttributeHolder
addAttribute, addAttribute, addAttribute, decodeAttributes, encodeAttributes, filterAttributes, filterAttributes, filterAttributes, filterAttributes, getAttribute, getAttribute, getAttributeBytes, getDictionary, removeAttribute, removeAttributes, removeLastAttribute
Methods inherited from interface org.tinyradius.core.attribute.type.RadiusAttribute
getAttributeName, getAttributeTemplate, getTagBytes, isEncoded, toByteArray
-
Field Details
-
VENDOR_SPECIFIC
public static final byte VENDOR_SPECIFIC- See Also:
- Constant Field Values
-
-
Constructor Details
-
VendorSpecificAttribute
public VendorSpecificAttribute(Dictionary dictionary, int vendorId, int attributeId, java.lang.String data)- Parameters:
dictionary
- dictionary to use for (sub)attributesvendorId
- ignored, VSAs should always be -1 (top level attribute)attributeId
- ignored, should always be Vendor-Specific (26)data
- data as hex to parse for childVendorId and sub-attributes
-
VendorSpecificAttribute
- Parameters:
dictionary
- dictionary to use for (sub)attributesvendorId
- ignored, VSAs should always be -1 (top level attribute)attributeId
- ignored, should always be Vendor-Specific (26)data
- data to parse for childVendorId and sub-attributes
-
VendorSpecificAttribute
public VendorSpecificAttribute(Dictionary dictionary, int childVendorId, java.util.List<RadiusAttribute> attributes)Constructs a new Vendor-Specific attribute- Parameters:
dictionary
- dictionary to use for (sub)attributeschildVendorId
- vendor ID of the sub-attributesattributes
- sub-attributes held
-
-
Method Details
-
getChildVendorId
public int getChildVendorId()- Specified by:
getChildVendorId
in interfaceAttributeHolder<VendorSpecificAttribute>
- Returns:
- VendorId to restrict (sub)attributes, or -1 for top level
-
getAttributes
- Specified by:
getAttributes
in interfaceAttributeHolder<VendorSpecificAttribute>
- Returns:
- list of RadiusAttributes
-
withAttributes
- Specified by:
withAttributes
in interfaceAttributeHolder<VendorSpecificAttribute>
-
flatten
Description copied from interface:RadiusAttribute
Returns set of all nested attributes if contains sub-attributes, otherwise singleton set of current attribute.- Specified by:
flatten
in interfaceRadiusAttribute
- Returns:
- List of RadiusAttributes
-
encode
public RadiusAttribute encode(byte[] requestAuth, java.lang.String secret) throws RadiusPacketExceptionDescription copied from interface:RadiusAttribute
Encodes attribute. Must be idempotent.- Specified by:
encode
in interfaceRadiusAttribute
- Overrides:
encode
in classOctetsAttribute
- Parameters:
requestAuth
- (corresponding) request packet authenticatorsecret
- shared secret to encode with- Returns:
- attribute with encoded data
- Throws:
RadiusPacketException
- errors encoding attribute
-
decode
public RadiusAttribute decode(byte[] requestAuth, java.lang.String secret) throws RadiusPacketExceptionDescription copied from interface:RadiusAttribute
Decodes attribute. Must be idempotent.- Specified by:
decode
in interfaceRadiusAttribute
- Parameters:
requestAuth
- (corresponding) request packet authenticatorsecret
- shared secret to encode with- Returns:
- attribute with encoded data
- Throws:
RadiusPacketException
- errors decoding attribute
-
toString
public java.lang.String toString()- Overrides:
toString
in classOctetsAttribute
-