相关疑难解决方法(0)

在 LDAP 身份验证中使用正确凭据的未分类异常

我想使用 Spring Boot 为 Web 应用程序实现 LDAP 身份验证。这是我的WebSecurityConfig课程:

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .authorizeRequests()
                .anyRequest()
                .authenticated()
                .and()
            .formLogin();
    }

    @Configuration
    protected static class AuthenticationConfiguration extends
            GlobalAuthenticationConfigurerAdapter {

        @Override
        public void init(AuthenticationManagerBuilder auth) throws Exception {
            auth
                .ldapAuthentication()
                    .userDnPatterns("cn={0},ou=institution,ou=people")
                    .contextSource()
                    .url("ldap://ldap.mdanderson.edu:389/dc=mdanderson,dc=edu");
        }
    }   
}
Run Code Online (Sandbox Code Playgroud)

我用我的凭据测试了它。以下是 LDAP 服务器上我的用户信息的屏幕截图:

在此输入图像描述

在登录页面上,如果我输入 djiao 作为我的用户名和错误的密码,它会显示Bad credentials。但是如果我给出正确的密码,我会得到 500:

There was an unexpected error (type=Internal Server Error, status=500).
Uncategorized exception occured during …
Run Code Online (Sandbox Code Playgroud)

java authentication ldap spring-security

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

authentication ×1

java ×1

ldap ×1

spring-security ×1