嗨,我是Spring和Java的新手,我正在尝试实现本教程中描述的Gateway认证服务器https://spring.io/guides/tutorials/spring-security-and-angular-js/
我得到了一切工作,然后尝试对我们公司的Ldap服务器实施身份验证.如果我使用有效的用户名和密码,它可以工作.当我使用无效凭据时,应用程序错误.
我没有工作,所以我没有确切的错误,但它返回一个ldap错误(com.sun.jndi.ldap.LdapCtx),Redis正在尝试序列化它.
我的配置中是否缺少某些内容.根据我的阅读,我认为我应该寻找一种方法来包装/扩展类并实现Serializable,但我不确定使用Spring Boot执行此操作的方法最少.
任何帮助是极大的赞赏.
谢谢,
Mike Kowalski
PS我一直在动态语言和框架工作到现在为止(Javascript/Node,Php/Laravel)
以下是我认为安全配置的相关部分:
@Configuration
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.formLogin()
.defaultSuccessUrl("/")
.loginPage("/login")
.permitAll()
.and()
.logout()
.logoutSuccessUrl("/logout")
.permitAll();
http
.authorizeRequests()
.antMatchers("/login").permitAll()
.anyRequest().authenticated()
.and()
.csrf().csrfTokenRepository(csrfTokenRepository())
.and()
.addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
}
@Override
protected void configure(AuthenticationManagerBuilder authManagerBuilder) throws Exception {
authManagerBuilder
.authenticationProvider(activeDirectoryLdapAuthenticationProvider())
.userDetailsService(userDetailsService());
}
@Bean
public AuthenticationManager authenticationManager() {
return new ProviderManager(
Arrays.asList(activeDirectoryLdapAuthenticationProvider())
);
}
@Bean
public AuthenticationProvider activeDirectoryLdapAuthenticationProvider() {
ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirectoryLdapAuthenticationProvider( …Run Code Online (Sandbox Code Playgroud)