我想在我的Spring Boot應用程序中集成基於LDAP的登錄。如何使用Spring Boot連接外部/在線LDAP服務器?
作爲第一步,我試圖使用這個LDAP服務器(http://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/)。
但是,我無法成功連接到服務器,並得到此錯誤。
nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
我在配置類中使用這些信息。
authenticationManagerBuilder.ldapAuthentication()
.contextSource().url("ldap://ldap.forumsys.com:389/dc=example,dc=com")
.managerDn("cn=read-only-admin,dc=example,dc=com").managerPassword("password")
.and()
.userSearchBase("ou=mathematicians")
.groupSearchBase("ou=mathematicians")
.userSearchFilter("(cn={0})");
這是我的這個項目的application.properties文件。
spring.ldap.urls=ldap.forumsys.com:389
spring.ldap.base=cn=read-only-admin,dc=example,dc=com
spring.ldap.password=password
任何人都可以使用LDAP服務器爲Spring Boot應用程序提供工作配置嗎?