catch (RuntimeException ex) {
throw new AuthenticationException("An error occurred while authenticating.", ex);
}
if (result != Identity.AuthenticationResult.SUCCESS) {
throw new FailedAuthenticationException();
}
final User user = createUser((org.picketlink.idm.model.basic.User) identity.getAccount(), getRolesOfCurrentUser());
return user;
}