Class AccessRequest

java.lang.Object
All Implemented Interfaces:
AttributeHolder, NestedAttributeHolder, RadiusPacket, MessageAuthSupport<AccessRequest>
Direct Known Subclasses:
AccessRequestChap, AccessRequestEap, AccessRequestPap

public abstract class AccessRequest
extends RadiusRequest
implements MessageAuthSupport<AccessRequest>
This class represents an Access-Request Radius packet.
  • Field Details

  • Constructor Details

    • AccessRequest

      protected AccessRequest​(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
      Parameters:
      dictionary - custom dictionary to use
      identifier - packet identifier
      authenticator - authenticator for packet, nullable
      attributes - list of attributes for packet
  • Method Details

    • encodeAuthMechanism

      protected abstract AccessRequest encodeAuthMechanism​(java.lang.String sharedSecret, byte[] newAuth) throws RadiusPacketException
      Create copy of AccessRequest with new authenticator and encoded attributes
      Parameters:
      sharedSecret - shared secret that secures the communication with the other Radius server/client
      newAuth - authenticator to use to encode PAP password, nullable if using different auth protocol
      Returns:
      RadiusPacket with new authenticator and encoded attributes
      Throws:
      RadiusPacketException - if invalid or missing attributes
    • copy

      public abstract AccessRequest copy()
      Specified by:
      copy in interface MessageAuthSupport<AccessRequest>
      Specified by:
      copy in interface RadiusPacket
      Overrides:
      copy in class RadiusRequest
      Returns:
      AccessRequest implementation copy including intermediate/transient values and passwords
    • encodeRequest

      public AccessRequest encodeRequest​(java.lang.String sharedSecret) throws RadiusPacketException
      AccessRequest overrides this method to generate a randomized authenticator (RFC 2865) and encode required attributes (e.g. User-Password).
      Overrides:
      encodeRequest in class RadiusRequest
      Parameters:
      sharedSecret - shared secret that secures the communication with the other Radius server/client
      Returns:
      RadiusPacket with new authenticator and encoded attributes
      Throws:
      RadiusPacketException - if invalid or missing attributes
    • verifyAuthMechanism

      protected abstract void verifyAuthMechanism​(java.lang.String sharedSecret) throws RadiusPacketException
      Verify packet for specific auth protocols
      Parameters:
      sharedSecret - shared secret
      Throws:
      RadiusPacketException - if invalid or missing attributes
    • verifyRequest

      public void verifyRequest​(java.lang.String sharedSecret) throws RadiusPacketException
      AccessRequest cannot verify authenticator as they contain random bytes.

      It can, however, check the User-Password/Challenge attributes are present and attempt decryption, depending on auth protocol.

      Overrides:
      verifyRequest in class RadiusRequest
      Parameters:
      sharedSecret - shared secret, only applicable for PAP
      Throws:
      RadiusPacketException - if authenticator check fails
    • create

      public static AccessRequest create​(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
      Create new AccessRequest, tries to identify auth protocol from attributes.
      Parameters:
      dictionary - custom dictionary to use
      identifier - packet identifier
      authenticator - authenticator for packet, nullable
      attributes - list of attributes for packet, should not be empty or a stub AccessRequest will be returned
      Returns:
      AccessRequest auth mechanism-specific implementation
    • random16bytes

      protected byte[] random16bytes()