简体   繁体   English

使用Java进行https会话登录/注销

[英]https session login/logout with java

Just a very simple question. 只是一个非常简单的问题。 I have set up a rather simple CMS in JSP. 我已经在JSP中建立了一个相当简单的CMS。 All I need is a security measure to maintain the system's privacy. 我需要的只是一种安全措施,以维护系统的隐私。 Does anyone know of any tutorials that assist in building https sessions for simple networks?? 有谁知道有任何教程可以帮助为简单网络构建https会话?

I have more or less conquered (or grasped) the main portions of building databases, using CRUD, and making the programs interact between the java code and the JSP. 我已经或多或少地使用CRUD征服(或掌握了)构建数据库的主要部分,并使程序在Java代码和JSP之间交互。 This is basically the final hurdle before I can securely and confidently launch this thing and get it going. 从本质上讲,这是我可以安全,放心地启动并运行它之前的最后一个障碍。

Any and all information is always appreciated. 任何和所有信息始终受到赞赏。

There is a class called SSLSession that you can use: 您可以使用一个名为SSLSession的类:

This is the tutorial 这是教程

This is the documentation 这是文档

You might want to look into session management closely if your site is critical. 如果您的站点很重要,则可能需要仔细研究会话管理。 In simple terms, make a form to get username/password. 简而言之,请填写表格以获取用户名/密码。 If they match, use jsp's 如果它们匹配,请使用jsp

To login : 登录 :

session.setAttribute("login", "true");

To check if the user is logged in, 要检查用户是否已登录,

boolean logged = session.getAttribute("login") != null

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

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