使用java进行多个活动目录服务器身份验证
我有三个活动目录服务器不同的地址、端口和域名以及所有 在我的应用程序中,当用户登录系统时我必须进行身份验证。用户仅提供用户名和密码,而不提供域名或 IP 地址。 我如何对他进行身份验证,是否必须循环遍历所有 ldap 服务器,当我获得上下文时,我必须破坏它..或者是否存在任何其他可能的解决方案在多个服务器中对用户进行身份验证 请建议。提前致谢
i have three active directory servers different address,port and domain name and all
In my app when user log-in the system i have to authenticate. The user provide his username and password only not the domain name or ip address.
How can i authenticate him, whether i have to loop through the all the ldap server and when i get the Context i have to break it .. or is any other possible solution is there for authenticate a user in multiple servers
please suggest. thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果用户提供他的 FDN 或 UPN(用户主体名称)而不仅仅是用户名,将会很有帮助。但仍然不能保证 upn 与您的域名匹配。如果他提供 FDN,那么至少您可以缓存来自所有三个服务器的 defaultNamingContext,并尝试将其与用户提供的 FDN 进行匹配,并根据匹配服务器对他进行身份验证。
但我猜他在你的情况下提供了 samAccountName 。在这种情况下,我们没有任何线索来识别服务器。您必须一项一项地进行检查,并可能将其缓存到他进行身份验证的服务器上,以便下次提高性能。也有可能同一用户名存在于多个 AD 中。您必须根据您的 AD 环境来处理这种情况。
作为附加说明,如果其 Web 应用程序尝试使用 spring 的 ldapTemplate。这可能会减轻您的任务。
If the user gives his FDN or UPN (User Principal Name) instead of just an user name it will be helpful. But still there is no guarantee that upn will match your realm name. If he gives FDN then atleast you can cache defaultNamingContext from all the three server and try to match it with the fdn provided by the user and authenticate him against the matching server.
But I guess he is providing the samAccountName in your case. In this case we dont have any clue to identify the server. You have to go through one by one and probably cache it which server he is authenticated against for next time performance improvment. Its also possible that the same username exist in multiple AD. You have to handle this case based on your AD environment.
as a additional note, if its web application try using spring's ldapTemplate. This might ease your task.