All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.healthy.common.security.social.SocialController Maven / Gradle / Ivy

There is a newer version: 1.2.1.RELEASE
Show newest version
package com.healthy.common.security.social;

import com.healthy.common.security.social.support.SocialUserInfo;
import org.springframework.social.connect.Connection;

import java.util.Objects;

/**
 * SocialController
 *
 * @author xiaomingzhang
 */
public abstract class SocialController {
    /**
     * 根据Connection信息构建SocialUserInfo
     *
     * @param connection
     * @return
     */
    protected SocialUserInfo buildSocialUserInfo(Connection connection) {
        SocialUserInfo userInfo = null;
        if (Objects.nonNull(connection)) {
            userInfo = new SocialUserInfo();
            userInfo.setProviderId(connection.getKey().getProviderId());
            userInfo.setProviderUserId(connection.getKey().getProviderUserId());
            userInfo.setNickname(connection.getDisplayName());
            userInfo.setHeadImg(connection.getImageUrl());
        }
        return userInfo;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy