Package org.apache.qpid.jms.sasl
Class ScramSHA1Mechanism
- java.lang.Object
-
- org.apache.qpid.jms.sasl.AbstractMechanism
-
- org.apache.qpid.jms.sasl.ScramSHA1Mechanism
-
- All Implemented Interfaces:
Comparable<Mechanism>,Mechanism
public class ScramSHA1Mechanism extends AbstractMechanism
Implements the SASL Scram SHA1 authentication Mechanism.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.qpid.jms.sasl.Mechanism
Mechanism.PRIORITY
-
-
Field Summary
Fields Modifier and Type Field Description static StringHMAC_SHA_1static StringSHA_1-
Fields inherited from class org.apache.qpid.jms.sasl.AbstractMechanism
EMPTY
-
-
Constructor Summary
Constructors Constructor Description ScramSHA1Mechanism()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getChallengeResponse(byte[] challenge)Create a response based on a given challenge from the remote peer.byte[]getInitialResponse()Create an initial response based on selected mechanism.StringgetName()intgetPriority()booleanisApplicable(String username, String password, Principal localPrincipal)Allows the mechanism to determine if it can be used given the authentication provided.voidverifyCompletion()Verifies that the SASL exchange has completed successfully.-
Methods inherited from class org.apache.qpid.jms.sasl.AbstractMechanism
compareTo, getPassword, getUsername, init, isEnabledByDefault, setPassword, setUsername, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.qpid.jms.sasl.Mechanism
getAdditionalFailureInformation
-
-
-
-
Field Detail
-
SHA_1
public static final String SHA_1
- See Also:
- Constant Field Values
-
HMAC_SHA_1
public static final String HMAC_SHA_1
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPriority
public int getPriority()
- Returns:
- return the relative priority of this SASL mechanism.
-
getName
public String getName()
- Returns:
- the well known name of this SASL mechanism.
-
isApplicable
public boolean isApplicable(String username, String password, Principal localPrincipal)
Description copied from interface:MechanismAllows the mechanism to determine if it can be used given the authentication provided.- Parameters:
username- The user name given to the client for authentication.password- The password given to the client for authentication.localPrincipal- The local Principal configured for the client for authentication.- Returns:
- if this Mechanism is able to validate using the given credentials.
-
getInitialResponse
public byte[] getInitialResponse() throws SaslExceptionDescription copied from interface:MechanismCreate an initial response based on selected mechanism. May be null if there is no initial response.- Returns:
- the initial response, or null if there isn't one.
- Throws:
SaslException- if an error occurs computing the response.
-
getChallengeResponse
public byte[] getChallengeResponse(byte[] challenge) throws SaslExceptionDescription copied from interface:MechanismCreate a response based on a given challenge from the remote peer.- Parameters:
challenge- the challenge that this Mechanism should response to.- Returns:
- the response that answers the given challenge.
- Throws:
SaslException- if an error occurs computing the response.
-
verifyCompletion
public void verifyCompletion() throws SaslExceptionDescription copied from interface:MechanismVerifies that the SASL exchange has completed successfully. This is an opportunity for the mechanism to ensure that all mandatory steps have been completed successfully and to cleanup and resources that are held by this Mechanism.- Specified by:
verifyCompletionin interfaceMechanism- Overrides:
verifyCompletionin classAbstractMechanism- Throws:
SaslException- if the outcome of the SASL exchange is not valid for this Mechanism
-
-