I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Thursday 13 June 2013

Http Only cookies

I just learned something about http-only cookies to prevent client code of the browser to temper with cookies. I found a little more information in this article:https://www.owasp.org/index.php/HttpOnly. To do this in Java for a cookie, write:


Cookie cookie = getMyCookie("myCookieName");
cookie.setHttpOnly(true);

In particular for the session cookie, you can use the following code:

SessionCookieConfig config = request.getServletContext().getSessionCookieConfig();
config.setHttpOnly(true);