Skip to content

Commit d05fc2e

Browse files
committed
CookieGenerator explicitly sets 'secure' and 'httpOnly' flags in removeCookie as well
Issue: SPR-12865
1 parent c382b6f commit d05fc2e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-web/src/main/java/org/springframework/web/util/CookieGenerator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -203,6 +203,12 @@ public void removeCookie(HttpServletResponse response) {
203203
Assert.notNull(response, "HttpServletResponse must not be null");
204204
Cookie cookie = createCookie("");
205205
cookie.setMaxAge(0);
206+
if (isCookieSecure()) {
207+
cookie.setSecure(true);
208+
}
209+
if (isCookieHttpOnly()) {
210+
cookie.setHttpOnly(true);
211+
}
206212
response.addCookie(cookie);
207213
if (logger.isDebugEnabled()) {
208214
logger.debug("Removed cookie with name [" + getCookieName() + "]");

0 commit comments

Comments
 (0)