Package org.pac4j.oauth.profile.github

Examples of org.pac4j.oauth.profile.github.GitHubProfile


        kryo.register(GitHubPlan.class);
    }

    @Override
    protected void verifyProfile(final UserProfile userProfile) {
        final GitHubProfile profile = (GitHubProfile) userProfile;
        logger.debug("userProfile : {}", profile);
        assertEquals("1412558", profile.getId());
        assertEquals(GitHubProfile.class.getSimpleName() + UserProfile.SEPARATOR + "1412558", profile.getTypedId());
        assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), GitHubProfile.class));
        assertTrue(StringUtils.isNotBlank(profile.getAccessToken()));
        assertCommonProfile(userProfile, "testscribeup@gmail.com", null, null, "Test", "testscribeup",
                Gender.UNSPECIFIED, null, "https://avatars.githubusercontent.com/u/1412558?",
                "https://github.com/testscribeup", "Paris");
        assertEquals("User", profile.getType());
        assertEquals("ScribeUp", profile.getBlog());
        assertEquals("https://api.github.com/users/testscribeup", profile.getUrl());
        assertEquals(0, profile.getPublicGists().intValue());
        assertEquals(0, profile.getFollowing().intValue());
        assertEquals(0, profile.getPrivateGists().intValue());
        assertEquals(0, profile.getPublicRepos().intValue());
        assertEquals("67c3844a672979889c1e3abbd8c4eb22", profile.getGravatarId());
        assertEquals(0, profile.getFollowers().intValue());
        assertEquals("Company", profile.getCompany());
        assertFalse(profile.getHireable());
        assertEquals(0, profile.getCollaborators().intValue());
        assertNull(profile.getBio());
        assertEquals(0, profile.getTotalPrivateRepos().intValue());
        assertEquals("2012-02-06T13:05:21Z", profile.getCreatedAt().toString());
        assertEquals(0, profile.getDiskUsage().intValue());
        assertEquals(0, profile.getOwnedPrivateRepos().intValue());
        final GitHubPlan plan = profile.getPlan();
        assertEquals("free", plan.getName());
        assertEquals(0, plan.getCollaborators().intValue());
        assertEquals(307200, plan.getSpace().intValue());
        assertEquals(0, plan.getPrivateRepos().intValue());
        assertEquals(25, profile.getAttributes().size());
    }
View Full Code Here


        return "https://api.github.com/user";
    }
   
    @Override
    protected GitHubProfile extractUserProfile(final String body) {
        final GitHubProfile profile = new GitHubProfile();
        final JsonNode json = JsonHelper.getFirstNode(body);
        if (json != null) {
            profile.setId(JsonHelper.get(json, "id"));
            for (final String attribute : OAuthAttributesDefinitions.githubDefinition.getAllAttributes()) {
                profile.addAttribute(attribute, JsonHelper.get(json, attribute));
            }
        }
        return profile;
    }
View Full Code Here

TOP

Related Classes of org.pac4j.oauth.profile.github.GitHubProfile

Copyright © 2018 www.massapicom. 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.