I am trying to configure spring security with LDAP for one of my projects. I have configured my LDAP server in apache directory studio (DS) server. I am always getting one error saying "Bad credentials". I am not sure from where this error message is coming. Below is my security configuration:
I need some help urgently. It will be of great help if anyone can provide direction with some sample code or examples for the same.
=====================================
My Spring-security.xml contains the following:
I am using following versions of jars:
1. springframework3.0.6_RELEASE
2. spring-security3.1

<bean id="contextSource"
class="org.springframework.security.ldap.DefaultSp ringSecurityContextSource">
<constructor-arg value="ldap://localhost:10389/dc=example,dc=com"/>
<property name="userDn" value="cn=User,ou=users,o=AAL,dc=example,dc=com"/>
<property name="password" value="secret"/>
</bean>
<bean id="ldapAuthProvider"
class="org.springframework.security.ldap.authentic ation.LdapAuthenticationProvider">
<constructor-arg>
<bean class="org.springframework.security.ldap.userdetai ls.DefaultLdapAuthoritiesPopulator">
<constructor-arg ref="contextSource"/>
<constructor-arg value="ou=groups"/>
<property name="groupRoleAttribute" value="ou"/>
</bean>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.security.ldap.authentic ation.BindAuthenticator">
<constructor-arg ref="contextSource"/>
<property name="userDnPatterns"><list><value>uid={0},ou=user s</value></list></property>
</bean>
</constructor-arg>
</bean>
<security:authentication-manager>
<security:authentication-provider ref='ldapAuthProvider'/>
</security:authentication-manager>
================================================
My web.xml :


<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
</filter>

<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
/WEB-INF/applicationContext.xml
</param-value>
</context-param>

<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>com.in.example.MyServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/example/*</url-pattern>
</servlet-mapping>

<listener>
<listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
</listener>
===========================================
When I am running the application, it is throwing "Bad credentials"
I have gone through all the sites and forums, but none of existing solution provided in any site were of much help.
Please help...