Package org.tinyradius.packet.request
Class AccessRequestChap
java.lang.Object
org.tinyradius.packet.BaseRadiusPacket
org.tinyradius.packet.request.RadiusRequest
org.tinyradius.packet.request.AccessRequest
org.tinyradius.packet.request.AccessRequestChap
- All Implemented Interfaces:
AttributeHolder
,NestedAttributeHolder
,RadiusPacket
,MessageAuthSupport<AccessRequest>
public class AccessRequestChap extends AccessRequest
-
Field Summary
Fields Modifier and Type Field Description protected static byte
CHAP_CHALLENGE
Fields inherited from class org.tinyradius.packet.request.AccessRequest
AUTH_ATTRS, CHAP_PASSWORD, EAP_MESSAGE, logger, RANDOM, USER_NAME, USER_PASSWORD
-
Constructor Summary
Constructors Constructor Description AccessRequestChap(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
AccessRequestChap(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes, java.lang.String plaintextPw)
-
Method Summary
Modifier and Type Method Description boolean
checkPassword(java.lang.String plaintext)
Checks that the passed plain-text password matches the password (hash) send with this Access-Request packet.AccessRequestChap
copy()
protected AccessRequestChap
encodeAuthMechanism(java.lang.String sharedSecret, byte[] newAuth)
Sets and encodes the CHAP-Password and CHAP-Challenge attributes.java.lang.String
getPlaintextPassword()
Retrieves the plain-text user password.void
setPlaintextPassword(java.lang.String userPassword)
Sets the plain-text user password.protected void
verifyAuthMechanism(java.lang.String sharedSecret)
Verify packet for specific auth protocolsMethods inherited from class org.tinyradius.packet.request.AccessRequest
create, encodeRequest, random16bytes, verifyRequest
Methods inherited from class org.tinyradius.packet.BaseRadiusPacket
createHashedAuthenticator, equals, getAttributes, getAuthenticator, getChildVendorId, getDictionary, getId, getMd5Digest, getType, hashCode, toString, verifyPacketAuth
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.tinyradius.attribute.util.AttributeHolder
addAttribute, addAttribute, getAttribute, getAttribute, getAttributeBytes, getAttributeMap, getAttributes, getAttributes, getAttributeString, getChildVendorId, lookupAttributeType, removeAttributes, removeLastAttribute
Methods inherited from interface org.tinyradius.packet.util.MessageAuthSupport
calcMessageAuthInput, computeMessageAuth, encodeMessageAuth, verifyMessageAuth
Methods inherited from interface org.tinyradius.attribute.util.NestedAttributeHolder
addAttribute, getAttribute, getAttributes, getAttributes, getVendorSpecificAttributes, removeAttribute, removeAttributes, removeSubAttribute
Methods inherited from interface org.tinyradius.packet.RadiusPacket
getAttributes, getAuthenticator, getDictionary, getId, getType
-
Field Details
-
CHAP_CHALLENGE
protected static final byte CHAP_CHALLENGE- See Also:
- Constant Field Values
-
-
Constructor Details
-
AccessRequestChap
public AccessRequestChap(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes, java.lang.String plaintextPw) -
AccessRequestChap
public AccessRequestChap(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
-
-
Method Details
-
setPlaintextPassword
public void setPlaintextPassword(java.lang.String userPassword)Sets the plain-text user password.- Parameters:
userPassword
- user password to set
-
getPlaintextPassword
public java.lang.String getPlaintextPassword()Retrieves the plain-text user password.- Returns:
- user password in plaintext, only available if set in memory, cannot be extracted from packet
-
encodeAuthMechanism
protected AccessRequestChap encodeAuthMechanism(java.lang.String sharedSecret, byte[] newAuth) throws RadiusPacketExceptionSets and encodes the CHAP-Password and CHAP-Challenge attributes.- Specified by:
encodeAuthMechanism
in classAccessRequest
- Parameters:
sharedSecret
- shared secret not used to encodenewAuth
- ignored, not used for CHAP- Returns:
- List of RadiusAttributes to override
- Throws:
RadiusPacketException
- if invalid or missing attributes
-
checkPassword
public boolean checkPassword(java.lang.String plaintext)Checks that the passed plain-text password matches the password (hash) send with this Access-Request packet.- Parameters:
plaintext
- password to verify packet against- Returns:
- true if the password is valid, false otherwise
-
verifyAuthMechanism
Description copied from class:AccessRequest
Verify packet for specific auth protocols- Specified by:
verifyAuthMechanism
in classAccessRequest
- Parameters:
sharedSecret
- shared secret- Throws:
RadiusPacketException
- if invalid or missing attributes
-
copy
- Specified by:
copy
in interfaceMessageAuthSupport<AccessRequest>
- Specified by:
copy
in interfaceRadiusPacket
- Specified by:
copy
in classAccessRequest
- Returns:
- AccessRequest implementation copy including intermediate/transient values and passwords
-