我有问题 。这是我的ldap身份验证代码
在春季,但与我交谈AcceptSecurityContext时出错。
javax.naming.AuthenticationException:[LDAP:错误代码49-80090308:LdapErr:DSID-0C090400,注释:AcceptSecurityContext错误,数据52e,v1db1]
请帮我
@GetMapping("/login/{userName}/{password}")
public Map<String, Boolean> login(@PathVariable(value = "userName") String username,@PathVariable(value = "password") String password) throws Exception {
LdapContextSource contextSource = new LdapContextSource();
contextSource.setUrl(url);
contextSource.setUserDn("[email protected]");
contextSource.setPassword("masterone4408$$)*");
contextSource.afterPropertiesSet();
LdapTemplate ldapTemplate=new LdapTemplate(contextSource);
AndFilter filter = new AndFilter();
System.out.println(username+"////"+password);
filter.and(new EqualsFilter("cn", username));
ldapTemplate.afterPropertiesSet();
Map<String, Boolean> response = new HashMap<>();
response.put("deleted", ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH,"(&(userPrincipalName="+username+"@msv.net))", password));
return response;
}
最佳答案
[LDAP:错误代码49 -...数据52e
Returns when username is valid but password/credential is invalid.
-吉姆