|
XNIO API 3.0.7.GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xnio.sasl.SaslUtils
public final class SaslUtils
Utility methods for handling SASL authentication using NIO-style programming methods.
| Field Summary | |
|---|---|
static byte[] |
EMPTY_BYTES
A zero-length byte array, useful for sending and receiving empty SASL messages. |
| Method Summary | |
|---|---|
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 SaslClientFactorys 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 SaslClientFactorys 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 SaslServerFactorys 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 SaslServerFactorys 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte[] EMPTY_BYTES
| Method Detail |
|---|
public static Iterator<SaslServerFactory> getSaslServerFactories(ClassLoader classLoader,
boolean includeGlobal)
SaslServerFactorys 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 them
Iterator of SaslServerFactoryspublic static Iterator<SaslServerFactory> getSaslServerFactories()
SaslServerFactorys where the order is based on the
order of the Provider registration and/or class path order.
Iterator of SaslServerFactorys
public static Iterator<SaslClientFactory> getSaslClientFactories(ClassLoader classLoader,
boolean includeGlobal)
SaslClientFactorys 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 them
Iterator of SaslClientFactoryspublic static Iterator<SaslClientFactory> getSaslClientFactories()
SaslClientFactorys where the order is based on the
order of the Provider registration and/or class path order.
Iterator of SaslClientFactorys
public 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 read
true if negotiation is complete and successful, false otherwise
SaslException - if negotiation failed or another error occurred
public 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 read
true if negotiation is complete and successful, false otherwise
SaslException - if negotiation failed or another error occurred
public 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 read
SaslException - 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 read
SaslException - 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 read
SaslException - 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 read
SaslException - if a SASL error occursSaslServer.unwrap(byte[], int, int)
public static Map<String,Object> createPropertyMap(OptionMap optionMap,
boolean secure)
optionMap - the option mapsecure - true if the channel is secure, false otherwise
|
XNIO API 3.0.7.GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||