Я пишу веб-приложение Spring, которое требует от пользователей входа в систему. У моей компании есть сервер Active Directory, который я бы хотел использовать для этой цели. Однако мне не удается использовать Spring Security для подключения к серверу.
Я использую Spring 2.5.5 и Spring Security 2.0.3 вместе с Java 1.6.
Если я изменил URL-адрес LDAP на неправильный IP-адрес, он не генерирует исключение или что-то еще, поэтому мне интересно, пытается ли он даже попытаться подключиться к серверу.
Несмотря на то, что веб-приложение запускается просто отлично, любая информация, вводимая на страницу входа, отклоняется. Ранее я использовал InMemoryDaoImpl, который работал нормально, поэтому остальная часть моего приложения, похоже, правильно настроена.
Вот мои связанные с безопасностью beans:
<beans:bean id="ldapAuthProvider" class="org.springframework.security.providers.ldap.LdapAuthenticationProvider">
<beans:constructor-arg>
<beans:bean class="org.springframework.security.providers.ldap.authenticator.BindAuthenticator">
<beans:constructor-arg ref="initialDirContextFactory" />
<beans:property name="userDnPatterns">
<beans:list>
<beans:value>CN={0},OU=SBSUsers,OU=Users,OU=MyBusiness,DC=Acme,DC=com</beans:value>
</beans:list>
</beans:property>
</beans:bean>
</beans:constructor-arg>
</beans:bean>
<beans:bean id="userDetailsService" class="org.springframework.security.userdetails.ldap.LdapUserDetailsManager">
<beans:constructor-arg ref="initialDirContextFactory" />
</beans:bean>
<beans:bean id="initialDirContextFactory" class="org.springframework.security.ldap.DefaultInitialDirContextFactory">
<beans:constructor-arg value="ldap://192.168.123.456:389/DC=Acme,DC=com" />
</beans:bean>