Package org.tinyradius.packet.request
Class RadiusRequest
java.lang.Object
org.tinyradius.packet.BaseRadiusPacket
org.tinyradius.packet.request.RadiusRequest
- All Implemented Interfaces:
AttributeHolder
,NestedAttributeHolder
,RadiusPacket
- Direct Known Subclasses:
AccessRequest
,AccountingRequest
public class RadiusRequest extends BaseRadiusPacket
-
Field Summary
-
Constructor Summary
Constructors Constructor Description RadiusRequest(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
copy()
RadiusRequest
encodeRequest(java.lang.String sharedSecret)
Encode request and generate authenticator.void
verifyRequest(java.lang.String sharedSecret)
Checks the request authenticator against the supplied shared secret.Methods inherited from class org.tinyradius.packet.BaseRadiusPacket
createHashedAuthenticator, equals, getAttributes, getAuthenticator, getChildVendorId, getDictionary, getId, getMd5Digest, getType, hashCode, toString, verifyPacketAuth
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tinyradius.attribute.util.AttributeHolder
addAttribute, addAttribute, getAttribute, getAttribute, getAttributeBytes, getAttributeMap, getAttributes, getAttributes, getAttributeString, lookupAttributeType, removeAttributes, removeLastAttribute
Methods inherited from interface org.tinyradius.attribute.util.NestedAttributeHolder
addAttribute, getAttribute, getAttributes, getAttributes, getVendorSpecificAttributes, removeAttribute, removeAttributes, removeSubAttribute
-
Constructor Details
-
RadiusRequest
public RadiusRequest(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
RadiusPackets.createRequest(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
-
copy
- Returns:
- packet of same type as self, including intermediate fields
-
encodeRequest
Encode request and generate authenticator. Should be idempotent.Base implementation generates hashed authenticator.
- Parameters:
sharedSecret
- shared secret that secures the communication with the other Radius server/client- Returns:
- RadiusPacket with new authenticator and/or encoded attributes
- Throws:
RadiusPacketException
- if invalid or missing attributes
-
verifyRequest
Checks the request authenticator against the supplied shared secret.- Parameters:
sharedSecret
- shared secret- Throws:
RadiusPacketException
- if authenticator check fails
-