Class ScramSHA1Mechanism
- java.lang.Object
-
- org.apache.qpid.protonj2.engine.sasl.client.AbstractMechanism
-
- org.apache.qpid.protonj2.engine.sasl.client.ScramSHA1Mechanism
-
- All Implemented Interfaces:
Mechanism
public class ScramSHA1Mechanism extends AbstractMechanism
Implements the SASL Scram SHA1 authentication Mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHMAC_SHA_1static SymbolSCRAM_SHA_1A singleton instance of the symbolic mechanism name.static java.lang.StringSHA_1-
Fields inherited from class org.apache.qpid.protonj2.engine.sasl.client.AbstractMechanism
EMPTY
-
-
Constructor Summary
Constructors Constructor Description ScramSHA1Mechanism()Creates an instance of theScramSHA1Mechanismwith a generated client Nonce.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProtonBuffergetChallengeResponse(SaslCredentialsProvider credentials, ProtonBuffer challenge)Create a response based on a given challenge from the remote peer.ProtonBuffergetInitialResponse(SaslCredentialsProvider credentials)Create an initial response based on selected mechanism.SymbolgetName()booleanisApplicable(SaslCredentialsProvider credentials)Allows the Mechanism to determine if it is a valid choice based on the configured credentials at the time of selection.voidverifyCompletion()Verifies that the SASL exchange has completed successfully.-
Methods inherited from class org.apache.qpid.protonj2.engine.sasl.client.AbstractMechanism
isEnabledByDefault, toString
-
-
-
-
Field Detail
-
SHA_1
public static final java.lang.String SHA_1
- See Also:
- Constant Field Values
-
HMAC_SHA_1
public static final java.lang.String HMAC_SHA_1
- See Also:
- Constant Field Values
-
SCRAM_SHA_1
public static final Symbol SCRAM_SHA_1
A singleton instance of the symbolic mechanism name.
-
-
Constructor Detail
-
ScramSHA1Mechanism
public ScramSHA1Mechanism()
Creates an instance of theScramSHA1Mechanismwith a generated client Nonce.
-
-
Method Detail
-
getName
public Symbol getName()
- Returns:
- the well known name of this SASL mechanism.
-
isApplicable
public boolean isApplicable(SaslCredentialsProvider credentials)
Description copied from interface:MechanismAllows the Mechanism to determine if it is a valid choice based on the configured credentials at the time of selection.- Parameters:
credentials- the login credentials available at the time of mechanism selection.- Returns:
- true if the mechanism can be used with the provided credentials
-
getInitialResponse
public ProtonBuffer getInitialResponse(SaslCredentialsProvider credentials) throws javax.security.sasl.SaslException
Description copied from interface:MechanismCreate an initial response based on selected mechanism. May be null if there is no initial response.- Specified by:
getInitialResponsein interfaceMechanism- Overrides:
getInitialResponsein classAbstractMechanism- Parameters:
credentials- The credentials that are supplied for this SASL negotiation.- Returns:
- the initial response, or null if there isn't one.
- Throws:
javax.security.sasl.SaslException- if an error occurs generating the initial response.
-
getChallengeResponse
public ProtonBuffer getChallengeResponse(SaslCredentialsProvider credentials, ProtonBuffer challenge) throws javax.security.sasl.SaslException
Description copied from interface:MechanismCreate a response based on a given challenge from the remote peer.- Specified by:
getChallengeResponsein interfaceMechanism- Overrides:
getChallengeResponsein classAbstractMechanism- Parameters:
credentials- The credentials that are supplied for this SASL negotiation.challenge- The challenge that this Mechanism should response to.- Returns:
- the response that answers the given challenge.
- Throws:
javax.security.sasl.SaslException- if an error occurs generating the challenge response.
-
verifyCompletion
public void verifyCompletion() throws javax.security.sasl.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:
javax.security.sasl.SaslException- if the outcome of the SASL exchange is not valid for this Mechanism
-
-