if (token == null) {
return null;
}
OpenSocialPerson viewer = null;
OpenSocialClient client = new OpenSocialClient(
OpenSocialProvider.valueOf("FRIENDCONNECT"));
client.setProperty(OpenSocialClient.Property.TOKEN_NAME, "fcauth");
client.setProperty(OpenSocialClient.Property.TOKEN, token);
try {
viewer = client.fetchPerson();
} catch (OpenSocialRequestException e) {
return null;
} catch (IOException e) {
return null;
}
User user = new User();
user.setName(viewer.getDisplayName());
return user;
}