@Override protected TestOAuth1Profile extractUserProfile(String body) { final TestOAuth1Profile profile = new TestOAuth1Profile(); JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { profile.setId(JsonHelper.get(json, "id")); } return profile; }
@Override public OkProfile extractUserProfile(String body) throws HttpAction { final OkProfile profile = newProfile(); JsonNode userNode = JsonHelper.getFirstNode(body); if (userNode != null) { profile.setId(JsonHelper.getElement(userNode, OkProfileDefinition.UID)); for (final String attribute : getPrimaryAttributes()) { convertAndAdd(profile, attribute, JsonHelper.getElement(userNode, attribute)); } } return profile; }
@Override protected OkProfile extractUserProfile(String body) { final OkProfile profile = new OkProfile(); JsonNode userNode = JsonHelper.getFirstNode(body); if (userNode != null) { profile.setId(JsonHelper.getElement(userNode, OkAttributesDefinition.UID)); for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) { profile.addAttribute(attribute, JsonHelper.getElement(userNode, attribute)); } } return profile; }
@Override protected Google2Profile extractUserProfile(final String body) { final Google2Profile profile = new Google2Profile(); final JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { profile.setId(JsonHelper.get(json, "id")); for (final String attribute : OAuthAttributesDefinitions.google2Definition.getPrincipalAttributes()) { profile.addAttribute(attribute, JsonHelper.get(json, attribute)); } } return profile; }
@Override protected WordPressProfile extractUserProfile(final String body) { final WordPressProfile profile = new WordPressProfile(); JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { profile.setId(JsonHelper.get(json, "ID")); for (final String attribute : OAuthAttributesDefinitions.wordPressDefinition.getPrincipalAttributes()) { profile.addAttribute(attribute, JsonHelper.get(json, attribute)); } json = json.get("meta"); if (json != null) { final String attribute = WordPressAttributesDefinition.LINKS; profile.addAttribute(attribute, JsonHelper.get(json, attribute)); } } return profile; }
@Override protected FacebookProfile extractUserProfile(final String body) { final FacebookProfile profile = new FacebookProfile(); final JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { profile.setId(JsonHelper.getElement(json, "id")); for (final String attribute : profile.getAttributesDefinition().getPrimaryAttributes()) { profile.addAttribute(attribute, JsonHelper.getElement(json, attribute)); } extractData(profile, json, FacebookAttributesDefinition.FRIENDS); extractData(profile, json, FacebookAttributesDefinition.MOVIES); extractData(profile, json, FacebookAttributesDefinition.MUSIC); extractData(profile, json, FacebookAttributesDefinition.BOOKS); extractData(profile, json, FacebookAttributesDefinition.LIKES); extractData(profile, json, FacebookAttributesDefinition.ALBUMS); extractData(profile, json, FacebookAttributesDefinition.EVENTS); extractData(profile, json, FacebookAttributesDefinition.GROUPS); extractData(profile, json, FacebookAttributesDefinition.MUSIC_LISTENS); extractData(profile, json, FacebookAttributesDefinition.PICTURE); } return profile; }