コード例 #1
0
ファイル: RunGoogle2Client.java プロジェクト: jhegg/pac4j
 @Override
 protected void verifyProfile(UserProfile userProfile) {
   final Google2Profile profile = (Google2Profile) userProfile;
   assertEquals("113675986756217860428", profile.getId());
   assertEquals(
       Google2Profile.class.getName() + UserProfile.SEPARATOR + "113675986756217860428",
       profile.getTypedId());
   assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), Google2Profile.class));
   assertTrue(CommonHelper.isNotBlank(profile.getAccessToken()));
   assertCommonProfile(
       userProfile,
       "*****@*****.**",
       "Jérôme",
       "ScribeUP",
       "Jérôme ScribeUP",
       null,
       Gender.MALE,
       Locale.ENGLISH,
       "https://lh4.googleusercontent.com/-fFUNeYqT6bk/AAAAAAAAAAI/AAAAAAAAAAA/5gBL6csVWio/photo.jpg",
       "https://plus.google.com/113675986756217860428",
       null);
   assertNull(profile.getBirthday());
   assertTrue(profile.getEmails() != null && profile.getEmails().size() == 1);
   assertEquals(9, profile.getAttributes().size());
 }
コード例 #2
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;
 }