public abstract class AbstractSaslParticipant extends Object
Modifier and Type | Field and Description |
---|---|
static byte[] |
NO_BYTES
An empty byte array.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractSaslParticipant(String mechanismName,
String protocol,
String serverName,
CallbackHandler callbackHandler)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Dispose of this participant.
|
protected CallbackHandler |
getCallbackHandler()
Get the configured authentication callback handler.
|
SaslStateContext |
getContext()
Get the current negotiation state context.
|
String |
getMechanismName()
Get the name of this mechanism.
|
Object |
getNegotiatedProperty(String propName)
Get a property negotiated between this participant and the other.
|
protected String |
getProtocol()
Get the protocol name.
|
protected String |
getServerName()
Get the server name.
|
protected SaslWrapper |
getWrapper()
Get the current configured SASL wrapper, if any.
|
protected void |
handleCallbacks(Callback... callbacks)
Handle callbacks, wrapping exceptions as needed (including unsupported callbacks).
|
void |
init() |
boolean |
isComplete()
Determine whether the authentication exchange has completed.
|
protected void |
setWrapper(SaslWrapper wrapper)
Set the current configured SASL wrapper, if any.
|
protected void |
tryHandleCallbacks(Callback... callbacks)
Handle callbacks, wrapping exceptions as needed.
|
byte[] |
unwrap(byte[] incoming,
int offset,
int len)
Unwraps a byte array received from the other participant.
|
byte[] |
wrap(byte[] outgoing,
int offset,
int len)
Wraps a byte array to be sent to the other participant.
|
protected AbstractSaslParticipant(String mechanismName, String protocol, String serverName, CallbackHandler callbackHandler)
mechanismName
- the name of the defined mechanismprotocol
- the protocolserverName
- the server namecallbackHandler
- the callback handlerprotected void handleCallbacks(Callback... callbacks) throws SaslException
callbacks
- the callbacks to handleSaslException
- if a callback failedprotected void tryHandleCallbacks(Callback... callbacks) throws SaslException, UnsupportedCallbackException
callbacks
- the callbacks to handleSaslException
- if a callback failedUnsupportedCallbackException
- if a callback isn't supportedpublic void init()
public String getMechanismName()
protected String getProtocol()
protected String getServerName()
protected CallbackHandler getCallbackHandler()
protected SaslWrapper getWrapper()
null
if none is configuredpublic SaslStateContext getContext()
protected void setWrapper(SaslWrapper wrapper)
wrapper
- the SASL wrapper, or null
to disable wrappingpublic byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException
outgoing
- a non-null
byte array containing the bytes to encodeoffset
- the first byte to encodelen
- the number of bytes to usenull
byte array containing the encoded bytesSaslException
- if wrapping failsIllegalStateException
- if wrapping is not configuredpublic byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
incoming
- a non-null
byte array containing the bytes to decodeoffset
- the first byte to decodelen
- the number of bytes to usenull
byte array containing the decoded bytesSaslException
- if wrapping failsIllegalStateException
- if wrapping is not configuredpublic boolean isComplete()
true
if the exchange has completedpublic Object getNegotiatedProperty(String propName)
propName
- the property namenull
if not definedpublic void dispose() throws SaslException
SaslException
- if disposal failedCopyright © 2018 JBoss by Red Hat. All rights reserved.