public final class SaslUtils extends Object
Modifier and Type | Field and Description |
---|---|
static byte[] |
EMPTY_BYTES
A zero-length byte array, useful for sending and receiving empty SASL messages.
|
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
createPropertyMap(OptionMap optionMap,
boolean secure)
Create a SASL property map from an XNIO option map.
|
static boolean |
evaluateChallenge(SaslClient client,
ByteBuffer destination,
ByteBuffer source)
Evaluate a sasl challenge.
|
static boolean |
evaluateResponse(SaslServer server,
ByteBuffer destination,
ByteBuffer source)
Evaluate a sasl response.
|
static Iterator<SaslClientFactory> |
getSaslClientFactories()
Returns an iterator of all of the registered
SaslClientFactory s where the order is based on the
order of the Provider registration and/or class path order. |
static Iterator<SaslClientFactory> |
getSaslClientFactories(ClassLoader classLoader,
boolean includeGlobal)
Returns an iterator of all of the registered
SaslClientFactory s where the order is based on the
order of the Provider registration and/or class path order. |
static Iterator<SaslServerFactory> |
getSaslServerFactories()
Returns an iterator of all of the registered
SaslServerFactory s where the order is based on the
order of the Provider registration and/or class path order. |
static Iterator<SaslServerFactory> |
getSaslServerFactories(ClassLoader classLoader,
boolean includeGlobal)
Returns an iterator of all of the registered
SaslServerFactory s where the order is based on the
order of the Provider registration and/or class path order. |
static void |
unwrap(SaslClient client,
ByteBuffer destination,
ByteBuffer source)
Unwrap a message.
|
static void |
unwrap(SaslServer server,
ByteBuffer destination,
ByteBuffer source)
Unwrap a message.
|
static void |
wrap(SaslClient client,
ByteBuffer destination,
ByteBuffer source)
Wrap a message.
|
static void |
wrap(SaslServer server,
ByteBuffer destination,
ByteBuffer source)
Wrap a message.
|
public static final byte[] EMPTY_BYTES
public static Iterator<SaslServerFactory> getSaslServerFactories(ClassLoader classLoader, boolean includeGlobal)
SaslServerFactory
s where the order is based on the
order of the Provider registration and/or class path order. Class path providers are listed before
global providers; in the event of a name conflict, the class path provider is preferred.classLoader
- the class loader to useincludeGlobal
- true
to include globally registered providers, false
to exclude themIterator
of SaslServerFactory
spublic static Iterator<SaslServerFactory> getSaslServerFactories()
SaslServerFactory
s where the order is based on the
order of the Provider registration and/or class path order.Iterator
of SaslServerFactory
spublic static Iterator<SaslClientFactory> getSaslClientFactories(ClassLoader classLoader, boolean includeGlobal)
SaslClientFactory
s where the order is based on the
order of the Provider registration and/or class path order. Class path providers are listed before
global providers; in the event of a name conflict, the class path provider is preferred.classLoader
- the class loader to useincludeGlobal
- true
to include globally registered providers, false
to exclude themIterator
of SaslClientFactory
spublic static Iterator<SaslClientFactory> getSaslClientFactories()
SaslClientFactory
s where the order is based on the
order of the Provider registration and/or class path order.Iterator
of SaslClientFactory
spublic static boolean evaluateChallenge(SaslClient client, ByteBuffer destination, ByteBuffer source) throws SaslException
false
then the negotiation is not yet complete and the data
written into the destination buffer needs to be sent to the server as a response. If the result is true
then negotiation was successful and no response needs to be sent to the server.
The source
buffer should have its position and remaining length set to encompass exactly one SASL
message. The SASL message itself does not encode any length information so it is up to the protocol implementer
to ensure that the message is properly framed.
client
- the SASL client to use to evaluate the challenge messagedestination
- the destination buffer into which the response message should be written, if anysource
- the source buffer from which the challenge message should be readtrue
if negotiation is complete and successful, false
otherwiseSaslException
- if negotiation failed or another error occurredpublic static boolean evaluateResponse(SaslServer server, ByteBuffer destination, ByteBuffer source) throws SaslException
false
then the negotiation is not yet complete and the data
written into the destination buffer needs to be sent to the server as a response. If the result is true
then negotiation was successful and no response needs to be sent to the client (other than a successful completion
message, depending on the protocol).
The source
buffer should have its position and remaining length set to encompass exactly one SASL
message. The SASL message itself does not encode any length information so it is up to the protocol implementer
to ensure that the message is properly framed.
server
- the SASL server to use to evaluate the response messagedestination
- the destination buffer into which the response message should be written, if anysource
- the source buffer from which the response message should be readtrue
if negotiation is complete and successful, false
otherwiseSaslException
- if negotiation failed or another error occurredpublic static void wrap(SaslClient client, ByteBuffer destination, ByteBuffer source) throws SaslException
The source
buffer should have its position and remaining length set to encompass exactly one SASL
message (without the length field). The SASL message itself does not encode any length information so it is up
to the protocol implementer to ensure that the message is properly framed.
client
- the SASL client to wrap withdestination
- the buffer into which bytes should be writtensource
- the buffers from which bytes should be readSaslException
- if a SASL error occursSaslClient.wrap(byte[], int, int)
public static void wrap(SaslServer server, ByteBuffer destination, ByteBuffer source) throws SaslException
The source
buffer should have its position and remaining length set to encompass exactly one SASL
message (without the length field). The SASL message itself does not encode any length information so it is up
to the protocol implementer to ensure that the message is properly framed.
server
- the SASL server to wrap withdestination
- the buffer into which bytes should be writtensource
- the buffers from which bytes should be readSaslException
- if a SASL error occursSaslServer.wrap(byte[], int, int)
public static void unwrap(SaslClient client, ByteBuffer destination, ByteBuffer source) throws SaslException
The source
buffer should have its position and remaining length set to encompass exactly one SASL
message (without the length field). The SASL message itself does not encode any length information so it is up
to the protocol implementer to ensure that the message is properly framed.
client
- the SASL client to unwrap withdestination
- the buffer into which bytes should be writtensource
- the buffers from which bytes should be readSaslException
- if a SASL error occursSaslClient.unwrap(byte[], int, int)
public static void unwrap(SaslServer server, ByteBuffer destination, ByteBuffer source) throws SaslException
The source
buffer should have its position and remaining length set to encompass exactly one SASL
message (without the length field). The SASL message itself does not encode any length information so it is up
to the protocol implementer to ensure that the message is properly framed.
server
- the SASL server to unwrap withdestination
- the buffer into which bytes should be writtensource
- the buffers from which bytes should be readSaslException
- if a SASL error occursSaslServer.unwrap(byte[], int, int)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.