Package org.tinyradius.core.attribute
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 Summary
Modifier and Type Method Description default T
addAttribute(RadiusAttribute attribute)
Adds a Radius attribute to this packet.default java.util.List<RadiusAttribute>
filterAttributes(int vendorId, int type)
Returns all attributes of this packet that match the given type and vendorId.default java.util.List<RadiusAttribute>
filterAttributes(AttributeTemplate type)
Returns attributes of the given attribute type.default java.util.Optional<RadiusAttribute>
getAttribute(int vendorId, int type)
Convenience method to get single attribute.default java.util.List<RadiusAttribute>
getFlattenedAttributes()
default java.util.List<VendorSpecificAttribute>
getVendorAttributes(int vendorId)
Returns the Vendor-Specific attribute(s) for the given vendor ID.default T
removeAttribute(RadiusAttribute attribute)
Removes all instances of the specified attribute from this packet.default T
removeAttributes(int vendorId, int type)
Removes all (sub)attributes of the given vendor and type.Methods inherited from interface org.tinyradius.core.attribute.AttributeHolder
addAttribute, addAttribute, decodeAttributes, encodeAttributes, filterAttributes, filterAttributes, filterAttributes, getAttribute, getAttribute, getAttributeBytes, getAttributes, getChildVendorId, getDictionary, removeAttributes, removeLastAttribute, withAttributes
-
Method Details
-
filterAttributes
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 -1type
- attribute type code- Returns:
- list of RadiusAttribute objects, or empty list
-
filterAttributes
Description copied from interface:AttributeHolder
Returns attributes of the given attribute type. Also searches sub-attributes if appropriate.- Specified by:
filterAttributes
in interfaceAttributeHolder<T extends NestedAttributeHolder<T>>
- Parameters:
type
- attribute type name- Returns:
- list of RadiusAttribute objects, or empty list
-
getAttribute
Convenience method to get single attribute.If vendorId doesn't match childVendorId, will search sub-attributes.
- Parameters:
vendorId
- vendor ID, or -1type
- attribute type- Returns:
- RadiusAttribute object or null if there is no such attribute
-
getVendorAttributes
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
- Returns:
- List of attributes, flattening VSAs and unwrapping nested attributes if found
-
addAttribute
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 interfaceAttributeHolder<T extends NestedAttributeHolder<T>>
- Parameters:
attribute
- RadiusAttribute object- Returns:
- object of same type with appended attribute
-
removeAttribute
Removes all instances of the specified attribute from this packet.- Specified by:
removeAttribute
in interfaceAttributeHolder<T extends NestedAttributeHolder<T>>
- Parameters:
attribute
- RadiusAttribute to remove- Returns:
- object of same type with removed attribute
-
removeAttributes
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 -1type
- attribute type code- Returns:
- object of same type with removed attributes
-