Jared Stehler (Migrated from SEC-1217) said:
As per the aforementioned thread:
"If you use HTTPS exclusively, then it is a good idea to set the "secure" flag on the cookie. You can do this by overriding the setCookie method on the AbstractRememberMeServices implementation you are using."
This is as simple as adding a single line to AbstractRememberMeServices.setCookie():
cookie.setSecure( request.isSecure() );
With this snippet, when the request is made from a secure context, the cooke will be sent with a 'secure' attribute set. This could be made optional with a configuration flag; I just think its messy to require clients to override this class for such simple functionality.
Luke Taylor said:
This is something I've been meaning to implement for a while and is a good idea. However, it's not as simple as adding that snippet of code as that assumes that the cookie will always be used over a secure connection (which may not be what's desired). A configuration flag "useSecureCookie" would probably be a better approach. If the flag is set, then the cookies will always have the secure flag set on them. More complicated behaviour can still be obtained by extending the class. In most cases where sites are ultra-concerned about security, remember-me functionality shouldn't really be used to start with.
I've added a useSecureCookie flag to the class and a corresponding use-secure-cookie attribute to the remember-me namespace element.