Hello Guys,
I'm using Spring LDAP 1.3 to integration with many LDAP repositories. When I using Apache DS, Spring Ldap connect with success, I can search and show users of repository and I can authenticate users.
This is my configuration of Spring LDAP to connect with Apache DS:
But when I changed this configuration to work with Microsoft Active Directory, erros happen. This is my configuration to work with AD:Code:<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource"> <property name="url" value="ldap://localhost:10389/ou=system" /> <property name="userDn" value="uid=admin,ou=system" /> <property name="password" value="secret" /> </bean> <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate"> <constructor-arg ref="contextSource" /> </bean>
ERROR [main] (ItgLdap.java:71) - ItgLDAP - [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903AA, comment: AcceptSecurityContext error, data 525, v1771; nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903AA, comment: AcceptSecurityContext error, data 525, v1771Code:<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource"> <property name="url" value="ldap://tlksrv09:389/dc=telemikro,dc=local" /> <property name="userDn" value="uid=israel$,cn=Users,dc=telemikro,dc=local" /> <property name="password" value="secret" /> </bean>
I tried differents forms:
But similars erros are showed.Code:<property name="url" value="ldap://tlksrv09:389" /> <property name="userDn" value="israel$@telemikro.local/>
I did a simple sample using only Java classes to connect with repository LDAP Microsoft Active Directory, this sample worked very good.
I found some things that I used google but without success to solve the connection problem Spring LDAP with Microsoft Active Directory.Code:String userName = "israel$@telemikro.local"; String newPassword = "secret"; Hashtable authEnv = new Hashtable(11); authEnv.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); authEnv.put(Context.PROVIDER_URL, "ldap://tlksrv09:389/dc=telemikro,dc=local"); authEnv.put(Context.SECURITY_AUTHENTICATION, "simple"); authEnv.put(Context.SECURITY_PRINCIPAL, userName); authEnv.put(Context.SECURITY_CREDENTIALS, newPassword); try { DirContext myContext = new InitialDirContext(authEnv); System.out.println("Autenticado!"); myContext.close(); } catch (AuthenticationException e) { System.out.println("Erro na autentica��o! "); e.printStackTrace(); }
Thank you for your help.


Reply With Quote
