Я пытаюсь использовать Spring-ldap для защиты своего приложения.
Это мой файл WebSecurityConfig:
package mis.maskcenter;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().fullyAuthenticated()
.and()
.formLogin();
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.userDnPatterns("uid={0},ou=People")
.groupSearchBase("ou=groups")
.contextSource()
.url("ldap://ip_here:389/dc=mycomp,dc=com")
.managerPassword("managuser")
.managerDn("uid=managuser");
}
}
При запуске приложения страница входа заменяет мою домашнюю страницу: хорошо!
Затем я пытаюсь предоставить учетные данные BAD: на странице отображается сообщение BAD CREDENTIAL: тоже хорошо: o) в прикладном терминале нет сообщения.
Затем я пытаюсь с ПРАВИЛЬНЫМИ учетными данными: на этот раз на странице входа в систему не отображается никаких сообщений, просто перезагрузите на пустой экран входа в систему -sic- и в терминале, где я запускаю приложение, у меня есть это сообщение:
2018-11-16 14:54:54.217 ERROR 22623 --- [nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
org.springframework.ldap.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]; nested exception is javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
Даже после прочтения документации по ldapAuthentication мое понимание предмета довольно ограничено, поэтому любая помощь будет полезна: o)
Есть предложения?
Спасибо