我有问题。这是我的代码验证与ldap
但是它有错误,告诉我AcceptSecurityContext。
验证异常:[LDAP:错误代码49 - 80090308:登录错误:DSID-0 C 090400,备注:接受安全上下文错误,数据52 e,v1 db 1]
请帮帮我
@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("userPrincipalName=arpa@msv.net");
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;
}
1条答案
按热度按时间s4chpxco1#
[LDAP:错误代码49 -...数据52 e Returns when username is valid but password/credential is invalid.