Class AccessRequest<T extends AccessRequest<T>>
java.lang.Object
org.tinyradius.core.packet.BaseRadiusPacket<RadiusRequest>
org.tinyradius.core.packet.request.GenericRequest
org.tinyradius.core.packet.request.AccessRequest<T>
- All Implemented Interfaces:
AttributeHolder<RadiusRequest>
,NestedAttributeHolder<RadiusRequest>
,RadiusPacket<RadiusRequest>
,RadiusRequest
,MessageAuthSupport<RadiusRequest>
- Direct Known Subclasses:
AccessRequestArap
,AccessRequestChap
,AccessRequestEap
,AccessRequestNoAuth
,AccessRequestPap
public abstract class AccessRequest<T extends AccessRequest<T>> extends GenericRequest implements MessageAuthSupport<RadiusRequest>
This class represents an Access-Request Radius packet.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AccessRequest.AccessRequestFactory<U extends AccessRequest<?>>
-
Field Summary
Fields Modifier and Type Field Description protected static byte
ARAP_PASSWORD
protected static byte
CHAP_PASSWORD
protected static byte
EAP_MESSAGE
protected static org.apache.logging.log4j.Logger
logger
protected static java.security.SecureRandom
RANDOM
protected static byte
USER_PASSWORD
Fields inherited from interface org.tinyradius.core.packet.util.MessageAuthSupport
MESSAGE_AUTHENTICATOR, msgAuthLogger
Fields inherited from interface org.tinyradius.core.packet.RadiusPacket
HEADER_LENGTH, MAX_PACKET_LENGTH, packetLogger
-
Constructor Summary
Constructors Modifier Constructor Description protected
AccessRequest(Dictionary dictionary, byte id, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
-
Method Summary
Modifier and Type Method Description RadiusRequest
decodeRequest(java.lang.String sharedSecret)
Decodes the request against the supplied shared secret.RadiusRequest
encodeRequest(java.lang.String sharedSecret)
AccessRequest overrides this method to generate a randomized authenticator (RFC 2865) and encode required attributes (e.g.protected abstract AccessRequest.AccessRequestFactory<T>
factory()
protected byte[]
genAuth(java.lang.String sharedSecret)
protected static byte[]
random16bytes()
T
withAttributes(java.util.List<RadiusAttribute> attributes)
Methods inherited from class org.tinyradius.core.packet.BaseRadiusPacket
decodeAttributes, encodeAttributes, equals, getAttributes, getAuthenticator, getChildVendorId, getDictionary, getId, getType, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tinyradius.core.attribute.AttributeHolder
addAttribute, addAttribute, filterAttributes, filterAttributes, filterAttributes, getAttribute, getAttribute, getAttributeBytes, getChildVendorId, removeAttributes, removeLastAttribute
Methods inherited from interface org.tinyradius.core.packet.util.MessageAuthSupport
computeMessageAuth, encodeMessageAuth, verifyMessageAuth
Methods inherited from interface org.tinyradius.core.attribute.NestedAttributeHolder
addAttribute, filterAttributes, filterAttributes, getAttribute, getFlattenedAttributes, getVendorAttributes, removeAttribute, removeAttributes
Methods inherited from interface org.tinyradius.core.packet.RadiusPacket
genHashedAuth, getAttributes, getAuthenticator, getDictionary, getId, getType, toDatagram, toDatagram, verifyPacketAuth
-
Field Details
-
logger
protected static final org.apache.logging.log4j.Logger logger -
RANDOM
protected static final java.security.SecureRandom RANDOM -
USER_PASSWORD
protected static final byte USER_PASSWORD- See Also:
- Constant Field Values
-
CHAP_PASSWORD
protected static final byte CHAP_PASSWORD- See Also:
- Constant Field Values
-
EAP_MESSAGE
protected static final byte EAP_MESSAGE- See Also:
- Constant Field Values
-
ARAP_PASSWORD
protected static final byte ARAP_PASSWORD- See Also:
- Constant Field Values
-
-
Constructor Details
-
AccessRequest
protected AccessRequest(Dictionary dictionary, byte id, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
-
-
Method Details
-
factory
-
random16bytes
protected static byte[] random16bytes() -
genAuth
protected byte[] genAuth(java.lang.String sharedSecret)- Overrides:
genAuth
in classGenericRequest
- Parameters:
sharedSecret
- to generate authenticator- Returns:
- new authenticator, must be idempotent
-
encodeRequest
AccessRequest overrides this method to generate a randomized authenticator (RFC 2865) and encode required attributes (e.g. User-Password).- Specified by:
encodeRequest
in interfaceRadiusRequest
- Overrides:
encodeRequest
in classGenericRequest
- 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
-
decodeRequest
Description copied from interface:RadiusRequest
Decodes the request against the supplied shared secret.Must be idempotent.
- Specified by:
decodeRequest
in interfaceRadiusRequest
- Overrides:
decodeRequest
in classGenericRequest
- Parameters:
sharedSecret
- shared secret- Returns:
- verified RadiusRequest with decoded attributes if appropriate
- Throws:
RadiusPacketException
- if authenticator check fails
-
withAttributes
- Specified by:
withAttributes
in interfaceAttributeHolder<T extends AccessRequest<T>>
- Overrides:
withAttributes
in classGenericRequest
-