com.flyfish.oauth.utils.UserConvertUtils Maven / Gradle / Ivy
package com.flyfish.oauth.utils;
import com.flyfish.oauth.configuration.OAuth2SsoUserService;
import com.flyfish.oauth.domain.raw.SSOUserInfo;
public abstract class UserConvertUtils {
/**
* 转换用户
*
* @param userService 用户service
* @param userInfo 用户信息
* @param 泛型
* @return 结果
*/
public static T convert(OAuth2SsoUserService userService, SSOUserInfo userInfo) {
if (null == userService) {
return null;
}
if (userService.exists(userInfo)) {
return userService.getUser(userInfo);
}
return userService.completeUser(userInfo);
}
}