简体   繁体   English

如何使用LDAP Active Directory验证JSP登录页面

[英]How to authenticate JSP login page with LDAP Active Directory

I am working on one java application. 我正在开发一个Java应用程序。 I am using Apache tomcat for this. 我为此使用Apache tomcat。 I have one login page and i want user to login with OS NTNET username and password. 我有一个登录页面,我希望用户使用OS NTNET用户名和密码登录。 I have details of our Active Directory. 我有我们的活动目录的详细信息。 Now i want to authenticate the username password provided in my jsp page with the details we have in the active directory. 现在,我要使用活动目录中的详细信息来验证我的jsp页面中提供的用户名密码。 I am not sure how LDAP will work here. 我不确定LDAP在这里如何工作。 Should we use JNDI Realm or something else is needed. 我们应该使用JNDI Realm还是需要其他东西。 What i tried till now is i updated the server.xml and web.xml files of tomcat with AD details. 到目前为止,我尝试用AD详细信息更新了tomcat的server.xml和web.xml文件。 and updated my validate.jsp with below code: 并使用以下代码更新了我的validate.jsp:

`import java.security.Principal;
……
Principal principal = request.getUserPrincipal();
String userName = principal.getName();
.…`

But it didn't help. 但这没有帮助。 If some one can help here it would be great. 如果有人可以在这里提供帮助,那就太好了。

You would have a login page , a Text Input , a password field and then a submit button with a controller wired on POST. 您将拥有一个登录页面,一个文本输入,一个密码字段,然后有一个带有POST上连接的控制器的提交按钮。

In the controller you will get data from the UI form. 在控制器中,您将从UI表单获取数据。 Then you can call a method from the controller for authentication like in this thread ( Authenticating against Active Directory with Java on Linux ) and based on the value returned by the authentication you can choose to redirect the user to the next page 然后,您可以从控制器中调用一种方法进行身份验证,如该线程中所示( 在Linux上使用Java对Active Directory进行身份验证 ),然后根据身份验证返回的值,您可以选择将用户重定向到下一页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Spring Ldap在Active Directory中对用户进行身份验证和搜索 - How authenticate and search user in Active Directory using Spring Ldap 如何通过 LDAP over TLS 对 Active Directory 进行身份验证? - How to authenticate against Active Directory via LDAP over TLS? 在应用程序加载登录页面时如何对ldap服务器进行身份验证? - How to authenticate the ldap server while application load login page? 使用LDAP,Java Play Framework通过Active Directory进行身份验证 - Authenticate via Active Directory using LDAP, Java Play Framework LDAP:如何获取Active Directory中的所有组? - LDAP: How to get all Groups in Active Directory? 如何关闭与Active Directory的LDAP连接 - How to close my LDAP connection to the Active Directory 如何在XPages中使用Java对Active Directory进行身份验证 - How to authenticate with Active Directory using java in XPages 如何使用用户名和密码从LDAP目录中对用户进行身份验证? - How to Authenticate a user from a LDAP directory with his username and password? 如何在CQ 6中通过LDAP通过目录对用户进行身份验证 - How to authenticate user against directory via LDAP in CQ 6 使用 Active Directory(使用 LDAP)在 angularjs/javascript 前端进行身份验证 - 流程的流程应该是什么? - Using Active Directory (with LDAP) to authenticate on an angularjs/javascript fronted - what should the flow of the process be?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM