public class JndiConnection extends Object implements ProviderConnection
| Modifier and Type | Class and Description | 
|---|---|
protected static class  | 
JndiConnection.JndiExtendedRequest
Class for exposing extended request properties. 
 | 
protected static class  | 
JndiConnection.JndiExtendedResponse
Class for exposing extended response properties. 
 | 
protected class  | 
JndiConnection.JndiSearchIterator
Search iterator for JNDI naming enumeration. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
static String | 
AUTHENTICATION
The value of this property is a string that specifies the authentication mechanism(s) for the provider to use. 
 | 
static String | 
BINARY_ATTRIBUTES
The value of this property is a string that specifies additional binary attributes. 
 | 
private JndiProviderConfig | 
config
Provider configuration. 
 | 
private LdapContext | 
context
Ldap context. 
 | 
static String | 
CREDENTIALS
The value of this property is an object that specifies the credentials of the principal to be authenticated. 
 | 
static String | 
DELETE_RDN
The value of this property is a string that specifies whether the RDN attribute should be deleted for a modify dn
 operation. 
 | 
static String | 
DEREF_ALIASES
The value of this property is a string that specifies how aliases shall be handled by the provider. 
 | 
protected Logger | 
logger
Logger for this class. 
 | 
static String | 
PRINCIPAL
The value of this property is a string that specifies the identity of the principal to be authenticated. 
 | 
static String | 
REFERRAL
The value of this property is a string that specifies how referrals shall be handled by the provider. 
 | 
static String | 
SASL_AUTHZ_ID
The value of this property is a string that specifies the sasl authorization id. 
 | 
static String | 
SASL_MUTUAL_AUTH
The value of this property is a string that specifies the sasl mutual authentication flag. 
 | 
static String | 
SASL_QOP
The value of this property is a string that specifies the sasl quality of protection. 
 | 
static String | 
SASL_REALM
The value of this property is a string that specifies the sasl realm. 
 | 
static String | 
SASL_STRENGTH
The value of this property is a string that specifies the sasl security strength. 
 | 
static String | 
TYPES_ONLY
The value of this property is a string that specifies to only return attribute type names, no values. 
 | 
| Constructor and Description | 
|---|
JndiConnection(LdapContext lc,
              JndiProviderConfig pc)
Creates a new jndi connection. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
abandon(int messageId,
       RequestControl[] controls)
Abandon an operation. 
 | 
Response<Void> | 
add(AddRequest request)
Add an entry to an ldap. 
 | 
void | 
addUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
Adds a listener to receive unsolicited notifications. 
 | 
protected Response<Void> | 
anonymousBind(BindRequest request)
Performs an anonymous bind. 
 | 
Response<Void> | 
bind(BindRequest request)
Bind to the ldap. 
 | 
void | 
close(RequestControl[] controls)
Tear down this connection to an LDAP. 
 | 
Response<Boolean> | 
compare(CompareRequest request)
Compare an entry in the ldap. 
 | 
protected <T> Response<T> | 
createResponse(Request request,
              T result,
              ResultCode code,
              String[] urls,
              LdapContext ctx)
Creates an operation response with the supplied response data. 
 | 
Response<Void> | 
delete(DeleteRequest request)
Delete an entry in the ldap. 
 | 
Response<?> | 
extendedOperation(ExtendedRequest request)
Perform an extended operation in the ldap. 
 | 
static SearchControls | 
getCompareSearchControls()
Returns a search controls object configured to perform an LDAP compare operation. 
 | 
LdapContext | 
getLdapContext()
Returns the underlying ldap context. 
 | 
protected static Map<String,Object> | 
getSaslProperties(SaslConfig config)
Returns the JNDI properties for the supplied sasl configuration. 
 | 
protected LdapContext | 
initializeContext(Request request)
Creates a new ldap context using  
LdapContext.newInstance(Control[]). | 
Response<Void> | 
modify(ModifyRequest request)
Modify an entry in the ldap. 
 | 
Response<Void> | 
modifyDn(ModifyDnRequest request)
Modify the DN of an entry in the ldap. 
 | 
protected void | 
processNamingException(Request request,
                      NamingException e,
                      String[] urls,
                      LdapContext ctx)
Determines if the supplied naming exception should result in an operation retry. 
 | 
protected ResponseControl[] | 
processResponseControls(ControlProcessor<Control> processor,
                       RequestControl[] requestControls,
                       LdapContext ctx)
Retrieves the response controls from the supplied context and processes them with the supplied control processor. 
 | 
void | 
removeUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
Removes a listener from receiving unsolicited notifications. 
 | 
protected Response<Void> | 
saslBind(BindRequest request)
Performs a sasl bind. 
 | 
SearchIterator | 
search(SearchRequest request)
Search the ldap. 
 | 
void | 
searchAsync(SearchRequest request,
           SearchListener listener)
