Search in sources :

Example 1 with SocialLinkRepresentation

use of org.keycloak.representations.idm.SocialLinkRepresentation in project keycloak by keycloak.

the class RepresentationToModel method convertDeprecatedSocialProviders.

private static void convertDeprecatedSocialProviders(UserRepresentation user) {
    if (user.getSocialLinks() != null && !user.getSocialLinks().isEmpty() && user.getFederatedIdentities() == null) {
        logger.warnf("Using deprecated 'socialLinks' configuration in JSON representation for user '%s'. It will be removed in future versions", user.getUsername());
        List<FederatedIdentityRepresentation> federatedIdentities = new LinkedList<>();
        for (SocialLinkRepresentation social : user.getSocialLinks()) {
            FederatedIdentityRepresentation federatedIdentity = new FederatedIdentityRepresentation();
            federatedIdentity.setIdentityProvider(social.getSocialProvider());
            federatedIdentity.setUserId(social.getSocialUserId());
            federatedIdentity.setUserName(social.getSocialUsername());
            federatedIdentities.add(federatedIdentity);
        }
        user.setFederatedIdentities(federatedIdentities);
    }
    user.setSocialLinks(null);
}
Also used : SocialLinkRepresentation(org.keycloak.representations.idm.SocialLinkRepresentation) FederatedIdentityRepresentation(org.keycloak.representations.idm.FederatedIdentityRepresentation) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 FederatedIdentityRepresentation (org.keycloak.representations.idm.FederatedIdentityRepresentation)1 SocialLinkRepresentation (org.keycloak.representations.idm.SocialLinkRepresentation)1