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
  • 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 use
      type - packet type
      identifier - packet identifier
      authenticator - can be null if creating manually
      attributes - list of RadiusAttribute objects
  • Method Details

    • copy

      public RadiusResponse copy()
      Returns:
      packet of same type as self, including intermediate fields
    • encodeResponse

      public RadiusResponse encodeResponse​(java.lang.String sharedSecret, byte[] requestAuth)
      Encode and generate authenticator. Should be idempotent.

      Requires request authenticator to generator response authenticator.

      Parameters:
      sharedSecret - shared secret to be used to encode this packet
      requestAuth - request packet authenticator
      Returns:
      new RadiusPacket instance with same properties and valid authenticator
    • verifyResponse

      public void verifyResponse​(java.lang.String sharedSecret, byte[] requestAuth) throws RadiusPacketException
      Verifies the response authenticator against the supplied shared secret.
      Parameters:
      sharedSecret - shared secret
      requestAuth - authenticator for corresponding request
      Throws:
      RadiusPacketException - if authenticator check fails