Forward port of #13970
Comment From: marcusdacoregio
Closed via https://github.com/spring-projects/spring-security/commit/4ca7e842f07356fcc98199807dfddae9293945fd
Forward port of #13970
Comment From: marcusdacoregio
Closed via https://github.com/spring-projects/spring-security/commit/4ca7e842f07356fcc98199807dfddae9293945fd