Class AccessRequestChap
java.lang.Object
org.tinyradius.core.packet.BaseRadiusPacket<RadiusRequest>
org.tinyradius.core.packet.request.GenericRequest
org.tinyradius.core.packet.request.AccessRequest<AccessRequestChap>
org.tinyradius.core.packet.request.AccessRequestChap
- All Implemented Interfaces:
AttributeHolder<RadiusRequest>
,NestedAttributeHolder<RadiusRequest>
,RadiusPacket<RadiusRequest>
,RadiusRequest
,MessageAuthSupport<RadiusRequest>
public class AccessRequestChap extends AccessRequest<AccessRequestChap>
CHAP AccessRequest RFC2865
-
Nested Class Summary
Nested classes/interfaces inherited from class org.tinyradius.core.packet.request.AccessRequest
AccessRequest.AccessRequestFactory<U extends AccessRequest<?>>
-
Field Summary
Fields inherited from class org.tinyradius.core.packet.request.AccessRequest
ARAP_PASSWORD, CHAP_PASSWORD, EAP_MESSAGE, logger, RANDOM, 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 Constructor Description AccessRequestChap(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
-
Method Summary
Modifier and Type Method Description boolean
checkPassword(java.lang.String password)
Checks that the passed plain-text password matches the password (hash) send with this Access-Request packet.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 AccessRequest.AccessRequestFactory<AccessRequestChap>
factory()
AccessRequestChap
withPassword(java.lang.String password)
Set CHAP-Password / CHAP-Challenge attributes with provided password.Methods inherited from class org.tinyradius.core.packet.request.AccessRequest
genAuth, random16bytes, withAttributes
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
-
Constructor Details
-
AccessRequestChap
public AccessRequestChap(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
-
-
Method Details
-
factory
- Specified by:
factory
in classAccessRequest<AccessRequestChap>
-
withPassword
Set CHAP-Password / CHAP-Challenge attributes with provided password.Will remove existing attributes if exists already
- Parameters:
password
- plaintext password to encode into CHAP-Password- Returns:
- AccessRequestChap with encoded CHAP-Password and CHAP-Challenge attributes
- Throws:
java.lang.IllegalArgumentException
- invalid password
-
encodeRequest
Description copied from class:AccessRequest
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 classAccessRequest<AccessRequestChap>
- 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 classAccessRequest<AccessRequestChap>
- Parameters:
sharedSecret
- shared secret- Returns:
- verified RadiusRequest with decoded attributes if appropriate
- Throws:
RadiusPacketException
- if authenticator check fails
-
checkPassword
public boolean checkPassword(java.lang.String password)Checks that the passed plain-text password matches the password (hash) send with this Access-Request packet.- Parameters:
password
- plaintext password to verify packet against- Returns:
- true if the password is valid, false otherwise
-