I've recently been implementing some security improvements in one of my employer's Spring-based Java applications, and I've overridden Spring Security's AbstractUserDetailsAuthenticationProvider
class in order to do some extra processing around user authentication. During this process I realised that the DefaultPreAuthenticationChecks
inner class performs user account checks prior to the authentication provider running through the additionalAuthenticationChecks
method which does the validating of the password. If a user is disabled, expired or locked, an exception will be thrown, and thus the relevant messages will be displayed on the screen. To me, checking a user account and providing details of this account prior to successfully validating the password is a blatant security risk, as it could expose whether a user account exists or not. Does anyone know a good reason why Spring Security may have done things this way? Obviously I can just override the DefaultPreAuthenticationChecks
class by creating my own dummy class with a check
method that does nothing, but it's a shame that this has to be done in the first place.
Thanks in advance.
P.S. I found a question on a related note here, but nobody seemed to ask the question as to why this potential security flaw exists.