Examples of YahooProfile


Examples of org.pac4j.oauth.profile.yahoo.YahooProfile

        kryo.register(YahooAddress.class);
    }
   
    @Override
    protected void verifyProfile(final UserProfile userProfile) {
        final YahooProfile profile = (YahooProfile) userProfile;
        logger.debug("userProfile : {}", profile);
        assertEquals("PCSXZCYSWC6XUJNMZKRGWVPHNU", profile.getId());
        assertEquals(YahooProfile.class.getSimpleName() + UserProfile.SEPARATOR + "PCSXZCYSWC6XUJNMZKRGWVPHNU",
                     profile.getTypedId());
        assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), YahooProfile.class));
        assertTrue(StringUtils.isNotBlank(profile.getAccessToken()));
        assertCommonProfile(userProfile, "testscribeup@yahoo.fr", "Test", "ScribeUP", "Test ScribeUP", "Test",
                            Gender.MALE, Locale.FRANCE,
                            "/users/1DJGkdA6uAAECQWEo8AceAQ==.large.png",
                            "http://profile.yahoo.com/PCSXZCYSWC6XUJNMZKRGWVPHNU", "Chatou, Ile-de-France");
        assertEquals("my profile", profile.getAboutMe());
        final List<YahooAddress> addresses = profile.getAddresses();
        assertEquals(2, addresses.size());
        final YahooAddress address = addresses.get(0);
        assertEquals(3, address.getId().intValue());
        assertTrue(address.getCurrent());
        assertEquals(Locale.FRENCH, address.getCountry());
        assertEquals("", address.getState());
        assertEquals("", address.getCity());
        assertEquals("78400", address.getPostalCode());
        assertEquals("", address.getStreet());
        assertEquals("HOME", address.getType());
        assertEquals(1976, profile.getBirthYear().intValue());
        assertEquals("03/10", profile.getBirthdate().toString());
        assertEquals("2012-02-06T12:46:43Z", profile.getCreated().toString());
        assertEquals(38, profile.getDisplayAge().intValue());
        final List<YahooDisclosure> disclosures = profile.getDisclosures();
        assertEquals(2, disclosures.size());
        final YahooDisclosure disclosure = disclosures.get(0);
        assertEquals("1", disclosure.getAcceptance());
        assertEquals("bd", disclosure.getName());
        assertTrue(disclosure.getSeen() instanceof Date);
        assertEquals("1", disclosure.getVersion());
        final List<YahooEmail> emails = profile.getEmails();
        assertEquals(2, emails.size());
        final YahooEmail email = emails.get(1);
        assertEquals(2, email.getId().intValue());
        assertTrue(email.getPrimary());
        assertEquals("testscribeup@yahoo.fr", email.getHandle());
        assertEquals("HOME", email.getType());
        assertEquals(Gender.MALE, profile.getGender());
        final YahooImage image = profile.getImage();
        assertTrue(image.getImageUrl().contains("/users/1DJGkdA6uAAECQWEo8AceAQ==.large.png"));
        assertEquals(150, image.getWidth().intValue());
        assertEquals(225, image.getHeight().intValue());
        assertEquals("150x225", image.getSize());
        final List<YahooInterest> interests = profile.getInterests();
        assertEquals(11, interests.size());
        final YahooInterest interest = interests.get(0);
        assertEquals("basic interest", interest.getDeclaredInterests().get(0));
        assertEquals("prfFavHobbies", interest.getInterestCategory());
        assertTrue(profile.getIsConnected());
        assertEquals("2012-02-06T12:46:36Z", profile.getMemberSince().toString());
        assertEquals("Europe/Paris", profile.getTimeZone());
        assertEquals("2014-04-21T14:04:30Z", profile.getUpdated().toString());
        assertEquals("https://social.yahooapis.com/v1/user/PCSXZCYSWC6XUJNMZKRGWVPHNU/profile", profile.getUri());
        assertNotNull(profile.getAccessSecret());
        assertEquals(24, profile.getAttributes().size());
    }
View Full Code Here

Examples of org.pac4j.oauth.profile.yahoo.YahooProfile

            final String message = "Cannot find guid from body : " + body;
            logger.error(message);
            throw new HttpCommunicationException(message);
        }
        body = sendRequestForData(accessToken, "https://social.yahooapis.com/v1/user/" + guid + "/profile?format=json");
        final YahooProfile profile = extractUserProfile(body);
        addAccessTokenToProfile(profile, accessToken);
        return profile;
    }
View Full Code Here

Examples of org.pac4j.oauth.profile.yahoo.YahooProfile

        return profile;
    }
   
    @Override
    protected YahooProfile extractUserProfile(final String body) {
        final YahooProfile profile = new YahooProfile();
        JsonNode json = JsonHelper.getFirstNode(body);
        if (json != null) {
            json = json.get("profile");
            if (json != null) {
                profile.setId(JsonHelper.get(json, "guid"));
                for (final String attribute : OAuthAttributesDefinitions.yahooDefinition.getAllAttributes()) {
                    profile.addAttribute(attribute, JsonHelper.get(json, attribute));
                }
            }
        }
        return profile;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.