Package org.tinyradius.packet.request
Class AccessRequestPap
java.lang.Object
org.tinyradius.packet.BaseRadiusPacket
org.tinyradius.packet.request.RadiusRequest
org.tinyradius.packet.request.AccessRequest
org.tinyradius.packet.request.AccessRequestPap
- All Implemented Interfaces:
AttributeHolder
,NestedAttributeHolder
,RadiusPacket
,MessageAuthSupport<AccessRequest>
public class AccessRequestPap extends AccessRequest
-
Field Summary
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 AccessRequestPap(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes)
AccessRequestPap(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.AccessRequest
copy()
protected AccessRequestPap
encodeAuthMechanism(java.lang.String sharedSecret, byte[] newAuth)
Sets and encodes the User-Password attribute.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
-
Constructor Details
-
AccessRequestPap
public AccessRequestPap(Dictionary dictionary, byte identifier, byte[] authenticator, java.util.List<RadiusAttribute> attributes, java.lang.String plaintextPw) -
AccessRequestPap
public AccessRequestPap(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 if decoded
-
encodeAuthMechanism
protected AccessRequestPap encodeAuthMechanism(java.lang.String sharedSecret, byte[] newAuth) throws RadiusPacketExceptionSets and encodes the User-Password attribute.- Specified by:
encodeAuthMechanism
in classAccessRequest
- Parameters:
sharedSecret
- shared secret that secures the communication with the other Radius server/clientnewAuth
- authenticator to use to encode PAP password, nullable if using different auth protocol- 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
-