Interface RadiusResponse

All Superinterfaces:
AttributeHolder<RadiusResponse>, NestedAttributeHolder<RadiusResponse>, RadiusPacket<RadiusResponse>
All Known Implementing Classes:
AccessResponse, AccessResponse.Accept, AccessResponse.Challenge, AccessResponse.Reject, GenericResponse

public interface RadiusResponse extends RadiusPacket<RadiusResponse>
  • Method Details

    • create

      static RadiusResponse create(Dictionary dictionary, io.netty.buffer.ByteBuf header, List<RadiusAttribute> attributes) throws RadiusPacketException
      Throws:
      RadiusPacketException
    • create

      static RadiusResponse create(Dictionary dictionary, byte type, byte id, byte[] authenticator, List<RadiusAttribute> attributes) throws RadiusPacketException
      Creates a RadiusPacket object. Depending on the passed type, an appropriate packet is created. Also sets the type, and the the packet id.
      Parameters:
      dictionary - custom dictionary to use
      type - packet type
      id - packet id
      authenticator - authenticator for packet, nullable
      attributes - list of attributes for packet
      Returns:
      RadiusPacket object
      Throws:
      RadiusPacketException - packet validation exceptions
    • fromDatagram

      static RadiusResponse fromDatagram(Dictionary dictionary, io.netty.channel.socket.DatagramPacket datagram) throws RadiusPacketException
      Reads a response from the given input stream and creates an appropriate RadiusPacket/subclass.

      Decodes the encrypted fields and attributes of the packet, and checks authenticator if appropriate.

      Parameters:
      dictionary - dictionary to use for attributes
      datagram - DatagramPacket to read packet from
      Returns:
      new RadiusPacket object
      Throws:
      RadiusPacketException - malformed packet
    • fromByteBuf

      static RadiusResponse fromByteBuf(Dictionary dictionary, io.netty.buffer.ByteBuf byteBuf) throws RadiusPacketException
      Reads a response from the given input stream and creates an appropriate RadiusPacket/subclass.

      Decodes the encrypted fields and attributes of the packet, and checks authenticator if appropriate.

      Parameters:
      dictionary - dictionary to use for attributes
      byteBuf - byteBuf to read packet from
      Returns:
      new RadiusPacket object
      Throws:
      RadiusPacketException - malformed packet
    • encodeResponse

      RadiusResponse encodeResponse(String sharedSecret, byte[] requestAuth) throws RadiusPacketException
      Encode and generate authenticator.

      Requires request authenticator to generate response authenticator.

      Must be idempotent.

      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
      Throws:
      RadiusPacketException - errors encoding packet
    • decodeResponse

      RadiusResponse decodeResponse(String sharedSecret, byte[] requestAuth) throws RadiusPacketException
      Decodes the response against the supplied shared secret and request authenticator.

      Must be idempotent.

      Parameters:
      sharedSecret - shared secret
      requestAuth - authenticator for corresponding request
      Returns:
      verified RadiusResponse with decoded attributes if appropriate
      Throws:
      RadiusPacketException - errors verifying or decoding packet