未验证 提交 eddf79b4 编写于 作者: O Oleg Nenashev 提交者: GitHub

Merge pull request #4315 from mawinter69/JENKINS-59904

[JENKINS-59904] avoid NullPointerException when there are no cookies in the request
......@@ -325,14 +325,17 @@ public abstract class SecurityRealm extends AbstractDescribableImpl<SecurityReal
* responsibility not to send them to us in the first place.
*/
final String cookieName = "JSESSIONID.";
for (Cookie cookie : req.getCookies()) {
if (cookie.getName().startsWith(cookieName)) {
LOGGER.log(Level.FINE, "Removing cookie {0} during logout", cookie.getName());
// one reason users log out is to clear their session(s)
// so tell the browser to drop all old sessions
cookie.setMaxAge(0);
cookie.setValue("");
rsp.addCookie(cookie);
Cookie[] cookies = req.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().startsWith(cookieName)) {
LOGGER.log(Level.FINE, "Removing cookie {0} during logout", cookie.getName());
// one reason users log out is to clear their session(s)
// so tell the browser to drop all old sessions
cookie.setMaxAge(0);
cookie.setValue("");
rsp.addCookie(cookie);
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册