Class GenericResponse
java.lang.Object
org.tinyradius.core.packet.BaseRadiusPacket<RadiusResponse>
org.tinyradius.core.packet.response.GenericResponse
- All Implemented Interfaces:
AttributeHolder<RadiusResponse>
,NestedAttributeHolder<RadiusResponse>
,RadiusPacket<RadiusResponse>
,RadiusResponse
- Direct Known Subclasses:
AccessResponse
public class GenericResponse extends BaseRadiusPacket<RadiusResponse> implements RadiusResponse
-
Field Summary
Fields inherited from interface org.tinyradius.core.packet.RadiusPacket
HEADER_LENGTH, MAX_PACKET_LENGTH, packetLogger
-
Constructor Summary
Constructors Constructor Description GenericResponse(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
decodeResponse(java.lang.String sharedSecret, byte[] requestAuth)
Decodes the response against the supplied shared secret and request authenticator.RadiusResponse
encodeResponse(java.lang.String sharedSecret, byte[] requestAuth)
Encode and generate authenticator.GenericResponse
withAttributes(java.util.List<RadiusAttribute> attributes)
Methods inherited from class org.tinyradius.core.packet.BaseRadiusPacket
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, decodeAttributes, encodeAttributes, 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
-
GenericResponse
public GenericResponse(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
RadiusResponse.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
-
encodeResponse
public RadiusResponse encodeResponse(java.lang.String sharedSecret, byte[] requestAuth) throws RadiusPacketExceptionDescription copied from interface:RadiusResponse
Encode and generate authenticator.Requires request authenticator to generate response authenticator.
Must be idempotent.
- Specified by:
encodeResponse
in interfaceRadiusResponse
- Parameters:
sharedSecret
- shared secret to be used to encode this packetrequestAuth
- request packet authenticator- Returns:
- new RadiusPacket instance with same properties and valid authenticator
- Throws:
RadiusPacketException
- errors encoding packet
-
decodeResponse
public RadiusResponse decodeResponse(java.lang.String sharedSecret, byte[] requestAuth) throws RadiusPacketExceptionDescription copied from interface:RadiusResponse
Decodes the response against the supplied shared secret and request authenticator.Must be idempotent.
- Specified by:
decodeResponse
in interfaceRadiusResponse
- Parameters:
sharedSecret
- shared secretrequestAuth
- authenticator for corresponding request- Returns:
- verified RadiusResponse with decoded attributes if appropriate
- Throws:
RadiusPacketException
- errors verifying or decoding packet
-
withAttributes
- Specified by:
withAttributes
in interfaceAttributeHolder<RadiusResponse>
-