Interface RadiusAttribute

All Known Implementing Classes:
EncodedAttribute, IntegerAttribute, IpAttribute, IpAttribute.V4, IpAttribute.V6, Ipv6PrefixAttribute, OctetsAttribute, StringAttribute, TaggedAttribute, VendorSpecificAttribute

public interface RadiusAttribute
  • Method Details

    • getVendorId

      int getVendorId()
      Returns:
      vendor Id if Vendor-Specific attribute or sub-attribute, otherwise -1
    • getType

      int getType()
      Returns:
      attribute type code, typically 0-255
    • getTag

      byte getTag()
      Returns:
      Tag if available and specified for attribute type (RFC2868)
    • getTagBytes

      default byte[] getTagBytes()
      Returns:
      byte array of length 1 containing getTag(), or empty byte array of length 0 if attribute does not support tags
    • getValue

      byte[] getValue()
      Returns:
      attribute data as raw bytes
    • getValueString

      java.lang.String getValueString()
      Returns:
      value of this attribute as a hex string.
    • getDictionary

      Dictionary getDictionary()
      Returns:
      dictionary that attribute uses
    • toByteArray

      default byte[] toByteArray()
      Returns:
      entire attribute (including headers) as byte array
    • getAttributeName

      default java.lang.String getAttributeName()
    • flatten

      default java.util.List<RadiusAttribute> flatten()
      Returns set of all nested attributes if contains sub-attributes, otherwise singleton set of current attribute.
      Returns:
      List of RadiusAttributes
    • getAttributeTemplate

      default java.util.Optional<AttributeTemplate> getAttributeTemplate()
      Returns:
      AttributeTemplate used to define this attribute
    • encode

      default RadiusAttribute encode​(byte[] requestAuth, java.lang.String secret) throws RadiusPacketException
      Encodes attribute. Must be idempotent.
      Parameters:
      requestAuth - (corresponding) request packet authenticator
      secret - shared secret to encode with
      Returns:
      attribute with encoded data
      Throws:
      RadiusPacketException - errors encoding attribute
    • decode

      default RadiusAttribute decode​(byte[] requestAuth, java.lang.String secret) throws RadiusPacketException
      Decodes attribute. Must be idempotent.
      Parameters:
      requestAuth - (corresponding) request packet authenticator
      secret - shared secret to encode with
      Returns:
      attribute with encoded data
      Throws:
      RadiusPacketException - errors decoding attribute
    • isEncoded

      default boolean isEncoded()