Sunday, 15 August 2010

java - Set tls_reqcert never with spring ldap -


I use the Spring LDAP server to connect with ldaps.

Tls_reqcert is never possible to install?

I now have in the application.properties file:

  ldap.url = ldaps: //192.168.0.0: 636 ldap.userDn = ldap.password = ldap . Base = ldap.clean = true ldap.maxActive = 350  

Try with me:

  Public class SslLdap extends DefaultTlsDirContextAuthenticationStrategy {Personal static last string SIMPLE_AUTHENTICATION = "Simple"; Protected Zero applyAuthentication throws (LdapContext ctx, string userDN, string password) NamingException {System.setProperty ("javax.net.ssl.trustStore" "/ home / user / truststore.jks"); System.setProperty ("javax.net.ssl.trustStorePassword", "Incognito"); Ctx.addToEnvironment (reference. SECURITY_AUTHICICATION, SIMPLE_AUTHICICATION); Ctx.addToEnvironment (incident. SECURITY_PRINCIPAL, userDn); Ctx.addToEnvironment (Ref. SECURITY_CREDENTIALS, password); }}  

the answer is no. But if you want to use SSL with Spring Ldap, you can do this:.

1) Add Truststore () with the self-certificates in the Web-INF / folder

You have to create a class that would like LdapContextSource:

  Public category SslLdap extends LdapContextSource {this.setUrl ("ldaps: // URL: 636"); System.setProperty ("javax.net.ssl.trustStore", ctx.getRealPath ("WEB-INF / Truststore.jks")); System.setProperty ("javax.net.ssl.trustStorePassword", keystore password); Super.afterPropertiesSet (); Hashtable & lt; String, Object & gt; EnvProps = New Hashtable & lt; String, Object & gt; (); EnvProps.put (Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); EnvProps.put (reference.PROVIDER_URL, "ldaps: // url: 636"); EnvProps.put (reference. SECURITY_AUTHICICATION, "SIMPLE"); EnvProps.put (reference. SECURITY_PRINCIPAL, "userDN"); EnvProps.put (references SECTURITY_CREDENTIALS, "PASS"); EnvProps.put ("java.naming.security.protocol", "SSL"); EnvProps.put ("com.sun.jndi.ldap.connect.pool", "true"); Super.setBaseEnvironmentProperties (envProps); Super.afterPropertiesSet (); }  

and in your Bean Set:

   & Lt; Property name = "base" value = "$ {ldap.base}" /> & Lt; Property name = "userDn" value = "$ {ldap.userDn}" /> & Lt; Property name = "password" value = "$ {ldap.password}" /> & Lt; Property name = "pool" value = "wrong" /> & Lt; / Bean & gt;  

I think the assets that you can remove.


No comments:

Post a Comment