Package org.keycloak.representations.idm

Examples of org.keycloak.representations.idm.SocialLinkRepresentation


        // Social links
        Set<SocialLinkModel> socialLinks = session.users().getSocialLinks(user, realm);
        List<SocialLinkRepresentation> socialLinkReps = new ArrayList<SocialLinkRepresentation>();
        for (SocialLinkModel socialLink : socialLinks) {
            SocialLinkRepresentation socialLinkRep = exportSocialLink(socialLink);
            socialLinkReps.add(socialLinkRep);
        }
        if (socialLinkReps.size() > 0) {
            userRep.setSocialLinks(socialLinkReps);
        }
View Full Code Here


        return userRep;
    }

    public static SocialLinkRepresentation exportSocialLink(SocialLinkModel socialLink) {
        SocialLinkRepresentation socialLinkRep = new SocialLinkRepresentation();
        socialLinkRep.setSocialProvider(socialLink.getSocialProvider());
        socialLinkRep.setSocialUserId(socialLink.getSocialUserId());
        socialLinkRep.setSocialUsername(socialLink.getSocialUsername());
        return socialLinkRep;
    }
View Full Code Here

        rep.setUsername(ClaimMask.hasUsername(model.getAllowedClaimsMask()));
        return rep;
    }

    public static SocialLinkRepresentation toRepresentation(SocialLinkModel socialLink) {
        SocialLinkRepresentation rep = new SocialLinkRepresentation();
        rep.setSocialUsername(socialLink.getSocialUsername());
        rep.setSocialProvider(socialLink.getSocialProvider());
        rep.setSocialUserId(socialLink.getSocialUserId());
        return rep;
    }
View Full Code Here

    public void addSocialLink() {
        createUser();

        UserResource user = realm.users().get("user1");

        SocialLinkRepresentation link = new SocialLinkRepresentation();
        link.setSocialUserId("social-user-id");
        link.setSocialUsername("social-username");

        Response response = user.addSocialLink("social-provider-id", link);
        assertEquals(204, response.getStatus());
    }
View Full Code Here

        addSocialLink();

        UserResource user = realm.users().get("user1");
        assertEquals(1, user.getSocialLinks().size());

        SocialLinkRepresentation link = user.getSocialLinks().get(0);
        assertEquals("social-provider-id", link.getSocialProvider());
        assertEquals("social-user-id", link.getSocialUserId());
        assertEquals("social-username", link.getSocialUsername());
    }
View Full Code Here

            throw new NotFoundException("User not found");
        }
        Set<SocialLinkModel> socialLinks = session.users().getSocialLinks(user, realm);
        List<SocialLinkRepresentation> result = new ArrayList<SocialLinkRepresentation>();
        for (SocialLinkModel socialLink : socialLinks) {
            SocialLinkRepresentation rep = ModelToRepresentation.toRepresentation(socialLink);
            result.add(rep);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.keycloak.representations.idm.SocialLinkRepresentation

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.