This commit is contained in:
Vedran Pavic
2019-07-02 19:23:00 +02:00
parent 1ca9daccb4
commit 8cb85618c2
8 changed files with 18 additions and 27 deletions

View File

@@ -56,8 +56,6 @@ public class SpringSessionRememberMeServices implements RememberMeServices, Logo
private int validitySeconds = THIRTY_DAYS_SECONDS;
private String sessionAttrToDeleteOnLoginFail = HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY;
@Override
public final Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) {
return null;
@@ -131,7 +129,7 @@ public class SpringSessionRememberMeServices implements RememberMeServices, Logo
logger.debug("Interactive login attempt was unsuccessful.");
HttpSession session = request.getSession(false);
if (session != null) {
session.removeAttribute(this.sessionAttrToDeleteOnLoginFail);
session.removeAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
}
}

View File

@@ -210,7 +210,7 @@ public class DefaultCookieSerializer implements CookieSerializer {
for (int i = start; i < end; i++) {
char c = chars[i];
if (c < 0x21 || c == 0x22 || c == 0x2c || c == 0x3b || c == 0x5c || c == 0x7f) {
throw new IllegalArgumentException("Invalid character in cookie value: " + Integer.toString(c));
throw new IllegalArgumentException("Invalid character in cookie value: " + c);
}
}
}

View File

@@ -18,6 +18,7 @@ package org.springframework.session.web.http;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import javax.servlet.ServletOutputStream;
@@ -811,7 +812,7 @@ class OnCommittedResponseWrapperTests {
@Test
void contentLengthPrintWriterPrintlnStringCommits() throws Exception {
String x = "1";
this.response.setContentLength(String.valueOf(x).length());
this.response.setContentLength(x.length());
this.response.getWriter().println(x);
@@ -831,7 +832,7 @@ class OnCommittedResponseWrapperTests {
@Test
void contentLengthPrintWriterAppendCharSequenceCommits() throws Exception {
String x = "a";
this.response.setContentLength(String.valueOf(x).length());
this.response.setContentLength(x.length());
this.response.getWriter().append(x);
@@ -906,7 +907,7 @@ class OnCommittedResponseWrapperTests {
assertThat(this.committed).isFalse();
this.response.getOutputStream().write("1".getBytes("UTF-8"));
this.response.getOutputStream().write("1".getBytes(StandardCharsets.UTF_8));
assertThat(this.committed).isTrue();
}
@@ -1053,7 +1054,7 @@ class OnCommittedResponseWrapperTests {
@Test
void contentLengthOutputStreamPrintlnStringCommits() throws Exception {
String x = "1";
this.response.setContentLength(String.valueOf(x).length());
this.response.setContentLength(x.length());
this.response.getOutputStream().println(x);