APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.jndi.ldap.sasl

public final Class LdapSasl

extends Object
Class Inheritance
Imports
java.io.*, java.security.cert.X509Certificate, java.util.ArrayList, .Hashtable, .StringTokenizer, javax.naming.AuthenticationException, .AuthenticationNotSupportedException, .NamingException, javax.naming.ldap.Control, javax.security.auth.callback.CallbackHandler, javax.security.sasl.*, com.sun.jndi.ldap.Connection, .LdapClient, .LdapResult, sun.security.util.ChannelBindingException, .TlsChannelBinding, .TlsChannelBinding.TlsChannelBindingType

Handles SASL support.
Authors
Vincent Ryan, Rosanna Lee

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final int
private static final int
private static final byte[]
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static String[]

Returns:

A non-null array of String; each element of the array contains a single mechanism name.
getSaslMechanismNames
(String str)

Returns an array of SASL mechanisms given a string of space separated SASL mechanism names.

public static LdapResult

Returns:

LdapResult containing status of the bind
saslBind
(LdapClient clnt, Connection
The non-null connection to use for sending an LDAP BIND
conn
,
String
Non-null string name of host to connect to
server
,
String
Non-null DN to bind as; also used as authentication ID
dn
,
Object
Possibly null password; can be byte[], char[] or String
pw
,
String
A non-null space-separated list of SASL authentication mechanisms.
authMech
,
Hashtable<?, ?>
The possibly null environment of the context, possibly containing properties for used by SASL mechanisms
env
,
Control[]
The possibly null controls to accompany the bind
bindCtls
)

Performs SASL bind.

private static NamingException
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHANNEL_BINDINGback to summary
private static final String CHANNEL_BINDING
CHANNEL_BINDING_TYPEback to summary
private static final String CHANNEL_BINDING_TYPE
LDAP_SASL_BIND_IN_PROGRESSback to summary
private static final int LDAP_SASL_BIND_IN_PROGRESS
LDAP_SUCCESSback to summary
private static final int LDAP_SUCCESS
NO_BYTESback to summary
private static final byte[] NO_BYTES
SASL_AUTHZ_IDback to summary
private static final String SASL_AUTHZ_ID
SASL_CALLBACKback to summary
private static final String SASL_CALLBACK
SASL_REALMback to summary
private static final String SASL_REALM

Constructor Detail

LdapSaslback to summary
private LdapSasl()

Method Detail

getSaslMechanismNamesback to summary
private static String[] getSaslMechanismNames(String str)

Returns an array of SASL mechanisms given a string of space separated SASL mechanism names.

Returns:String[]

A non-null array of String; each element of the array contains a single mechanism name.

saslBindback to summary
public static LdapResult saslBind(LdapClient clnt, Connection conn, String server, String dn, Object pw, String authMech, Hashtable<?, ?> env, Control[] bindCtls) throws IOException, NamingException

Performs SASL bind. Creates a SaslClient by using a default CallbackHandler that uses the Context.SECURITY_PRINCIPAL and Context.SECURITY_CREDENTIALS properties to satisfy the callbacks, and by using the SASL_AUTHZ_ID property as the authorization id. If the SASL_AUTHZ_ID property has not been set, Context.SECURITY_PRINCIPAL is used. If SASL_CALLBACK has been set, use that instead of the default CallbackHandler.

If bind is successful and the selected SASL mechanism has a security layer, set inStream and outStream to be filter streams that use the security layer. These will be used for subsequent communication with the server.

Parameters
conn:Connection

The non-null connection to use for sending an LDAP BIND

server:String

Non-null string name of host to connect to

dn:String

Non-null DN to bind as; also used as authentication ID

pw:Object

Possibly null password; can be byte[], char[] or String

authMech:String

A non-null space-separated list of SASL authentication mechanisms.

env:Hashtable<?, ?>

The possibly null environment of the context, possibly containing properties for used by SASL mechanisms

bindCtls:Control[]

The possibly null controls to accompany the bind

Returns:LdapResult

LdapResult containing status of the bind

Annotations
@SuppressWarnings:unchecked
wrapInNamingExceptionback to summary
private static NamingException wrapInNamingException(Exception e)