This class defines the policy of how to locate, load, and instantiate SASL clients and servers.
For example, an application or library gets a SASL client by doing something like:
SaslClient sc = Sasl.createSaslClient(mechanisms,
authorizationId, protocol, serverName, props, callbackHandler);
It can then proceed to use the instance to create an authentication connection.
Similarly, a server gets a SASL server by using code that looks as follows:
SaslServer ss = Sasl.createSaslServer(mechanism,
protocol, serverName, props, callbackHandler);
| Modifier and Type | Field and Description |
|---|---|
| public static final String | BOUND_SERVER_NAME
The name of a property that specifies the bound server name for an unbound server. |
| public static final String | CREDENTIALS
The name of a property that specifies the credentials to use. |
| private static List | |
| private static final Logger | logger
Logger for debug messages |
| public static final String | MAX_BUFFER
The name of a property that specifies the maximum size of the receive
buffer in bytes of |
| public static final String | POLICY_FORWARD_SECRECY
The name of a property that specifies whether mechanisms that implement forward secrecy between sessions are required. |
| public static final String | POLICY_NOACTIVE
The name of a property that specifies whether mechanisms susceptible to active (non-dictionary) attacks are not permitted. |
| public static final String | POLICY_NOANONYMOUS
The name of a property that specifies whether mechanisms that accept anonymous login are not permitted. |
| public static final String | POLICY_NODICTIONARY
The name of a property that specifies whether mechanisms susceptible to passive dictionary attacks are not permitted. |
| public static final String | POLICY_NOPLAINTEXT
The name of a property that specifies whether mechanisms susceptible to simple plain passive attacks (e.g., "PLAIN") are not permitted. |
| public static final String | POLICY_PASS_CREDENTIALS
The name of a property that specifies whether mechanisms that pass client credentials are required. |
| public static final String | QOP
The name of a property that specifies the quality-of-protection to use. |
| public static final String | RAW_SEND_SIZE
The name of a property that specifies the maximum size of the raw send
buffer in bytes of |
| public static final String | REUSE
The name of a property that specifies whether to reuse previously authenticated session information. |
| private static final String | |
| public static final String | SERVER_AUTH
The name of a property that specifies whether the server must authenticate to the client. |
| public static final String | STRENGTH
The name of a property that specifies the cipher strength to use. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static SaslClient | Returns: A possibly nullSaslClient created using the parameters
supplied. If null, cannot find a SaslClientFactory
that will produce one.The non-null list of mechanism names to try. Each is the
IANA-registered name of a SASL mechanism. (e.g. "GSSAPI", "CRAM-MD5"). mechanisms, String The possibly null protocol-dependent
identification to be used for authorization.
If null or empty, the server derives an authorization
ID from the client's authentication credentials.
When the SASL authentication completes successfully,
the specified entity is granted access. authorizationId, String The non-null string name of the protocol for which
the authentication is being performed (e.g., "ldap"). protocol, String The non-null fully-qualified host name of the server
to authenticate to. serverName, Map<String, ?> The possibly null set of properties used to
select the SASL mechanism and to configure the authentication
exchange of the selected mechanism.
For example, if props, CallbackHandler props contains the
Sasl.POLICY_NOPLAINTEXT property with the value
"true", then the selected
SASL mechanism must not be susceptible to simple plain passive attacks.
In addition to the standard properties declared in this class,
other, possibly mechanism-specific, properties can be included.
Properties not relevant to the selected mechanism are ignored,
including any map entries with non-String keys.The possibly null callback handler to used by the SASL
mechanisms to get further information from the application/library
to complete the authentication. For example, a SASL mechanism might
require the authentication ID, password and realm from the caller.
The authentication ID is requested by using a cbh)NameCallback.
The password is requested by using a PasswordCallback.
The realm is requested by using a RealmChoiceCallback if there is a list
of realms to choose from, and by using a RealmCallback if
the realm must be entered.Creates a |
| public static SaslServer | Returns: A possibly nullSaslServer created using the parameters
supplied. If null, cannot find a SaslServerFactory
that will produce one.The non-null mechanism name. It must be an
IANA-registered name of a SASL mechanism. (e.g. "GSSAPI", "CRAM-MD5"). mechanism, String The non-null string name of the protocol for which
the authentication is being performed (e.g., "ldap"). protocol, String The fully qualified host name of the server, or null
if the server is not bound to any specific host name. If the mechanism
does not allow an unbound server, a serverName, Map<String, ?> SaslException will
be thrown.The possibly null set of properties used to
select the SASL mechanism and to configure the authentication
exchange of the selected mechanism.
For example, if props, CallbackHandler props contains the
Sasl.POLICY_NOPLAINTEXT property with the value
"true", then the selected
SASL mechanism must not be susceptible to simple plain passive attacks.
In addition to the standard properties declared in this class,
other, possibly mechanism-specific, properties can be included.
Properties not relevant to the selected mechanism are ignored,
including any map entries with non-String keys.The possibly null callback handler to used by the SASL
mechanisms to get further information from the application/library
to complete the authentication. For example, a SASL mechanism might
require the authentication ID, password and realm from the caller.
The authentication ID is requested by using a cbh)NameCallback.
The password is requested by using a PasswordCallback.
The realm is requested by using a RealmChoiceCallback if there is a list
of realms to choose from, and by using a RealmCallback if
the realm must be entered.Creates a |
| private static Set | |
| public static Enumeration | Returns: A non-null enumeration of known factories for producingSaslClient.Gets an enumeration of known factories for producing |
| public static Enumeration | Returns: A non-null enumeration of known factories for producingSaslServer.Gets an enumeration of known factories for producing |
| private static boolean | |
| private static Object |
| BOUND_SERVER_NAME | back to summary |
|---|---|
| public static final String BOUND_SERVER_NAME The name of a property that specifies the bound server name for
an unbound server. A server is created as an unbound server by setting
the | |
| CREDENTIALS | back to summary |
|---|---|
| public static final String CREDENTIALS The name of a property that specifies the credentials to use.
The property contains a mechanism-specific Java credential object.
Mechanism implementations may examine the value of this property
to determine whether it is a class that they support.
The property may be used to supply credentials to a mechanism that
supports delegated authentication.
| |
| disabledMechanisms | back to summary |
|---|---|
| private static List<String> disabledMechanisms | |
| logger | back to summary |
|---|---|
| private static final Logger logger Logger for debug messages | |
| MAX_BUFFER | back to summary |
|---|---|
| public static final String MAX_BUFFER The name of a property that specifies the maximum size of the receive
buffer in bytes of | |
| POLICY_FORWARD_SECRECY | back to summary |
|---|---|
| public static final String POLICY_FORWARD_SECRECY The name of a property that specifies whether mechanisms that implement
forward secrecy between sessions are required. Forward secrecy
means that breaking into one session will not automatically
provide information for breaking into future sessions.
The property
contains | |
| POLICY_NOACTIVE | back to summary |
|---|---|
| public static final String POLICY_NOACTIVE The name of a property that specifies whether
mechanisms susceptible to active (non-dictionary) attacks
are not permitted.
The property contains | |
| POLICY_NOANONYMOUS | back to summary |
|---|---|
| public static final String POLICY_NOANONYMOUS The name of a property that specifies whether mechanisms that accept
anonymous login are not permitted. The property contains | |
| POLICY_NODICTIONARY | back to summary |
|---|---|
| public static final String POLICY_NODICTIONARY The name of a property that specifies whether
mechanisms susceptible to passive dictionary attacks are not permitted.
The property contains | |
| POLICY_NOPLAINTEXT | back to summary |
|---|---|
| public static final String POLICY_NOPLAINTEXT The name of a property that specifies
whether mechanisms susceptible to simple plain passive attacks (e.g.,
"PLAIN") are not permitted. The property
contains | |
| POLICY_PASS_CREDENTIALS | back to summary |
|---|---|
| public static final String POLICY_PASS_CREDENTIALS The name of a property that specifies whether
mechanisms that pass client credentials are required. The property
contains | |
| QOP | back to summary |
|---|---|
| public static final String QOP The name of a property that specifies the quality-of-protection to use. The property contains a comma-separated, ordered list of quality-of-protection values that the client or server is willing to support. A qop value is one of
"auth".
The value of this constant is "javax.security.sasl.qop".
| |
| RAW_SEND_SIZE | back to summary |
|---|---|
| public static final String RAW_SEND_SIZE The name of a property that specifies the maximum size of the raw send
buffer in bytes of | |
| REUSE | back to summary |
|---|---|
| public static final String REUSE The name of a property that specifies whether to reuse previously authenticated session information. The property contains "true" if the mechanism implementation may attempt to reuse previously authenticated session information; it contains "false" if the implementation must not reuse previously authenticated session information. A setting of "true" serves only as a hint: it does not necessarily entail actual reuse because reuse might not be possible due to a number of reasons, including, but not limited to, lack of mechanism support for reuse, expiration of reusable information, and the peer's refusal to support reuse. The property's default value is "false". The value of this constant is "javax.security.sasl.reuse". Note that all other parameters and properties required to create a SASL client/server instance must be provided regardless of whether this property has been supplied. That is, you cannot supply any less information in anticipation of reuse. Mechanism implementations that support reuse might allow customization of its implementation, for factors such as cache size, timeouts, and criteria for reusability. Such customizations are implementation-dependent. | |
| SASL_LOGGER_NAME | back to summary |
|---|---|
| private static final String SASL_LOGGER_NAME | |
| SERVER_AUTH | back to summary |
|---|---|
| public static final String SERVER_AUTH The name of a property that specifies whether the
server must authenticate to the client. The property contains
| |
| STRENGTH | back to summary |
|---|---|
| public static final String STRENGTH The name of a property that specifies the cipher strength to use. The property contains a comma-separated, ordered list of cipher strength values that the client or server is willing to support. A strength value is one of
If this property is absent, the default strength is "high,medium,low".
The value of this constant is "javax.security.sasl.strength".
| |
| Sasl | back to summary |
|---|---|
| private Sasl() | |
| createSaslClient | back to summary |
|---|---|
| public static SaslClient createSaslClient(String[] mechanisms, String authorizationId, String protocol, String serverName, Map<String, ?> props, CallbackHandler cbh) throws SaslException Creates a
A security provider for SaslClientFactory registers with the
JCA Security Provider Framework keys of the form See the "Java Cryptography Architecture API Specification & Reference" for information about how to install and configure security service providers. Implementation Note The JDK Reference Implementation additionally uses the
If a mechanism is listed in the
| |
| createSaslServer | back to summary |
|---|---|
| public static SaslServer createSaslServer(String mechanism, String protocol, String serverName, Map<String, ?> props, CallbackHandler cbh) throws SaslException Creates a
A security provider for SaslServerFactory registers with the
JCA Security Provider Framework keys of the form See the "Java Cryptography Architecture API Specification & Reference" for information about how to install and configure security service providers. Implementation Note The JDK Reference Implementation additionally uses the
If
| |
| getFactories | back to summary |
|---|---|
| private static Set | |
| getSaslClientFactories | back to summary |
|---|---|
| public static Enumeration Gets an enumeration of known factories for producing
| |
| getSaslServerFactories | back to summary |
|---|---|
| public static Enumeration Gets an enumeration of known factories for producing
| |
| isDisabled | back to summary |
|---|---|
| private static boolean isDisabled(String name) | |
| loadFactory | back to summary |
|---|---|
| private static Object loadFactory(Provider. | |