Interface RadiusPacket<T extends RadiusPacket<T>>

All Superinterfaces:
AttributeHolder<T>, NestedAttributeHolder<T>
All Known Subinterfaces:
MessageAuthSupport<T>, RadiusRequest, RadiusResponse
All Known Implementing Classes:
AccessRequest, AccessRequestArap, AccessRequestChap, AccessRequestEap, AccessRequestNoAuth, AccessRequestPap, AccessResponse, AccessResponse.Accept, AccessResponse.Challenge, AccessResponse.Reject, AccountingRequest, BaseRadiusPacket, GenericRequest, GenericResponse

public interface RadiusPacket<T extends RadiusPacket<T>>
extends NestedAttributeHolder<T>
  • Field Details

  • Method Details

    • getMd5Digest

      static java.security.MessageDigest getMd5Digest()
    • toByteBuf

      static io.netty.buffer.ByteBuf toByteBuf​(RadiusPacket<?> packet) throws RadiusPacketException
      Throws:
      RadiusPacketException
    • fromByteBuf

      static RadiusRequest fromByteBuf​(Dictionary dictionary, io.netty.buffer.ByteBuf byteBuf) throws RadiusPacketException
      Reads a Radius packet from the given input stream and creates an appropriate RadiusPacket descendant object.

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

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

      default io.netty.channel.socket.DatagramPacket toDatagram​(java.net.InetSocketAddress recipient, java.net.InetSocketAddress sender) throws RadiusPacketException
      Parameters:
      recipient - destination socket
      sender - source socket, nullable
      Returns:
      converted DatagramPacket
      Throws:
      RadiusPacketException - if packet could not be encoded/serialized to datagram
    • toDatagram

      default io.netty.channel.socket.DatagramPacket toDatagram​(java.net.InetSocketAddress recipient) throws RadiusPacketException
      Parameters:
      recipient - destination socket
      Returns:
      converted DatagramPacket
      Throws:
      RadiusPacketException - if packet could not be encoded/serialized to datagram
    • getType

      byte getType()
      Returns:
      Radius packet type
    • getId

      byte getId()
      Returns:
      Radius packet identifier
    • getAuthenticator

      byte[] getAuthenticator()
      Returns the authenticator for this Radius packet.

      For a Radius packet read from a stream, this will return the authenticator sent by the server.

      For a new Radius packet to be sent, this will return the authenticator created, or null if no authenticator has been created yet.

      Returns:
      authenticator, 16 bytes
    • getAttributes

      java.util.List<RadiusAttribute> getAttributes()
      Specified by:
      getAttributes in interface AttributeHolder<T extends RadiusPacket<T>>
      Returns:
      list of RadiusAttributes in packet
    • getDictionary

      Dictionary getDictionary()
      Specified by:
      getDictionary in interface AttributeHolder<T extends RadiusPacket<T>>
      Returns:
      the dictionary this Radius packet uses.
    • verifyPacketAuth

      default void verifyPacketAuth​(java.lang.String sharedSecret, byte[] requestAuth) throws RadiusPacketException
      Parameters:
      sharedSecret - shared secret
      requestAuth - request authenticator if verifying response, otherwise set to 16 zero octets
      Throws:
      RadiusPacketException - if authenticator check fails
    • genHashedAuth

      default byte[] genHashedAuth​(java.lang.String sharedSecret, byte[] requestAuth)
      Generates an authenticator for a Radius packet.

      Note: 'this' packet authenticator is ignored, only requestAuth param is used.

      Parameters:
      sharedSecret - shared secret
      requestAuth - request authenticator if hashing for response, otherwise set to 16 zero octets
      Returns:
      new 16 byte response authenticator