Le 09/12/14 05:32, tawalisa a écrit :
> Hi ,
>
> I am using directory.api. And I want to using TSL. But I saw a blank page
> about TSL in user guide.
> https://directory.apache.org/api/user-guide/5.3-start-tls.html
>
> Could you give me an example about it?
>
> Thanks.
Sorry for the missing documentation.
Here is an exemple :
LdapConnectionConfig tlsConfig;
tlsConfig = new LdapConnectionConfig();
tlsConfig.setLdapHost( "localhost" );
tlsConfig.setLdapPort( getLdapServer().getPort() );
tlsConfig.setTrustManagers( new NoVerificationTrustManager()
); /// Here, you have to provide the TrustManager instance you
want to use.
tlsConfig.setBinaryAttributeDetector( new
SchemaBinaryAttributeDetector(
ldapServer.getDirectoryService().getSchemaManager() ) );
LdapNetworkConnection connection = null;
try
{
connection = new LdapNetworkConnection( tlsConfig );
tlsConfig.setUseTls( true );
connection.connect();
...