我正在尝试从用户登录页验证用户(在active directory中)。以下身份验证代码失败,错误代码为32-0000208d
附加的是spring引发的异常:ldaptemplate.java,search(…)method(ldap错误代码32-0000208d)https://app.box.com/s/t91jdn5gbf996v5e7bv75xpzwfttvizr
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
private static final Logger logger = LogManager.getLogger(SecurityConfiguration.class);
@Autowired
private LdapProperties lProps;
public void configure(AuthenticationManagerBuilder auth) throws Exception
{
String bUrl=lProps.getBellUrl();
String bPort=String.valueOf(lProps.getBellPort());
String bSrvName=lProps.getBellSrvName();
String bMgrDn=lProps.getBellMgrDn();
String contextSource=bUrl + ":" + bPort;
String managerDn="CN=" + bSrvName + "," + bMgrDn;
String bSrvPassword=lProps.getBellSrvPassword();
String bSearchBase=lProps.getBellSearchBase();
auth
.ldapAuthentication()
.contextSource().url(contextSource)
.managerDn(managerDn)
.managerPassword(bSrvPassword)
.and()
.userSearchBase(bSearchBase)
.userSearchFilter("(sAMAccountName={0})");
}
.....
}
错误:
2020-12-23 10:55:05,316 DEBUG o.s.s.w.c.SecurityContextPersistenceFilter [http-nio-8079-exec-1] Cleared SecurityContextHolder to complete request
2020-12-23 10:55:05,317 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] [http-nio-8079-exec-1] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
org.springframework.ldap.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-0310021B, problem 2001 (NO_OBJECT), data 0, best match of: '' ]; remaining name ''
at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:183) ~[spring-ldap-core-2.3.3.RELEASE.jar:2.3.3.RELEASE]
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:376) ~[spring-ldap-core-2.3.3.RELEASE.jar:2.3.3.RELEASE]
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:328) ~[spring-ldap-core-2.3.3.RELEASE.jar:2.3.3.RELEASE]
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:629) ~[spring-ldap-core-2.3.3.RELEASE.jar:2.3.3.RELEASE]
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:570) ~[spring-ldap-core-2.3.3.RELEASE.jar:2.3.3.RELEASE]
at org.springframework.security.ldap.SpringSecurityLdapTemplate.searchForMultipleAttributeValues(SpringSecurityLdapTemplate.java:197) ~[spring-security-ldap-5.4.2.jar:5.4.2]
at org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator.getGroupMembershipRoles(DefaultLdapAuthoritiesPopulator.java:223) ~[spring-security-ldap-5.4.2.jar:5.4.2]
at org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator.getGrantedAuthorities(DefaultLdapAuthoritiesPopulator.java:203) ~[spring-security-ldap-5.4.2.jar:5.4.2]
at org.springframework.security.ldap.authentication.LdapAuthenticationProvider.loadUserAuthorities(LdapAuthenticationProvider.java:197) ~[spring-security-ldap-5.4.2.jar:5.4.2]
暂无答案!
目前还没有任何答案,快来回答吧!