|| credentials.toString().isEmpty()) {
throw new IllegalArgumentException(String.format(
"Invalid username/password combination for %1$s",
username));
}
final Actor actor = ServiceProvider.IMPL.getCredentialService().authenticate(username,
credentials.toString());
if (actor == null) {
throw new AuthenticationException(Actor.class.getName() + ':' + username);
}
final String[] roles = new String[actor.getRoles().size()];
int i = -1;
for (final Role role : actor.getRoles()) {
roles[++i] = role.getRole();
}
// The password should already be an MD5 hash using the same salt pattern as the
// JPA provider
final Credential cred = Credential.getCredential(MD5.__TYPE + actor.getPassword());
return putUser(username, cred, roles);
} catch (final Throwable t) {
final String msg = String.format("Unable to authenticate %1$s",
username);
if (log.isDebugEnabled()) {