[英]Missing HttpOnly Attribute in Session Cookie
在sign.jsp
,我写了以下内容,以便如果用户已经登录,那么他将立即转发到他的home page
<%
try{
HttpSession session1 = request.getSession(false);
if(session1.getAttribute("authenticated")!=null &&
session1.getAttribute("authenticated").equals(true))
{
response.sendRedirect("userhome.jsp");
}
else{
// users have to login here
}
%>
安全扫描告诉sign.jsp
Missing HttpOnly Attribute in Session Cookie
中Missing HttpOnly Attribute in Session Cookie
。
如果我将设置: <Context useHttpOnly="true"> ... </Context>
in: C:\\Program Files\\Apache Software Foundation\\Apache Tomcat 6.0.20\\conf
那我的问题会解决吗或我还有什么需要做的? 任何建议都非常感谢
如果您使用Servlet 3.0。 Than In Servlet 3.0(Java EE 6)引入了一种为会话cookie配置HttpOnly属性的标准方法,在web.xml中应用以下配置
<session-config>
<cookie-config>
<http-only>true</http-only>
</cookie-config>
<session-config>
另一种方法是
Cookie cookie = new Cookie(cookieName, cookieValue);
cookie.setHttpOnly(true);
httpResponse.addCookie(cookie);
阅读这篇文章https://access.redhat.com/solutions/338313
我想你必须设置
<Context cookies="true" crossContext="true">
<SessionCookie secure="true" httpOnly="true" />
“$ PROFILE \\ deploy \\ jbossweb.sar \\ context.xml”中的属性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.