Interface AttributeHolder

All Known Subinterfaces:
MessageAuthSupport<T>, NestedAttributeHolder, RadiusPacket
All Known Implementing Classes:
AccessRequest, AccessRequestChap, AccessRequestEap, AccessRequestPap, AccessResponse, AccountingRequest, BaseRadiusPacket, RadiusRequest, RadiusResponse, VendorSpecificAttribute

public interface AttributeHolder
Generic attribute holder, for VendorSpecificAttribute (to hold sub-attributes) or RadiusPackets
  • Method Details

    • getChildVendorId

      int getChildVendorId()
      Returns:
      VendorId to restrict (sub)attributes, or -1 for top level
    • getDictionary

      Dictionary getDictionary()
    • getAttributes

      java.util.List<RadiusAttribute> getAttributes()
    • addAttribute

      void addAttribute​(RadiusAttribute attribute)
    • removeAttribute

      void removeAttribute​(RadiusAttribute attribute)
    • lookupAttributeType

      default AttributeType lookupAttributeType​(java.lang.String name)
    • getAttributeString

      default java.lang.String getAttributeString​(byte type)
      Convenience method to get single attribute as string.
      Parameters:
      type - attribute type name
      Returns:
      RadiusAttribute object or null if there is no such attribute
    • getAttribute

      default RadiusAttribute getAttribute​(java.lang.String type)
      Convenience method to get single attribute.
      Parameters:
      type - attribute type name
      Returns:
      RadiusAttribute object or null if there is no such attribute
    • getAttribute

      default RadiusAttribute getAttribute​(byte type)
      Convenience method to get single attribute.
      Parameters:
      type - attribute type
      Returns:
      RadiusAttribute object or null if there is no such attribute
    • getAttributes

      default java.util.List<RadiusAttribute> getAttributes​(byte type)
      Returns all attributes of the given type, regardless of vendorId
      Parameters:
      type - type of attributes to get
      Returns:
      list of RadiusAttribute objects, or empty list
    • getAttributes

      default java.util.List<RadiusAttribute> getAttributes​(java.lang.String type)
      Returns attributes of the given type name. Also searches sub-attributes if appropriate.
      Parameters:
      type - attribute type name
      Returns:
      list of RadiusAttribute objects, or empty list
    • getAttributes

      default java.util.List<RadiusAttribute> getAttributes​(AttributeType type)
      Returns attributes of the given attribute type. Also searches sub-attributes if appropriate.
      Parameters:
      type - attribute type name
      Returns:
      list of RadiusAttribute objects, or empty list
    • addAttribute

      default void addAttribute​(java.lang.String name, java.lang.String value)
      Adds a Radius attribute. Uses AttributeTypes to lookup the type code and converts the value.
      Parameters:
      name - name of the attribute, for example "NAS-IP-Address", should NOT be 'Vendor-Specific'
      value - value of the attribute, for example "127.0.0.1"
      Throws:
      java.lang.IllegalArgumentException - if type name or value is invalid
    • addAttribute

      default void addAttribute​(byte type, java.lang.String value)
      Adds a Radius attribute.
      Parameters:
      type - attribute type code
      value - string value to set
    • removeAttributes

      default void removeAttributes​(byte type)
      Removes all attributes from this packet which have got the specified type.
      Parameters:
      type - attribute type to remove
    • removeLastAttribute

      default void removeLastAttribute​(byte type)
      Removes the last occurrence of the attribute of the given type from the packet.
      Parameters:
      type - attribute type code
    • getAttributeMap

      default java.util.Map<java.lang.String,​java.lang.String> getAttributeMap()
      Returns:
      Map of attribute key-value
    • getAttributeBytes

      default byte[] getAttributeBytes()
      Encodes the attributes of this Radius packet to a byte array.
      Returns:
      byte array with encoded attributes