Interface NestedAttributeHolder<T extends NestedAttributeHolder<T>>

All Superinterfaces:
AttributeHolder<T>
All Known Subinterfaces:
MessageAuthSupport<T>, RadiusPacket<T>, RadiusRequest, RadiusResponse
All Known Implementing Classes:
AccessRequest, AccessRequestArap, AccessRequestChap, AccessRequestEap, AccessRequestNoAuth, AccessRequestPap, AccessResponse, AccessResponse.Accept, AccessResponse.Challenge, AccessResponse.Reject, AccountingRequest, BaseRadiusPacket, GenericRequest, GenericResponse

public interface NestedAttributeHolder<T extends NestedAttributeHolder<T>>
extends AttributeHolder<T>
AttributeHolder that supports sub-attributes (wrapped by Vendor-Specific Attributes) and filtering by vendorId.

An abstraction of all attribute management methods used by Radius packets.

  • Method Details

    • filterAttributes

      default java.util.List<RadiusAttribute> filterAttributes​(int vendorId, int type)
      Returns all attributes of this packet that match the given type and vendorId.

      If vendorId doesn't match childVendorId, will search sub-attributes.

      Parameters:
      vendorId - vendor ID, or -1
      type - attribute type code
      Returns:
      list of RadiusAttribute objects, or empty list
    • filterAttributes

      default java.util.List<RadiusAttribute> filterAttributes​(AttributeTemplate type)
      Description copied from interface: AttributeHolder
      Returns attributes of the given attribute type. Also searches sub-attributes if appropriate.
      Specified by:
      filterAttributes in interface AttributeHolder<T extends NestedAttributeHolder<T>>
      Parameters:
      type - attribute type name
      Returns:
      list of RadiusAttribute objects, or empty list
    • getAttribute

      default java.util.Optional<RadiusAttribute> getAttribute​(int vendorId, int type)
      Convenience method to get single attribute.

      If vendorId doesn't match childVendorId, will search sub-attributes.

      Parameters:
      vendorId - vendor ID, or -1
      type - attribute type
      Returns:
      RadiusAttribute object or null if there is no such attribute
    • getVendorAttributes

      default java.util.List<VendorSpecificAttribute> getVendorAttributes​(int vendorId)
      Returns the Vendor-Specific attribute(s) for the given vendor ID.
      Parameters:
      vendorId - vendor ID to filter by
      Returns:
      List with VendorSpecificAttribute objects, or empty list
    • getFlattenedAttributes

      default java.util.List<RadiusAttribute> getFlattenedAttributes()
      Returns:
      List of attributes, flattening VSAs and unwrapping nested attributes if found
    • addAttribute

      default T addAttribute​(RadiusAttribute attribute)
      Adds a Radius attribute to this packet. Can also be used to add Vendor-Specific sub-attributes. If a attribute with a vendor code != -1 is passed in, a VendorSpecificAttribute is automatically created for the sub-attribute.
      Specified by:
      addAttribute in interface AttributeHolder<T extends NestedAttributeHolder<T>>
      Parameters:
      attribute - RadiusAttribute object
      Returns:
      object of same type with appended attribute
    • removeAttribute

      default T removeAttribute​(RadiusAttribute attribute)
      Removes all instances of the specified attribute from this packet.
      Specified by:
      removeAttribute in interface AttributeHolder<T extends NestedAttributeHolder<T>>
      Parameters:
      attribute - RadiusAttribute to remove
      Returns:
      object of same type with removed attribute
    • removeAttributes

      default T removeAttributes​(int vendorId, int type)
      Removes all (sub)attributes of the given vendor and type.

      If vendorId doesn't match childVendorId, will search sub-attributes.

      Parameters:
      vendorId - vendor ID, or -1
      type - attribute type code
      Returns:
      object of same type with removed attributes