Forward port of issue spring-projects/spring-security#18285 to 1.4.3.
Forward port of issue spring-projects/spring-security#18285 to 1.4.3.