/** Checks users email and password by finding matching user. */ public final U findUser(String username, String rawPassword) { U userAuth = findUserAuthByUsername(username); if (userAuth == null) { return null; } if (!passwordEncoder.isPasswordValid(userAuth.getHashedPassword(), rawPassword)) { return null; } return userAuth; }
/** Finds an user for given userId and hashed password. */ public final U findUser(long userId, String hashedPassword) { U userAuth = findUserAuthById(userId); if (userAuth == null) { return null; } if (hashedPassword == null) { return null; } if (!hashedPassword.equals(userAuth.getHashedPassword())) { return null; } return userAuth; }