Package org.wildfly.security.sasl.otp
Class OTPSaslServer
- java.lang.Object
-
- org.wildfly.security.sasl.util.AbstractSaslParticipant
-
- org.wildfly.security.sasl.util.AbstractSaslServer
-
- org.wildfly.security.sasl.otp.OTPSaslServer
-
- All Implemented Interfaces:
SaslServer,SaslWrapper
final class OTPSaslServer extends AbstractSaslServer
SaslServer for the OTP SASL mechanism as defined by RFC 2444.- Author:
- Farah Juma
-
-
Field Summary
Fields Modifier and Type Field Description private StringauthorizationIDprivate ExclusiveNameCallbackexclusiveNameCallbackprivate StringpreviousAlgorithmprivate byte[]previousHashprivate StringpreviousSeedprivate intpreviousSequenceNumberprivate Supplier<Provider[]>providersprivate static intST_CHALLENGEprivate static intST_PROCESS_RESPONSEprivate StringuserName-
Fields inherited from class org.wildfly.security.sasl.util.AbstractSaslParticipant
COMPLETE_STATE, FAILED_STATE, NO_BYTES
-
Fields inherited from interface org.wildfly.security.sasl.util.SaslWrapper
IDENTITY
-
-
Constructor Summary
Constructors Constructor Description OTPSaslServer(String mechanismName, String protocol, String serverName, CallbackHandler callbackHandler, Supplier<Provider[]> providers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Dispose of this participant.protected byte[]evaluateMessage(int state, byte[] response)StringgetAuthorizationID()voidinit()private voidupdateCredential(String newAlgorithm, OneTimePasswordSpec newPasswordSpec)private voidverifyAndUpdateCredential(byte[] currentHash, String newAlgorithm, OneTimePasswordSpec newPasswordSpec)Verify that the result of passing the user's password through the hash function once matches the stored password and then update the stored password.-
Methods inherited from class org.wildfly.security.sasl.util.AbstractSaslServer
evaluateResponse
-
Methods inherited from class org.wildfly.security.sasl.util.AbstractSaslParticipant
assertComplete, evaluateMessage, getCallbackHandler, getIntProperty, getMechanismName, getNegotiatedProperty, getProtocol, getServerName, getStringProperty, getWrapper, handleCallbacks, isComplete, negotiationComplete, setNegotiationState, setWrapper, tryHandleCallbacks, unwrap, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.security.sasl.SaslServer
getMechanismName, getNegotiatedProperty, isComplete, unwrap, wrap
-
-
-
-
Field Detail
-
ST_CHALLENGE
private static final int ST_CHALLENGE
- See Also:
- Constant Field Values
-
ST_PROCESS_RESPONSE
private static final int ST_PROCESS_RESPONSE
- See Also:
- Constant Field Values
-
previousAlgorithm
private String previousAlgorithm
-
previousSeed
private String previousSeed
-
previousSequenceNumber
private int previousSequenceNumber
-
previousHash
private byte[] previousHash
-
exclusiveNameCallback
private ExclusiveNameCallback exclusiveNameCallback
-
userName
private String userName
-
authorizationID
private String authorizationID
-
-
Method Detail
-
init
public void init()
- Overrides:
initin classAbstractSaslParticipant
-
getAuthorizationID
public String getAuthorizationID()
-
evaluateMessage
protected byte[] evaluateMessage(int state, byte[] response) throws SaslException- Specified by:
evaluateMessagein classAbstractSaslParticipant- Throws:
SaslException
-
dispose
public void dispose() throws SaslExceptionDescription copied from class:AbstractSaslParticipantDispose of this participant.- Specified by:
disposein interfaceSaslServer- Overrides:
disposein classAbstractSaslParticipant- Throws:
SaslException- if disposal failed
-
verifyAndUpdateCredential
private void verifyAndUpdateCredential(byte[] currentHash, String newAlgorithm, OneTimePasswordSpec newPasswordSpec) throws SaslExceptionVerify that the result of passing the user's password through the hash function once matches the stored password and then update the stored password.- Parameters:
currentHash- the current OTP hashnewAlgorithm- the new OTP algorithmnewPasswordSpec- the new OTP password spec- Throws:
SaslException- if the password was not verified
-
updateCredential
private void updateCredential(String newAlgorithm, OneTimePasswordSpec newPasswordSpec) throws SaslException
- Throws:
SaslException
-
-