use of org.springframework.social.facebook.api.User in project ORCID-Source by ORCID.
the class SocialAjaxAuthenticationSuccessHandler method retrieveUserDetails.
private Map<String, String> retrieveUserDetails(SocialType connectionType) {
Map<String, String> userMap = new HashMap<String, String>();
if (SocialType.FACEBOOK.equals(connectionType)) {
Facebook facebook = socialContext.getFacebook();
User user = facebook.fetchObject("me", User.class, "id", "email", "name");
userMap.put("providerUserId", user.getId());
userMap.put("userName", user.getName());
userMap.put("email", user.getEmail());
} else if (SocialType.GOOGLE.equals(connectionType)) {
Google google = socialContext.getGoogle();
Person person = google.plusOperations().getGoogleProfile();
userMap.put("providerUserId", person.getId());
userMap.put("userName", person.getDisplayName());
userMap.put("email", person.getAccountEmail());
}
return userMap;
}
use of org.springframework.social.facebook.api.User in project ORCID-Source by ORCID.
the class SocialController method retrieveUserDetails.
private Map<String, String> retrieveUserDetails(SocialType connectionType) {
Map<String, String> userMap = new HashMap<String, String>();
if (SocialType.FACEBOOK.equals(connectionType)) {
Facebook facebook = socialContext.getFacebook();
User user = facebook.fetchObject("me", User.class, "id", "email", "name", "first_name", "last_name");
userMap.put("providerUserId", user.getId());
userMap.put("userName", user.getName());
userMap.put("email", user.getEmail());
userMap.put("firstName", user.getFirstName());
userMap.put("lastName", user.getLastName());
} else if (SocialType.GOOGLE.equals(connectionType)) {
Google google = socialContext.getGoogle();
Person person = google.plusOperations().getGoogleProfile();
userMap.put("providerUserId", person.getId());
userMap.put("userName", person.getDisplayName());
userMap.put("email", person.getAccountEmail());
userMap.put("firstName", person.getGivenName());
userMap.put("lastName", person.getFamilyName());
}
return userMap;
}