public boolean authenticateUsernamePasswordInternal(
      final UsernamePasswordCredentials credentials) {
    final String username = credentials.getUsername();
    final String password = credentials.getPassword();

    if (StringUtils.hasText(username)
        && StringUtils.hasText(password)
        && username.equals(getPasswordEncoder().encode(password))) {
      log.debug("User [{}] was successfully authenticated.", username);
      return true;
    }

    log.debug("User [{}] failed authentication", username);

    return false;
  }
Example #2
0
 private Credentials creatCredentials(String username) {
   UsernamePasswordCredentials usernamePasswordCredentials = new UsernamePasswordCredentials();
   usernamePasswordCredentials.setUsername(username);
   usernamePasswordCredentials.setPassword("");
   return usernamePasswordCredentials;
 }