tomcat - 无法在部署在 apachi tomacat 服务器中的 Spring Boot 应用程序中调用 ldap 出现错误
问题描述
@Configuration @EnableWebSecurity(debug = true) 公共类 WebSecurityConfig 扩展 WebSecurityConfigurerAdapter {
//Getting values from properties file
@Value("${ldap.urls}")
private String ldapUrls;
@Value("${ldap.base.dn}")
private String ldapBaseDn;
@Value("${ldap.username}")
private String ldapSecurityPrincipal;
@Value("${ldap.password}")
private String ldapPrincipalPassword;
@Value("${ldap.user.dn.pattern}")
private String ldapUserDnPattern;
@Value("${ldap.enabled}")
private String ldapEnabled;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic().disable().authorizeRequests().anyRequest().authenticated().and().csrf().disable()
.formLogin();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.ldapAuthentication()
.contextSource()
.url(ldapUrls + ldapBaseDn)
.managerDn(ldapSecurityPrincipal)
.managerPassword(ldapPrincipalPassword)
.and()
.userSearchBase("ou=People")
.userSearchFilter("sAMAccountName={0}").
//userDnPatterns("member={0}").
groupSearchBase("ou=Groups");
//.userDnPatterns(ldapUserDnPattern);
}
}
使用上面的代码得到错误 [LDAP:错误代码 49 - 80090308:LdapErr:DSID-0C090453,注释:AcceptSecurityContext 错误,数据 52e,v3839];嵌套异常是 javax.naming.AuthenticationException:[LDAP:错误代码 49 - 80090308:LdapErr:DSID-0C090453,注释:AcceptSecurityContext 错误,数据 52e,v3839]
解决方案
推荐阅读
- typescript - 如何在字符串检查 TypeScript 类方法中有条件地提示布尔返回类型?
- c++ - 如何从向量中找到唯一的单词并将它们放入另一个向量中?
- reactjs - File Preview in React FilePond not showing up when setting initial file
- javascript - C# Owin handle 401 access token errors and regenerate access tokens using refresh token
- html - Flex items not wrapping with flex-wrap: wrap applied
- java - 使用参数从 SQlite 数据库中选择数据
- python - 如何在python中将外部文件中的数字转换为整数
- mongodb - Concat int 和 string 数组字段,它们位于不同的数组中
- node.js - 对 React 应用程序使用“npm start 命令”时出现错误
- types - elm type alias 类型检查没有发生,为什么会编译?