コード例 #1
0
ファイル: FacebookClient.java プロジェクト: jasonaowen/pac4j
 protected void extractData(
     final FacebookProfile profile, final JsonNode json, final String name) {
   final JsonNode data = (JsonNode) JsonHelper.getElement(json, name);
   if (data != null) {
     profile.addAttribute(name, JsonHelper.getElement(data, "data"));
   }
 }
コード例 #2
0
ファイル: FacebookInfo.java プロジェクト: wildone/pac4j
 @Override
 protected void buildFromJson(final JsonNode json) {
   this.id = (String) JsonHelper.convert(Converters.stringConverter, json, "id");
   this.category = (String) JsonHelper.convert(Converters.stringConverter, json, "category");
   this.name = (String) JsonHelper.convert(Converters.stringConverter, json, "name");
   this.createdTime = (Date) JsonHelper.convert(Converters.dateConverter, json, "created_time");
 }
コード例 #3
0
 @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;
 }
コード例 #4
0
ファイル: FacebookGroup.java プロジェクト: Javarome/pac4j
 @Override
 protected void buildFromJson(final JsonNode json) {
   this.version = (Integer) JsonHelper.convert(Converters.integerConverter, json, "version");
   this.name = (String) JsonHelper.convert(Converters.stringConverter, json, "name");
   this.id = (String) JsonHelper.convert(Converters.stringConverter, json, "id");
   this.administrator =
       (Boolean) JsonHelper.convert(Converters.booleanConverter, json, "administrator");
   this.bookmarkOrder =
       (Integer) JsonHelper.convert(Converters.integerConverter, json, "bookmark_order");
 }
コード例 #5
0
ファイル: OkProfileDefinition.java プロジェクト: pac4j/pac4j
 @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;
 }
コード例 #6
0
ファイル: OkClient.java プロジェクト: baxterj/pac4j
 @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;
 }
コード例 #7
0
ファイル: Google2Client.java プロジェクト: DevFactory/pac4j
 @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;
 }
コード例 #8
0
ファイル: WordPressClient.java プロジェクト: papegaaij/pac4j
 @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;
 }
コード例 #9
0
ファイル: FacebookClient.java プロジェクト: jasonaowen/pac4j
 @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;
 }