/** * Validate a user's password * A check should be made prior to this call to ensure a Profile exists * @param username the username * @param password the password * @return true if password is valid */ public boolean validPassword(String username, String password) { return PasswordHasher.checkPassword(password, getUserProfile(username).getPassword()); }
/** * Validate a user's password * A check should be made prior to this call to ensure a Profile exists * @param username the username * @param password the password * @return true if password is valid */ public boolean validPassword(String username, String password) { return PasswordHasher.checkPassword(password, getUserProfile(username).getPassword()); }
public void test1() throws Exception { String hashed = PasswordHasher.hashPassword("flibble"); assertTrue(PasswordHasher.checkPassword("flibble", hashed)); assertFalse(PasswordHasher.checkPassword("flibble", "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh")); assertTrue(PasswordHasher.checkPassword("flibble", "flibble")); assertFalse(PasswordHasher.checkPassword("flibble", hashed + " ")); assertFalse(PasswordHasher.checkPassword("flibble", "flobble")); } }