spring-boot-demo icon indicating copy to clipboard operation
spring-boot-demo copied to clipboard

[FEATURE] LDAP userPassword disable

Open zhengfc opened this issue 5 years ago • 1 comments
trafficstars

你在什么场景下需要该功能?

大部分LDAP为了安全是不可以直接读取到userPassword,所以需要搜寻到指定节点提交密码待LDAP server验证返回

描述可能的解决方案

请尽量清晰精准地描述你期待我们要做的,描述你想到的实现方案。

描述你认为的候选方案

LdapQuery query = LdapQueryBuilder.query()
		.where("objectclass").is("person")
		.and("sAMAccountName").is(request.getUsername());
try {
	ldapTemplate.authenticate(query, request.getPassword());
} catch (Exception e) {
	log.warn(e.getMessage());
	throw new ServiceException("用户名或密码错误,请重新尝试");
}
return Result.success(personRepository.findByAccount(request.getUsername()));

zhengfc avatar Dec 25 '19 09:12 zhengfc

感谢!

xkcoding avatar Jan 05 '20 14:01 xkcoding