Class AbstractMechanism
java.lang.Object
org.apache.qpid.protonj2.engine.sasl.client.AbstractMechanism
- All Implemented Interfaces:
Mechanism
- Direct Known Subclasses:
AnonymousMechanism
,CramMD5Mechanism
,ExternalMechanism
,PlainMechanism
,ScramSHA1Mechanism
,ScramSHA256Mechanism
,ScramSHA512Mechanism
,XOauth2Mechanism
Base class for SASL Authentication Mechanism that implements the basic
methods of a Mechanism class.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetChallengeResponse
(SaslCredentialsProvider credentials, ProtonBuffer challenge) Create a response based on a given challenge from the remote peer.getInitialResponse
(SaslCredentialsProvider credentials) Create an initial response based on selected mechanism.boolean
Allows the mechanism to indicate if it is enabled by default, or only when explicitly enabled through configuring the permitted SASL mechanisms.toString()
void
Verifies that the SASL exchange has completed successfully.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.qpid.protonj2.engine.sasl.client.Mechanism
getName, isApplicable
-
Field Details
-
EMPTY
-
-
Constructor Details
-
AbstractMechanism
public AbstractMechanism()
-
-
Method Details
-
getInitialResponse
Description copied from interface:Mechanism
Create an initial response based on selected mechanism. May be null if there is no initial response.- Specified by:
getInitialResponse
in interfaceMechanism
- Parameters:
credentials
- The credentials that are supplied for this SASL negotiation.- Returns:
- the initial response, or null if there isn't one.
- Throws:
SaslException
- if an error occurs generating the initial response.
-
getChallengeResponse
public ProtonBuffer getChallengeResponse(SaslCredentialsProvider credentials, ProtonBuffer challenge) throws SaslException Description copied from interface:Mechanism
Create a response based on a given challenge from the remote peer.- Specified by:
getChallengeResponse
in interfaceMechanism
- 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:
SaslException
- if an error occurs generating the challenge response.
-
verifyCompletion
Description copied from interface:Mechanism
Verifies 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:
verifyCompletion
in interfaceMechanism
- Throws:
SaslException
- if the outcome of the SASL exchange is not valid for this Mechanism
-
isEnabledByDefault
public boolean isEnabledByDefault()Description copied from interface:Mechanism
Allows the mechanism to indicate if it is enabled by default, or only when explicitly enabled through configuring the permitted SASL mechanisms. Any mechanism selection logic should examine this value along with the configured allowed mechanism and decide if this one should be used. Typically most mechanisms can be enabled by default but some require explicit configuration in order to operate which implies that selecting them by default would always cause an authentication error if that mechanism matches the highest priority value offered by the remote peer.- Specified by:
isEnabledByDefault
in interfaceMechanism
- Returns:
- true if this Mechanism is enabled by default.
-
toString
-