AuthenticationInfo authenticationInfo;
final HashingPasswordService hashService = getHashService();
if (hashService != null) {
final Hash hash = hashService.hashPassword(token.getPassword());
final ByteSource salt = hash.getSalt();
authenticationInfo = new SimpleAuthenticationInfo(principal, hash, salt, REALM_NAME);
} else {
final Object creds = token.getCredentials();
authenticationInfo = new SimpleAuthenticationInfo(principal, creds, REALM_NAME);
}
return authenticationInfo;
}