【发布时间】:2014-09-16 21:41:46
【问题描述】:
我对 java spring 的安全部分很好奇。
我从这个网站上学习了如何使用数据库进行登录系统。
但是,我担心与安全问题有关的某些部分。
<h1>Spring Security Login Form (Database Authentication)</h1>
<div id="login-box">
<h3>Login with Username and Password</h3>
<c:if test="${not empty error}">
<div class="error">${error}</div>
</c:if>
<c:if test="${not empty msg}">
<div class="msg">${msg}</div>
</c:if>
<form name='loginForm'
action="<c:url value='/j_spring_security_check' />" method='POST'>
<table>
<tr>
<td>User:</td>
<td><input type='text' name='username'></td>
</tr>
<tr>
<td>Password:</td>
<td><input type='password' name='password' /></td>
</tr>
<tr>
<td colspan='2'><input name="submit" type="submit"
value="submit" /></td>
</tr>
</table>
<input type="hidden" name="${_csrf.parameterName}"
value="${_csrf.token}" />
</form>
</div>
由于此表单将部署在服务器上,用户将从他们的 PC 登录。但是,这意味着数据不会被加密。请原谅我对我的问题的薄弱解释,因为我对这个 java spring 环境还是新手。我担心将数据从用户 PC 发送到服务器以在数据库中进行身份验证。
http://www.mkyong.com/spring-security/spring-security-form-login-using-database/
是否有加密从用户 PC 到服务器的数据包,还是由 tomcat 服务器处理?
【问题讨论】:
-
将 Tomcat 配置为使用 https,您将获得加密。
-
这与spring或jave无关,但通常与HTML/HTTP有关。表单按原样提交。现在您可以使用 JavaScript 进行一些加密,但会添加什么?代码在客户端,你需要一个双向加密/解密算法,它不会添加任何东西。正如@AndreiStefan 已经指出的那样,您应该使用 https 提交此表单(或任何安全/敏感信息)。
-
感谢您的信息。
标签: java spring security spring-mvc spring-security