Fixes gh-3780
@@ -177,6 +177,9 @@ final class HttpServlet3RequestFactory implements HttpServletRequestFactory {
public AsyncContext getAsyncContext() {
AsyncContext asyncContext = super.getAsyncContext();
+ if (asyncContext == null) {
+ return null;
+ }
return new SecurityContextAsyncContext(asyncContext);
}
@@ -300,6 +300,12 @@ public class SecurityContextHolderAwareRequestFilterTests {
this.logoutHandler);
+ // gh-3780
+ @Test
+ public void getAsyncContextNullFromSuper() throws Exception {
+ assertThat(wrappedRequest().getAsyncContext()).isNull();
+
@Test
public void getAsyncContextStart() throws Exception {
ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class);