Class GenericRequest
java.lang.Object
org.tinyradius.core.packet.BaseRadiusPacket<RadiusRequest>
org.tinyradius.core.packet.request.GenericRequest
- All Implemented Interfaces:
AttributeHolder<RadiusRequest>
,NestedAttributeHolder<RadiusRequest>
,RadiusPacket<RadiusRequest>
,RadiusRequest
- Direct Known Subclasses:
AccessRequest
,AccountingRequest
public class GenericRequest extends BaseRadiusPacket<RadiusRequest> implements RadiusRequest
-
Field Summary
Fields inherited from interface org.tinyradius.core.packet.RadiusPacket
HEADER_LENGTH, MAX_PACKET_LENGTH, packetLogger
-
Constructor Summary
Constructors Constructor Description GenericRequest(Dictionary dictionary, byte type, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
Builds a Radius packet with the given type, identifier and attributes. -
Method Summary
Modifier and Type Method Description RadiusRequest
decodeRequest(java.lang.String sharedSecret)
Decodes the request against the supplied shared secret.RadiusRequest
encodeRequest(java.lang.String sharedSecret)
Encode request and generate authenticator.protected byte[]
genAuth(java.lang.String sharedSecret)
RadiusRequest
withAttributes(java.util.List<RadiusAttribute> attributes)
Methods inherited from class org.tinyradius.core.packet.BaseRadiusPacket
decodeAttributes, encodeAttributes, equals, getAttributes, getAuthenticator, getChildVendorId, getDictionary, getId, getType, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tinyradius.core.attribute.AttributeHolder
addAttribute, addAttribute, filterAttributes, filterAttributes, filterAttributes, getAttribute, getAttribute, getAttributeBytes, getChildVendorId, removeAttributes, removeLastAttribute
Methods inherited from interface org.tinyradius.core.attribute.NestedAttributeHolder
addAttribute, filterAttributes, filterAttributes, getAttribute, getFlattenedAttributes, getVendorAttributes, removeAttribute, removeAttributes
Methods inherited from interface org.tinyradius.core.packet.RadiusPacket
genHashedAuth, getAttributes, getAuthenticator, getDictionary, getId, getType, toDatagram, toDatagram, verifyPacketAuth
-
Constructor Details
-
GenericRequest
public GenericRequest(Dictionary dictionary, byte type, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)Builds a Radius packet with the given type, identifier and attributes.Use
RadiusRequest.create(Dictionary, byte, byte, byte[], List)
where possible as that automatically creates Access/Accounting variants as required.- Parameters:
dictionary
- custom dictionary to usetype
- packet typeidentifier
- packet identifierauthenticator
- can be null if creating manuallyattributes
- list of RadiusAttribute objects
-
-
Method Details
-
genAuth
protected byte[] genAuth(java.lang.String sharedSecret)- Parameters:
sharedSecret
- to generate authenticator- Returns:
- new authenticator, must be idempotent
-
encodeRequest
Description copied from interface:RadiusRequest
Encode request and generate authenticator.Must be idempotent.
- Specified by:
encodeRequest
in interfaceRadiusRequest
- Parameters:
sharedSecret
- shared secret that secures the communication with the other Radius server/client- Returns:
- RadiusRequest with new authenticator and/or encoded attributes
- Throws:
RadiusPacketException
- if invalid or missing attributes
-
decodeRequest
Description copied from interface:RadiusRequest
Decodes the request against the supplied shared secret.Must be idempotent.
- Specified by:
decodeRequest
in interfaceRadiusRequest
- Parameters:
sharedSecret
- shared secret- Returns:
- verified RadiusRequest with decoded attributes if appropriate
- Throws:
RadiusPacketException
- if authenticator check fails
-
withAttributes
- Specified by:
withAttributes
in interfaceAttributeHolder<RadiusRequest>
-