Class EncodedAttribute
java.lang.Object
org.tinyradius.core.attribute.type.decorator.EncodedAttribute
- All Implemented Interfaces:
RadiusAttribute
public class EncodedAttribute
extends java.lang.Object
-
Field Summary
Fields Modifier and Type Field Description protected RadiusAttribute
delegate
-
Constructor Summary
Constructors Constructor Description EncodedAttribute(RadiusAttribute 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.boolean
equals(java.lang.Object o)
java.util.List<RadiusAttribute>
flatten()
Returns set of all nested attributes if contains sub-attributes, otherwise singleton set of current attribute.java.lang.String
getAttributeName()
java.util.Optional<AttributeTemplate>
getAttributeTemplate()
Dictionary
getDictionary()
byte
getTag()
byte
getType()
byte[]
getValue()
java.lang.String
getValueString()
int
getVendorId()
int
hashCode()
boolean
isEncoded()
byte[]
toByteArray()
java.lang.String
toString()
-
Field Details
-
Constructor Details
-
Method Details
-
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
-
isEncoded
public boolean isEncoded() -
toString
public java.lang.String toString() -
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
getVendorId
public int getVendorId()- Specified by:
getVendorId
in interfaceRadiusAttribute
- Returns:
- vendor Id if Vendor-Specific attribute or sub-attribute, otherwise -1
-
getType
public byte getType()- Specified by:
getType
in interfaceRadiusAttribute
- Returns:
- attribute type code, 0-255
-
getTag
public byte getTag()- Specified by:
getTag
in interfaceRadiusAttribute
- Returns:
- Tag if available and specified for attribute type (RFC2868)
-
getValue
public byte[] getValue()- Specified by:
getValue
in interfaceRadiusAttribute
- Returns:
- attribute data as raw bytes
-
getValueString
public java.lang.String getValueString()- Specified by:
getValueString
in interfaceRadiusAttribute
- Returns:
- value of this attribute as a hex string.
-
getDictionary
- Specified by:
getDictionary
in interfaceRadiusAttribute
- Returns:
- dictionary that attribute uses
-
toByteArray
public byte[] toByteArray()- Specified by:
toByteArray
in interfaceRadiusAttribute
- Returns:
- entire attribute (including headers) as byte array
-
getAttributeName
public java.lang.String getAttributeName()- Specified by:
getAttributeName
in interfaceRadiusAttribute
-
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
-
getAttributeTemplate
- Specified by:
getAttributeTemplate
in interfaceRadiusAttribute
- Returns:
- AttributeTemplate used to define this attribute
-
encode
Description copied from interface:RadiusAttribute
Encodes attribute. Must be idempotent.- Specified by:
encode
in interfaceRadiusAttribute
- Parameters:
requestAuth
- (corresponding) request packet authenticatorsecret
- shared secret to encode with- Returns:
- attribute with encoded data
-