【发布时间】:2010-07-01 11:48:08
【问题描述】:
我有一个想在 https 中显示的登录页面。验证用户后,我想将他转移回http。
所以我在 web.xml 中声明了
<security-constraint>
<web-resource-collection>
<web-resource-name>Login and Restricted Space URLs</web-resource-name>
<url-pattern>/general/enter.jsf</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Rest of the Application</web-resource-name>
<url-pattern>/general/home.jsf</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
我看到登录页面在 https 中。
但在我的行动中:
public String doLogin() throws Exception {
...
User user = service.getUserByNameAndCompany(name, company);
......
return "/general/home.jsf";
}
bean 将用户重定向到
https://mycomputer:8443/MYProject/general/home.jsf
我希望它回来
http://mycomputer:8080/MYProject/general/home.jsf
我该怎么做?
【问题讨论】:
-
虽然这种方法可以保护密码,但它会暴露 sessionid cookie。因此,可以嗅探流量的攻击者可以充当受害者。
-
那么您建议如何保护 sessionid cookie?