简体   繁体   English

在进行管理员登录的情况下,如何在Java servlet的web.xml中提供安全凭证,又如何从JSP管理员登录页面进行验证?

[英]In case of admin login, how to give security credentials in web.xml of Java servlets and how could it be validated from JSP admin login page?

Am Creating a Java Web application where User can register themselves and could login to the application. 我正在创建一个Java Web应用程序,用户可以在其中注册自己并可以登录到该应用程序。

But in case of Admin, credentials should already be available and could not be registered from Web page. 但是对于Admin,凭据应该已经可用并且不能从Web页面进行注册。 How the credentials like username and password be provided in web.xml of Servlets? 如何在Servlet的web.xml中提供用户名和密码之类的凭证? and how the credentials are validated from LoginServlet, once the username and password is submitted by admin in JSP and passed to the LoginServlet? 以及一旦用户名和密码由admin在JSP中提交并传递给LoginServlet,如何从LoginServlet验证凭据?

i think you should first understand container managed security.. 我认为您应该首先了解容器管理的安全性。

For tomcat there is a good example here: http://www.informit.com/articles/article.aspx?p=24253 对于Tomcat,这里有一个很好的例子: http : //www.informit.com/articles/article.aspx?p=24253

and then you could (in case of tomcat) configure your own realm (jdbc, etc...): 然后,您可以(在使用tomcat的情况下)配置自己的领域(jdbc等):

https://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html https://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html

and

https://tomcat.apache.org/tomcat-7.0-doc/security-howto.html https://tomcat.apache.org/tomcat-7.0-doc/security-howto.html

this link is also useful in case of Java EE: http://docs.oracle.com/javaee/6/tutorial/doc/bncat.html 对于Java EE,此链接也很有用: http : //docs.oracle.com/javaee/6/tutorial/doc/bncat.html

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM