// Make sure there is no ambiguous information with regards to passwords
Set<Object> passwords = user.getPrivateCredentials(Password.class);
if (passwords.size() > 1) {
logger.warn("User '{}@{}' has more than one password'", name, site.getIdentifier());
throw new DataRetrievalFailureException("User '" + user + "' has more than one password");
} else if (passwords.size() == 0) {
logger.warn("User '{}@{}' has no password", name, site.getIdentifier());
throw new DataRetrievalFailureException("User '" + user + "' has no password");
}
// Create the password according to the site's and Spring Security's
// digest policy
Password p = (Password) passwords.iterator().next();