public class TlsConnectionHandler extends DefaultConnectionHandler
TlsConnectionHandler creates a new LdapContext
using environment properties obtained from LdapConfig.getEnvironment() and then invokes the startTLS extended operation
on the context. SSLSocketFactory and
HostnameVerifier properties are used from the
LdapContext.ConnectionHandler.ConnectionStrategyconfig, connectionRetryExceptions, connectionStrategy, context, logger| Constructor and Description |
|---|
TlsConnectionHandler()
Default constructor.
|
TlsConnectionHandler(LdapConfig lc)
Creates a new
TlsConnectionHandler with the supplied ldap
config. |
TlsConnectionHandler(TlsConnectionHandler ch)
Copy constructor for
TlsConnectionHandler. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close a connection to an LDAP.
|
protected void |
connectInternal(String authtype,
String dn,
Object credential,
Hashtable<String,Object> env)
Create the initial ldap context and prepare the connection for use.
|
StartTlsResponse |
getStartTlsResponse()
This returns the startTLS response created by a call to
AbstractConnectionHandler.connect(String, Object). |
boolean |
getStopTlsOnClose()
Returns whether to call
StartTlsResponse.close() when close() is called. |
TlsConnectionHandler |
newInstance()
Returns a separate instance of this connection handler with the same
underlying ldap configuration.
|
void |
setStopTlsOnClose(boolean b)
Sets whether to call
StartTlsResponse.close() when close()
is called. |
StartTlsResponse |
startTls(LdapContext ctx)
This will attempt to StartTLS with the supplied
LdapContext. |
void |
stopTls(StartTlsResponse tls)
This will attempt to StopTLS with the supplied
StartTlsResponse. |
connect, getConnectionCount, getConnectionRetryExceptions, getConnectionStrategy, getLdapConfig, getLdapContext, isConnected, parseLdapUrl, setConnectionCount, setConnectionRetryExceptions, setConnectionStrategy, setLdapConfigpublic TlsConnectionHandler()
public TlsConnectionHandler(LdapConfig lc)
TlsConnectionHandler with the supplied ldap
config.lc - ldap configpublic TlsConnectionHandler(TlsConnectionHandler ch)
TlsConnectionHandler.ch - to copy properties frompublic boolean getStopTlsOnClose()
StartTlsResponse.close() when close() is called.public void setStopTlsOnClose(boolean b)
StartTlsResponse.close() when close()
is called.b - stop TLS on closepublic StartTlsResponse getStartTlsResponse()
AbstractConnectionHandler.connect(String, Object).protected void connectInternal(String authtype, String dn, Object credential, Hashtable<String,Object> env) throws NamingException
connectInternal in class DefaultConnectionHandlerauthtype - security mechanism to bind withdn - to bind ascredential - to bind with in conjunction with dnenv - to pass to the initial ldap contextNamingException - if a connection cannot be establishedpublic void close()
throws NamingException
close in interface ConnectionHandlerclose in class AbstractConnectionHandlerNamingException - if an LDAP error occurspublic StartTlsResponse startTls(LdapContext ctx) throws NamingException
LdapContext.ctx - LdapContextStartTlsResponseNamingException - if an error occurs while requesting an extended
operationpublic void stopTls(StartTlsResponse tls) throws NamingException
StartTlsResponse.tls - StartTlsResponseNamingException - if an error occurs while closing the TLS
connectionpublic TlsConnectionHandler newInstance()
newInstance in interface ConnectionHandlernewInstance in class DefaultConnectionHandlerCopyright © 2014. All rights reserved.