@Test public void testSaltedAuthenticationInfo() { HashedCredentialsMatcher matcher = new HashedCredentialsMatcher(Sha1Hash.ALGORITHM_NAME); ByteSource salt = new SecureRandomNumberGenerator().nextBytes(); Object hashedPassword = new Sha1Hash("password", salt); SimpleAuthenticationInfo account = new SimpleAuthenticationInfo("username", hashedPassword, salt, "realmName"); AuthenticationToken token = new UsernamePasswordToken("username", "password"); assertTrue(matcher.doCredentialsMatch(token, account)); }
@Override public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { Object tokenHashedCredentials = hashProvidedCredentials(token, info); Object accountCredentials = getCredentials(info); return equals(tokenHashedCredentials, accountCredentials); }
HashedCredentialsMatcher extends SimpleCredentialsMatcher { @Override public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { Object tokenHashedCredentials = hashProvidedCredentials(token, info); Object accountCredentials = getCredentials(info); return equals(tokenHashedCredentials, accountCredentials); } }
HashedCredentialsMatcher extends SimpleCredentialsMatcher { @Override public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { Object tokenHashedCredentials = hashProvidedCredentials(token, info); Object accountCredentials = getCredentials(info); return equals(tokenHashedCredentials, accountCredentials); } HashedCredentialsMatcher();  HashedCredentialsMatcher(String hashAlgorithmName); }
HashedCredentialsMatcher extends SimpleCredentialsMatcher { @Override public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { Object tokenHashedCredentials = hashProvidedCredentials(token, info); Object accountCredentials = getCredentials(info); return equals(tokenHashedCredentials, accountCredentials); } HashedCredentialsMatcher();  HashedCredentialsMatcher(String hashAlgorithmName); String getHashAlgorithmName(); void setHashAlgorithmName(String hashAlgorithmName); boolean isStoredCredentialsHexEncoded(); void setStoredCredentialsHexEncoded(boolean storedCredentialsHexEncoded); @Deprecated boolean isHashSalted(); @Deprecated void setHashSalted(boolean hashSalted); int getHashIterations(); void setHashIterations(int hashIterations); @Override boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info); }
HashedCredentialsMatcher extends SimpleCredentialsMatcher { @Override public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) { Object tokenHashedCredentials = hashProvidedCredentials(token, info); Object accountCredentials = getCredentials(info); return equals(tokenHashedCredentials, accountCredentials); } HashedCredentialsMatcher();  HashedCredentialsMatcher(String hashAlgorithmName); String getHashAlgorithmName(); void setHashAlgorithmName(String hashAlgorithmName); boolean isStoredCredentialsHexEncoded(); void setStoredCredentialsHexEncoded(boolean storedCredentialsHexEncoded); @Deprecated boolean isHashSalted(); @Deprecated void setHashSalted(boolean hashSalted); int getHashIterations(); void setHashIterations(int hashIterations); @Override boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info);  }