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

    • copy

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

      public RadiusRequest encodeRequest​(java.lang.String sharedSecret) throws RadiusPacketException
      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

      public void verifyRequest​(java.lang.String sharedSecret) throws RadiusPacketException
      Checks the request authenticator against the supplied shared secret.
      Parameters:
      sharedSecret - shared secret
      Throws:
      RadiusPacketException - if authenticator check fails