@Test public void testNotMatched() { String rawPassword = "test"; boolean matched = this.instance.matches(rawPassword, "notmatched"); assertFalse(matched); }
public boolean matches(CharSequence rawPassword, String encodedPassword) { if (encodedPassword == null || encodedPassword.length() == 0) { logger.warning("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warning("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); }
BCryptPasswordEncoder implements PasswordEncoder { public boolean matches(CharSequence rawPassword, String encodedPassword) { if (encodedPassword == null || encodedPassword.length() == 0) { logger.warning("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warning("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); } }
BCryptPasswordEncoder implements PasswordEncoder { public boolean matches(CharSequence rawPassword, String encodedPassword) { if (encodedPassword == null || encodedPassword.length() == 0) { logger.warning("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warning("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); } BCryptPasswordEncoder();  BCryptPasswordEncoder(int strength);  BCryptPasswordEncoder(int strength, SecureRandom random); }
BCryptPasswordEncoder implements PasswordEncoder { public boolean matches(CharSequence rawPassword, String encodedPassword) { if (encodedPassword == null || encodedPassword.length() == 0) { logger.warning("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warning("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); } BCryptPasswordEncoder();  BCryptPasswordEncoder(int strength);  BCryptPasswordEncoder(int strength, SecureRandom random); String encode(CharSequence rawPassword); boolean matches(CharSequence rawPassword, String encodedPassword); }
BCryptPasswordEncoder implements PasswordEncoder { public boolean matches(CharSequence rawPassword, String encodedPassword) { if (encodedPassword == null || encodedPassword.length() == 0) { logger.warning("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warning("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); } BCryptPasswordEncoder();  BCryptPasswordEncoder(int strength);  BCryptPasswordEncoder(int strength, SecureRandom random); String encode(CharSequence rawPassword); boolean matches(CharSequence rawPassword, String encodedPassword);  }