user.getPassword(), user.getAuthorities());
authentication.getCredentials(), user.getAuthorities());
    public Authentication authenticate(Authentication authentication)        throws AuthenticationException {        boolean cacheWasUsed = true;        User user = this.userCache.getUserFromCache(authentication.getPrincipal()                                                                  .toString());        if (user == null) {            cacheWasUsed = false;            user = getUserFromBackend(authentication);        }        if (!user.isEnabled()) {            if (this.ctx != null) {                ctx.publishEvent(new AuthenticationFailureDisabledEvent(                        authentication, user));            }            throw new DisabledException("User is disabled");        }        if (!isPasswordCorrect(authentication, user)) {            // Password incorrect, so ensure we're using most current password            if (cacheWasUsed) {                cacheWasUsed = false;                user = getUserFromBackend(authentication);            }            if (!isPasswordCorrect(authentication, user)) {                if (this.ctx != null) {                    ctx.publishEvent(new AuthenticationFailurePasswordEvent(                            authentication, user));                }                throw new BadCredentialsException("Bad credentials presented");            }        }        if (!cacheWasUsed) {            // Put into cache            this.userCache.putUserInCache(user);            // As this appears to be an initial login, publish the event            if (this.ctx != null) {                ctx.publishEvent(new AuthenticationSuccessEvent(                        authentication, user));            }        }        return new UsernamePasswordAuthenticationToken(user.getUsername(),            user.getPassword(), user.getAuthorities());    }