Backport of https://github.com/spring-projects/spring-security/pull/9408

Comment From: jzheaux

Closed via 27e6743fd6c675bfe531de420ddf09cff17da2e8