public abstract class AbstractSaslParticipant
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private javax.security.auth.callback.CallbackHandler |
callbackHandler |
private SaslStateContext |
context |
private java.lang.String |
mechanismName |
static byte[] |
NO_BYTES
An empty byte array.
|
private java.lang.String |
protocol |
private java.lang.String |
serverName |
private SaslState |
state |
private SaslWrapper |
wrapper |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSaslParticipant(java.lang.String mechanismName,
java.lang.String protocol,
java.lang.String serverName,
javax.security.auth.callback.CallbackHandler callbackHandler)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Dispose of this participant.
|
(package private) byte[] |
evaluateMessage(byte[] message) |
protected javax.security.auth.callback.CallbackHandler |
getCallbackHandler()
Get the configured authentication callback handler.
|
SaslStateContext |
getContext()
Get the current negotiation state context.
|
java.lang.String |
getMechanismName()
Get the name of this mechanism.
|
java.lang.Object |
getNegotiatedProperty(java.lang.String propName)
Get a property negotiated between this participant and the other.
|
protected java.lang.String |
getProtocol()
Get the protocol name.
|
protected java.lang.String |
getServerName()
Get the server name.
|
protected SaslWrapper |
getWrapper()
Get the current configured SASL wrapper, if any.
|
protected void |
handleCallbacks(javax.security.auth.callback.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(javax.security.auth.callback.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.
|
public static final byte[] NO_BYTES
private final SaslStateContext context
private final java.lang.String mechanismName
private final javax.security.auth.callback.CallbackHandler callbackHandler
private final java.lang.String protocol
private final java.lang.String serverName
private SaslState state
private SaslWrapper wrapper
protected AbstractSaslParticipant(java.lang.String mechanismName,
java.lang.String protocol,
java.lang.String serverName,
javax.security.auth.callback.CallbackHandler callbackHandler)
mechanismName - the name of the defined mechanismprotocol - the protocolserverName - the server namecallbackHandler - the callback handlerprotected void handleCallbacks(javax.security.auth.callback.Callback... callbacks)
throws javax.security.sasl.SaslException
callbacks - the callbacks to handlejavax.security.sasl.SaslException - if a callback failedprotected void tryHandleCallbacks(javax.security.auth.callback.Callback... callbacks)
throws javax.security.sasl.SaslException,
javax.security.auth.callback.UnsupportedCallbackException
callbacks - the callbacks to handlejavax.security.sasl.SaslException - if a callback failedjavax.security.auth.callback.UnsupportedCallbackException - if a callback isn't supportedpublic void init()
public java.lang.String getMechanismName()
protected java.lang.String getProtocol()
protected java.lang.String getServerName()
protected javax.security.auth.callback.CallbackHandler getCallbackHandler()
protected SaslWrapper getWrapper()
null if none is configuredpublic SaslStateContext getContext()
byte[] evaluateMessage(byte[] message)
throws javax.security.sasl.SaslException
javax.security.sasl.SaslExceptionprotected void setWrapper(SaslWrapper wrapper)
wrapper - the SASL wrapper, or null to disable wrappingpublic byte[] wrap(byte[] outgoing,
int offset,
int len)
throws javax.security.sasl.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 bytesjavax.security.sasl.SaslException - if wrapping failsjava.lang.IllegalStateException - if wrapping is not configuredpublic byte[] unwrap(byte[] incoming,
int offset,
int len)
throws javax.security.sasl.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 bytesjavax.security.sasl.SaslException - if wrapping failsjava.lang.IllegalStateException - if wrapping is not configuredpublic boolean isComplete()
true if the exchange has completedpublic java.lang.Object getNegotiatedProperty(java.lang.String propName)
propName - the property namenull if not definedpublic void dispose()
throws javax.security.sasl.SaslException
javax.security.sasl.SaslException - if disposal failed