Package org.tinyradius.packet.response
Class RadiusResponse
java.lang.Object
org.tinyradius.packet.BaseRadiusPacket
org.tinyradius.packet.response.RadiusResponse
- All Implemented Interfaces:
AttributeHolder
,NestedAttributeHolder
,RadiusPacket
- Direct Known Subclasses:
AccessResponse
public class RadiusResponse extends BaseRadiusPacket
-
Field Summary
-
Constructor Summary
Constructors Constructor Description RadiusResponse(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 RadiusResponse
copy()
RadiusResponse
encodeResponse(java.lang.String sharedSecret, byte[] requestAuth)
Encode and generate authenticator.void
verifyResponse(java.lang.String sharedSecret, byte[] requestAuth)
Verifies the response 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
-
RadiusResponse
public RadiusResponse(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.createResponse(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
-
encodeResponse
Encode and generate authenticator. Should be idempotent.Requires request authenticator to generator response authenticator.
- Parameters:
sharedSecret
- shared secret to be used to encode this packetrequestAuth
- request packet authenticator- Returns:
- new RadiusPacket instance with same properties and valid authenticator
-
verifyResponse
public void verifyResponse(java.lang.String sharedSecret, byte[] requestAuth) throws RadiusPacketExceptionVerifies the response authenticator against the supplied shared secret.- Parameters:
sharedSecret
- shared secretrequestAuth
- authenticator for corresponding request- Throws:
RadiusPacketException
- if authenticator check fails
-