Package org.wildfly.security.sasl.util
Class AbstractSaslClient
- java.lang.Object
-
- org.wildfly.security.sasl.util.AbstractSaslParticipant
-
- org.wildfly.security.sasl.util.AbstractSaslClient
-
- All Implemented Interfaces:
SaslClient
,SaslWrapper
- Direct Known Subclasses:
AnonymousSaslClient
,EntitySaslClient
,Gs2SaslClient
,LocalUserClient
,OAuth2SaslClient
,OTPSaslClient
,ScramSaslClient
public abstract class AbstractSaslClient extends AbstractSaslParticipant implements SaslClient
A base class for SASL client implementations.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description private String
authorizationId
private boolean
hasInitialResponse
-
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 Modifier Constructor Description protected
AbstractSaslClient(String mechanismName, String protocol, String serverName, CallbackHandler callbackHandler, String authorizationId, boolean hasInitialResponse)
Deprecated.protected
AbstractSaslClient(String mechanismName, String protocol, String serverName, CallbackHandler callbackHandler, String authorizationId, boolean hasInitialResponse, ElytronMessages log)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
evaluateChallenge(byte[] challenge)
Evaluate an authentication challenge received from the server.protected String
getAuthorizationId()
Get the specified authorization ID.boolean
hasInitialResponse()
Determines whether this mechanism has an optional initial response.-
Methods inherited from class org.wildfly.security.sasl.util.AbstractSaslParticipant
assertComplete, dispose, evaluateMessage, evaluateMessage, getCallbackHandler, getIntProperty, getMechanismName, getNegotiatedProperty, getProtocol, getServerName, getStringProperty, getWrapper, handleCallbacks, init, 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.SaslClient
dispose, getMechanismName, getNegotiatedProperty, isComplete, unwrap, wrap
-
-
-
-
Field Detail
-
authorizationId
private final String authorizationId
-
hasInitialResponse
private final boolean hasInitialResponse
-
-
Constructor Detail
-
AbstractSaslClient
protected AbstractSaslClient(String mechanismName, String protocol, String serverName, CallbackHandler callbackHandler, String authorizationId, boolean hasInitialResponse, ElytronMessages log)
Construct a new instance.- Parameters:
mechanismName
- the SASL mechanism nameprotocol
- the protocolserverName
- the server namecallbackHandler
- the callback handler to use for authenticationauthorizationId
- the possiblynull
protocol-dependent name used for authorizationhasInitialResponse
-true
if the mechanism supports an initial response,false
otherwiselog
- mechanism specific logger
-
AbstractSaslClient
@Deprecated protected AbstractSaslClient(String mechanismName, String protocol, String serverName, CallbackHandler callbackHandler, String authorizationId, boolean hasInitialResponse)
Deprecated.Construct a new instance.- Parameters:
mechanismName
- the SASL mechanism nameprotocol
- the protocolserverName
- the server namecallbackHandler
- the callback handler to use for authenticationauthorizationId
- the possiblynull
protocol-dependent name used for authorizationhasInitialResponse
-true
if the mechanism supports an initial response,false
otherwise
-
-
Method Detail
-
evaluateChallenge
public byte[] evaluateChallenge(byte[] challenge) throws SaslException
Evaluate an authentication challenge received from the server.- Specified by:
evaluateChallenge
in interfaceSaslClient
- Parameters:
challenge
- the authentication challenge- Returns:
- the response to send to the server
- Throws:
SaslException
- if there is an error processing the server message
-
hasInitialResponse
public boolean hasInitialResponse()
Determines whether this mechanism has an optional initial response. If true, caller should callevaluateChallenge(byte[])
with an empty array to get the initial response.- Specified by:
hasInitialResponse
in interfaceSaslClient
- Returns:
true
if this mechanism has an initial response
-
getAuthorizationId
protected String getAuthorizationId()
Get the specified authorization ID.- Returns:
- the authorization ID
-
-