Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java SpringLDAP无需查找即可进行身份验证_Java_Spring_Spring Ldap - Fatal编程技术网

Java SpringLDAP无需查找即可进行身份验证

Java SpringLDAP无需查找即可进行身份验证,java,spring,spring-ldap,Java,Spring,Spring Ldap,SpringLDAP 1.3.1 如果我理解正确,LdapContextSource没有设置绑定属性的方法,因此有必要在LdapTemplate的authenticate方法(或分别为LookupAttentingCallback)期间执行查找,因为提供的密码在其他情况下不会被验证 我遇到了这样一种情况,即要验证的用户没有目录服务上执行查找的权限 我找到的最简单的解决方案是不使用LdapTemplate,而是使用设置环境 contextSource.getContext(username, pw

SpringLDAP 1.3.1

如果我理解正确,LdapContextSource没有设置绑定属性的方法,因此有必要在LdapTemplate的authenticate方法(或分别为LookupAttentingCallback)期间执行查找,因为提供的密码在其他情况下不会被验证

我遇到了这样一种情况,即要验证的用户没有目录服务上执行查找的权限

我找到的最简单的解决方案是不使用LdapTemplate,而是使用设置环境

contextSource.getContext(username, pw).getEnvironment()

并将其用作InitialDirContext的构造函数参数,但它似乎“不应该是这样的”。所以问题是,如何才能做得更好?

这种情况是无效的。LDAP的正常用法是根据某些属性(如电子邮件地址)查找用户,然后尝试使用提供的密码绑定为该用户。我的观点是,绑定LdapTemplate时,会执行以下操作:DirContext ctx=contextSource.getContext(userDn,pw);ctx.lookup();而对于InitialDirContext,您只需使用新的InitialDirContext(env);