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 String
authorizationID
private ExclusiveNameCallback
exclusiveNameCallback
private String
previousAlgorithm
private byte[]
previousHash
private String
previousSeed
private int
previousSequenceNumber
private Supplier<Provider[]>
providers
private static int
ST_CHALLENGE
private static int
ST_PROCESS_RESPONSE
private String
userName
-
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 void
dispose()
Dispose of this participant.protected byte[]
evaluateMessage(int state, byte[] response)
String
getAuthorizationID()
void
init()
private void
updateCredential(String newAlgorithm, OneTimePasswordSpec newPasswordSpec)
private void
verifyAndUpdateCredential(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:
init
in classAbstractSaslParticipant
-
getAuthorizationID
public String getAuthorizationID()
-
evaluateMessage
protected byte[] evaluateMessage(int state, byte[] response) throws SaslException
- Specified by:
evaluateMessage
in classAbstractSaslParticipant
- Throws:
SaslException
-
dispose
public void dispose() throws SaslException
Description copied from class:AbstractSaslParticipant
Dispose of this participant.- Specified by:
dispose
in interfaceSaslServer
- Overrides:
dispose
in classAbstractSaslParticipant
- Throws:
SaslException
- if disposal failed
-
verifyAndUpdateCredential
private void verifyAndUpdateCredential(byte[] currentHash, String newAlgorithm, OneTimePasswordSpec newPasswordSpec) throws SaslException
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.- 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
-
-