}  if (!user.getPassword().equals(authentication.getCredentials().toString())) { throw new BadCredentialsException("Bad credentials presented");
    public Authentication authenticate(Authentication authentication)        throws AuthenticationException {        User user = null;        try {            user = this.authenticationDao.loadUserByUsername(authentication.getPrincipal()                                                                           .toString());        } catch (UsernameNotFoundException notFound) {            throw new BadCredentialsException("Bad credentials presented");        } catch (DataAccessException repositoryProblem) {            throw new AuthenticationServiceException(repositoryProblem                .getMessage());        }        if (!user.isEnabled()) {            throw new DisabledException("User is disabled");        }        if (!user.getPassword().equals(authentication.getCredentials().toString())) {            throw new BadCredentialsException("Bad credentials presented");        }        return new UsernamePasswordAuthenticationToken(user.getUsername(),            user.getPassword(), user.getAuthorities());    }