Skip to content

Commit bee4265

Browse files
committed
Fix remember-me cookie set/cancel inconsistency:
AbstractRememberMeServices is setting remember-me cookie with checking request is secure or secure usage is independently set to a fixed flag. But when cancelling a cookie, cookie is not being marked secure or not. It produces an inconsistency when using secure flag as a part to identity of cookie. This commit intended to fix this situation.
1 parent 73babc3 commit bee4265

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

web/src/main/java/org/springframework/security/web/authentication/rememberme/AbstractRememberMeServices.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
* @author Luke Taylor
5454
* @author Rob Winch
5555
* @author Eddú Meléndez
56+
* @author Onur Kagan Ozcan
5657
* @since 2.0
5758
*/
5859
public abstract class AbstractRememberMeServices implements RememberMeServices,
@@ -383,6 +384,12 @@ protected void cancelCookie(HttpServletRequest request, HttpServletResponse resp
383384
if (cookieDomain != null) {
384385
cookie.setDomain(cookieDomain);
385386
}
387+
if (useSecureCookie == null) {
388+
cookie.setSecure(request.isSecure());
389+
}
390+
else {
391+
cookie.setSecure(useSecureCookie);
392+
}
386393
response.addCookie(cookie);
387394
}
388395

0 commit comments

Comments
 (0)