Search the ldap asynchronously. 
 | 
protected Response<Void> | 
simpleBind(BindRequest request)
Performs a simple bind. 
 | 
public static final String AUTHENTICATION
public static final String CREDENTIALS
public static final String PRINCIPAL
public static final String SASL_AUTHZ_ID
public static final String SASL_QOP
public static final String SASL_STRENGTH
public static final String SASL_MUTUAL_AUTH
public static final String SASL_REALM
public static final String DELETE_RDN
public static final String BINARY_ATTRIBUTES
public static final String DEREF_ALIASES
public static final String REFERRAL
public static final String TYPES_ONLY
protected final Logger logger
private LdapContext context
private final JndiProviderConfig config
public JndiConnection(LdapContext lc, JndiProviderConfig pc)
lc - ldap contextpc - provider configurationpublic LdapContext getLdapContext()
public void close(RequestControl[] controls) throws LdapException
ProviderConnectionclose in interface ProviderConnectioncontrols - request controlsLdapException - if an LDAP error occurspublic Response<Void> bind(BindRequest request) throws LdapException
ProviderConnectionbind in interface ProviderConnectionrequest - containing the data necessary to perform the operationLdapException - if an error occursprotected Response<Void> anonymousBind(BindRequest request) throws LdapException
request - to bind withLdapException - if an error occursprotected Response<Void> simpleBind(BindRequest request) throws LdapException
request - to bind withLdapException - if an error occursprotected Response<Void> saslBind(BindRequest request) throws LdapException
request - to bind withLdapException - if an error occurspublic Response<Void> add(AddRequest request) throws LdapException
ProviderConnectionadd in interface ProviderConnectionrequest - containing the data necessary to perform the operationLdapException - if an error occurspublic Response<Boolean> compare(CompareRequest request) throws LdapException
ProviderConnectioncompare in interface ProviderConnectionrequest - containing the data necessary to perform the operationLdapException - if an error occurspublic Response<Void> delete(DeleteRequest request) throws LdapException
ProviderConnectiondelete in interface ProviderConnectionrequest - containing the data necessary to perform the operationLdapException - if an error occurspublic Response<Void> modify(ModifyRequest request) throws LdapException
ProviderConnectionmodify in interface ProviderConnectionrequest - containing the data necessary to perform the operationLdapException - if an error occurspublic Response<Void> modifyDn(ModifyDnRequest request) throws LdapException
ProviderConnectionmodifyDn in interface ProviderConnectionrequest - containing the data necessary to perform the operationLdapException - if an error occurspublic SearchIterator search(SearchRequest request) throws LdapException
ProviderConnectionsearch in interface ProviderConnectionrequest - containing the data necessary to perform the operationLdapException - if an error occurspublic void searchAsync(SearchRequest request, SearchListener listener) throws LdapException
ProviderConnectionsearchAsync in interface ProviderConnectionrequest - containing the data necessary to perform the operationlistener - to be notified as results arriveLdapException - if an error occurspublic void abandon(int messageId,
                    RequestControl[] controls)
             throws LdapException
ProviderConnectionabandon in interface ProviderConnectionmessageId - of the operation to abandoncontrols - request controlsLdapException - if an error occurspublic Response<?> extendedOperation(ExtendedRequest request) throws LdapException
ProviderConnectionextendedOperation in interface ProviderConnectionrequest - containing the data necessary to perform the operationLdapException - if an error occurspublic void addUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
ProviderConnectionaddUnsolicitedNotificationListener in interface ProviderConnectionlistener - to receive unsolicited notificationspublic void removeUnsolicitedNotificationListener(UnsolicitedNotificationListener listener)
ProviderConnectionremoveUnsolicitedNotificationListener in interface ProviderConnectionlistener - that was registered to receive unsolicited notificationspublic static SearchControls getCompareSearchControls()
protected LdapContext initializeContext(Request request) throws NamingException
LdapContext.newInstance(Control[]). Adds any additional environment
 properties found in the supplied request to the context.request - to read properties fromNamingException - if a property cannot be added to the contextprotected <T> Response<T> createResponse(Request request, T result, ResultCode code, String[] urls, LdapContext ctx)
T - type of responserequest - containing controlsresult - of the operationcode - operation result codeurls - referral urlsctx - ldap contextprotected void processNamingException(Request request, NamingException e, String[] urls, LdapContext ctx) throws LdapException
request - that produced the exceptione - that was producedurls - referral urlsctx - that the exception occurred onLdapException - wrapping the naming exceptionprotected ResponseControl[] processResponseControls(ControlProcessor<Control> processor, RequestControl[] requestControls, LdapContext ctx)
processor - control processorrequestControls - that produced this responsectx - to get controls fromprotected static Map<String,Object> getSaslProperties(SaslConfig config)
config - sasl configurationCopyright © 2003-2019 Virginia Tech. All Rights Reserved.