Merge branch 'master' into dev
This commit is contained in:
@@ -294,7 +294,7 @@ public enum AuthSource {
|
||||
|
||||
@Override
|
||||
public String userInfo() {
|
||||
return "https://oauth2.googleapis.com/tokeninfo";
|
||||
return "https://www.googleapis.com/oauth2/v3/userinfo";
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -81,7 +81,7 @@ public class AuthAlipayRequest extends AuthDefaultRequest {
|
||||
.location(location)
|
||||
.gender(AuthUserGender.getRealGender(response.getGender()))
|
||||
.token(authToken)
|
||||
.source(AuthSource.ALIPAY)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import me.zhyd.oauth.config.AuthSource;
|
||||
import me.zhyd.oauth.enums.AuthUserGender;
|
||||
import me.zhyd.oauth.exception.AuthException;
|
||||
import me.zhyd.oauth.model.*;
|
||||
import me.zhyd.oauth.utils.StringUtils;
|
||||
import me.zhyd.oauth.utils.UrlBuilder;
|
||||
|
||||
/**
|
||||
@@ -39,14 +40,19 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
|
||||
.uuid(object.getString("userid"))
|
||||
.username(object.getString("username"))
|
||||
.nickname(object.getString("username"))
|
||||
.avatar(object.getString("portrait"))
|
||||
.avatar(getAvatar(object))
|
||||
.remark(object.getString("userdetail"))
|
||||
.gender(AuthUserGender.getRealGender(object.getString("sex")))
|
||||
.token(authToken)
|
||||
.source(AuthSource.BAIDU)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
private String getAvatar(JSONObject object) {
|
||||
String protrait = object.getString("portrait");
|
||||
return StringUtils.isEmpty(protrait) ? null : String.format("http://himg.bdimg.com/sys/portrait/item/%s.jpg", protrait);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthResponse revoke(AuthToken authToken) {
|
||||
HttpResponse response = doGetRevoke(authToken);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class AuthCodingRequest extends AuthDefaultRequest {
|
||||
.email(object.getString("email"))
|
||||
.remark(object.getString("slogan"))
|
||||
.token(authToken)
|
||||
.source(AuthSource.CODING)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class AuthCsdnRequest extends AuthDefaultRequest {
|
||||
.blog(object.getString("website"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.CSDN)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
|
||||
* @version 1.0
|
||||
* @since 1.8
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public abstract class AuthDefaultRequest implements AuthRequest {
|
||||
protected AuthConfig config;
|
||||
@@ -81,6 +80,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
|
||||
/**
|
||||
* 返回获取accessToken的url
|
||||
*
|
||||
* @param code 授权码
|
||||
* @return 返回获取accessToken的url
|
||||
*/
|
||||
protected String accessTokenUrl(String code) {
|
||||
@@ -96,6 +96,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
|
||||
/**
|
||||
* 返回获取accessToken的url
|
||||
*
|
||||
* @param refreshToken refreshToken
|
||||
* @return 返回获取accessToken的url
|
||||
*/
|
||||
protected String refreshTokenUrl(String refreshToken) {
|
||||
@@ -111,6 +112,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
protected String userInfoUrl(AuthToken authToken) {
|
||||
@@ -120,6 +122,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
|
||||
/**
|
||||
* 返回获取revoke authorization的url
|
||||
*
|
||||
* @param authToken token
|
||||
* @return 返回获取revoke authorization的url
|
||||
*/
|
||||
protected String revokeUrl(AuthToken authToken) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class AuthDingTalkRequest extends AuthDefaultRequest {
|
||||
.nickname(object.getString("nick"))
|
||||
.username(object.getString("nick"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.source(AuthSource.DINGTALK)
|
||||
.source(source)
|
||||
.token(token)
|
||||
.build();
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class AuthDingTalkRequest extends AuthDefaultRequest {
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken
|
||||
* @param authToken 用户授权后的token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -42,7 +42,7 @@ public class AuthDouyinRequest extends AuthDefaultRequest {
|
||||
.remark(userInfoObject.getString("description"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.DOUYIN)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AuthFacebookRequest extends AuthDefaultRequest {
|
||||
.email(object.getString("email"))
|
||||
.gender(AuthUserGender.getRealGender(object.getString("gender")))
|
||||
.token(authToken)
|
||||
.source(AuthSource.FACEBOOK)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class AuthGiteeRequest extends AuthDefaultRequest {
|
||||
.remark(object.getString("bio"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.GITEE)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ import me.zhyd.oauth.exception.AuthException;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.model.AuthToken;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.utils.GlobalAuthUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Github登录
|
||||
@@ -26,12 +29,14 @@ public class AuthGithubRequest extends AuthDefaultRequest {
|
||||
@Override
|
||||
protected AuthToken getAccessToken(AuthCallback authCallback) {
|
||||
HttpResponse response = doPostAuthorizationCode(authCallback.getCode());
|
||||
JSONObject accessTokenObject = JSONObject.parseObject(response.body());
|
||||
this.checkResponse(accessTokenObject);
|
||||
Map<String, String> res = GlobalAuthUtil.parseStringToMap(response.body());
|
||||
if (res.containsKey("error")) {
|
||||
throw new AuthException(res.get("error") + ":" + res.get("error_description"));
|
||||
}
|
||||
return AuthToken.builder()
|
||||
.accessToken(accessTokenObject.getString("access_token"))
|
||||
.scope(accessTokenObject.getString("scope"))
|
||||
.tokenType(accessTokenObject.getString("token_type"))
|
||||
.accessToken(res.get("access_token"))
|
||||
.scope(res.get("scope"))
|
||||
.tokenType(res.get("token_type"))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -39,7 +44,9 @@ public class AuthGithubRequest extends AuthDefaultRequest {
|
||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
||||
HttpResponse response = doGetUserInfo(authToken);
|
||||
JSONObject object = JSONObject.parseObject(response.body());
|
||||
this.checkResponse(object);
|
||||
if (object.containsKey("error")) {
|
||||
throw new AuthException(object.getString("error_description"));
|
||||
}
|
||||
return AuthUser.builder()
|
||||
.uuid(object.getString("id"))
|
||||
.username(object.getString("login"))
|
||||
@@ -52,7 +59,7 @@ public class AuthGithubRequest extends AuthDefaultRequest {
|
||||
.remark(object.getString("bio"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.GITHUB)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -62,8 +69,6 @@ public class AuthGithubRequest extends AuthDefaultRequest {
|
||||
* @param object 请求响应内容
|
||||
*/
|
||||
private void checkResponse(JSONObject object) {
|
||||
if (object.containsKey("error")) {
|
||||
throw new AuthException(object.getString("error_description"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.zhyd.oauth.request;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
@@ -40,25 +41,28 @@ public class AuthGoogleRequest extends AuthDefaultRequest {
|
||||
|
||||
@Override
|
||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
||||
HttpResponse response = doGetUserInfo(authToken);
|
||||
HttpResponse response = HttpRequest.post(userInfoUrl(authToken))
|
||||
.header("Authorization", "Bearer " + authToken.getAccessToken())
|
||||
.execute();
|
||||
String userInfo = response.body();
|
||||
JSONObject object = JSONObject.parseObject(userInfo);
|
||||
this.checkResponse(object);
|
||||
return AuthUser.builder()
|
||||
.uuid(object.getString("sub"))
|
||||
.username(object.getString("name"))
|
||||
.username(object.getString("email"))
|
||||
.avatar(object.getString("picture"))
|
||||
.nickname(object.getString("name"))
|
||||
.location(object.getString("locale"))
|
||||
.email(object.getString("email"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.GOOGLE)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回认证url,可自行跳转页面
|
||||
* https://openidconnect.googleapis.com/v1/userinfo
|
||||
*
|
||||
* @return 返回授权地址
|
||||
*/
|
||||
@@ -76,12 +80,12 @@ public class AuthGoogleRequest extends AuthDefaultRequest {
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken
|
||||
* @param authToken 用户授权后的token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
@Override
|
||||
protected String userInfoUrl(AuthToken authToken) {
|
||||
return UrlBuilder.fromBaseUrl(source.userInfo()).queryParam("id_token", authToken.getAccessToken()).build();
|
||||
return UrlBuilder.fromBaseUrl(source.userInfo()).queryParam("access_token", authToken.getAccessToken()).build();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +95,7 @@ public class AuthGoogleRequest extends AuthDefaultRequest {
|
||||
*/
|
||||
private void checkResponse(JSONObject object) {
|
||||
if (object.containsKey("error") || object.containsKey("error_description")) {
|
||||
throw new AuthException(object.getString("error_description"));
|
||||
throw new AuthException(object.containsKey("error") + ":" + object.getString("error_description"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.JSONPath;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.config.AuthSource;
|
||||
import me.zhyd.oauth.enums.AuthUserGender;
|
||||
@@ -120,13 +121,8 @@ public class AuthLinkedinRequest extends AuthDefaultRequest {
|
||||
.execute();
|
||||
JSONObject emailObj = JSONObject.parseObject(emailResponse.body());
|
||||
this.checkResponse(emailObj);
|
||||
if (emailObj.containsKey("elements")) {
|
||||
email = emailObj.getJSONArray("elements")
|
||||
.getJSONObject(0)
|
||||
.getJSONObject("handle~")
|
||||
.getString("emailAddress");
|
||||
}
|
||||
return email;
|
||||
Object obj = JSONPath.eval(emailObj, "$['elements'][0]['handle~']['emailAddress']");
|
||||
return null == obj ? null : (String) obj;
|
||||
}
|
||||
|
||||
private String getUserName(JSONObject userInfoObject, String nameKey) {
|
||||
@@ -204,7 +200,7 @@ public class AuthLinkedinRequest extends AuthDefaultRequest {
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken
|
||||
* @param authToken 用户授权后的token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -75,7 +75,7 @@ public class AuthMiRequest extends AuthDefaultRequest {
|
||||
.email(user.getString("mail"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.MI)
|
||||
.source(source)
|
||||
.build();
|
||||
|
||||
// 获取用户邮箱手机号等信息
|
||||
@@ -128,7 +128,7 @@ public class AuthMiRequest extends AuthDefaultRequest {
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken
|
||||
* @param authToken 用户授权后的token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -83,7 +83,7 @@ public class AuthMicrosoftRequest extends AuthDefaultRequest {
|
||||
.email(object.getString("mail"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.MICROSOFT)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class AuthMicrosoftRequest extends AuthDefaultRequest {
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken
|
||||
* @param authToken 用户授权后的token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
@Override
|
||||
@@ -150,7 +150,7 @@ public class AuthMicrosoftRequest extends AuthDefaultRequest {
|
||||
/**
|
||||
* 返回获取accessToken的url
|
||||
*
|
||||
* @param refreshToken
|
||||
* @param refreshToken 用户授权后的token
|
||||
* @return 返回获取accessToken的url
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public class AuthOschinaRequest extends AuthDefaultRequest {
|
||||
.gender(AuthUserGender.getRealGender(object.getString("gender")))
|
||||
.email(object.getString("email"))
|
||||
.token(authToken)
|
||||
.source(AuthSource.OSCHINA)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class AuthOschinaRequest extends AuthDefaultRequest {
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken
|
||||
* @param authToken 用户授权后的token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,7 @@ import static me.zhyd.oauth.config.AuthSource.PINTEREST;
|
||||
*
|
||||
* @author hongwei.peng (pengisgood(at)gmail(dot)com)
|
||||
* @version 1.9.0
|
||||
* @since 1.9.0
|
||||
* @since 1.8
|
||||
*/
|
||||
public class AuthPinterestRequest extends AuthDefaultRequest {
|
||||
|
||||
@@ -43,10 +43,8 @@ public class AuthPinterestRequest extends AuthDefaultRequest {
|
||||
|
||||
@Override
|
||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
||||
String userinfoUrl = UrlBuilder.fromBaseUrl(userInfoUrl(authToken))
|
||||
.queryParam("fields", "id,username,first_name,last_name,bio,image")
|
||||
.build();
|
||||
HttpResponse response = HttpRequest.post(userinfoUrl).execute();
|
||||
String userinfoUrl = userInfoUrl(authToken);
|
||||
HttpResponse response = HttpRequest.get(userinfoUrl).setFollowRedirects(true).execute();
|
||||
JSONObject object = JSONObject.parseObject(response.body());
|
||||
this.checkResponse(object);
|
||||
JSONObject userObj = object.getJSONObject("data");
|
||||
@@ -58,7 +56,7 @@ public class AuthPinterestRequest extends AuthDefaultRequest {
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.remark(userObj.getString("bio"))
|
||||
.token(authToken)
|
||||
.source(PINTEREST)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -82,6 +80,19 @@ public class AuthPinterestRequest extends AuthDefaultRequest {
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
protected String userInfoUrl(AuthToken authToken) {
|
||||
return UrlBuilder.fromBaseUrl(source.userInfo())
|
||||
.queryParam("access_token", authToken.getAccessToken())
|
||||
.queryParam("fields", "id,username,first_name,last_name,bio,image")
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查响应内容是否正确
|
||||
*
|
||||
|
||||
@@ -65,7 +65,7 @@ public class AuthQqRequest extends AuthDefaultRequest {
|
||||
.uuid(openId)
|
||||
.gender(AuthUserGender.getRealGender(object.getString("gender")))
|
||||
.token(authToken)
|
||||
.source(AuthSource.QQ)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ import static me.zhyd.oauth.model.AuthResponseStatus.SUCCESS;
|
||||
* 人人登录
|
||||
*
|
||||
* @author hongwei.peng (pengisgood(at)gmail(dot)com)
|
||||
* @version 1.8.1
|
||||
* @since 1.8.1
|
||||
* @version 1.9.0
|
||||
* @since 1.8
|
||||
*/
|
||||
public class AuthRenrenRequest extends AuthDefaultRequest {
|
||||
|
||||
@@ -45,7 +45,7 @@ public class AuthRenrenRequest extends AuthDefaultRequest {
|
||||
.company(getCompany(userObj))
|
||||
.gender(getGender(userObj))
|
||||
.token(authToken)
|
||||
.source(RENREN)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class AuthRenrenRequest extends AuthDefaultRequest {
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken
|
||||
* @param authToken 用户授权后的token
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,7 @@ import static me.zhyd.oauth.utils.GlobalAuthUtil.parseQueryToMap;
|
||||
*
|
||||
* @author hongwei.peng (pengisgood(at)gmail(dot)com)
|
||||
* @version 1.9.0
|
||||
* @since 1.9.0
|
||||
* @since 1.8
|
||||
*/
|
||||
public class AuthStackOverflowRequest extends AuthDefaultRequest {
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AuthStackOverflowRequest extends AuthDefaultRequest {
|
||||
.blog(userObj.getString("website_url"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(STACK_OVERFLOW)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class AuthTaobaoRequest extends AuthDefaultRequest {
|
||||
.nickname(nick)
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.TAOBAO)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class AuthTeambitionRequest extends AuthDefaultRequest {
|
||||
.email(object.getString("email"))
|
||||
.gender(AuthUserGender.UNKNOWN)
|
||||
.token(authToken)
|
||||
.source(AuthSource.TEAMBITION)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class AuthTencentCloudRequest extends AuthDefaultRequest {
|
||||
.email(object.getString("email"))
|
||||
.remark(object.getString("slogan"))
|
||||
.token(authToken)
|
||||
.source(AuthSource.TENCENT_CLOUD)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class AuthToutiaoRequest extends AuthDefaultRequest {
|
||||
.remark(user.getString("description"))
|
||||
.gender(AuthUserGender.getRealGender(user.getString("gender")))
|
||||
.token(authToken)
|
||||
.source(AuthSource.TOUTIAO)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class AuthWeChatRequest extends AuthDefaultRequest {
|
||||
.uuid(openId)
|
||||
.gender(AuthUserGender.getRealGender(object.getString("sex")))
|
||||
.token(authToken)
|
||||
.source(AuthSource.WECHAT)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -69,14 +69,14 @@ public class AuthWeiboRequest extends AuthDefaultRequest {
|
||||
.remark(object.getString("description"))
|
||||
.gender(AuthUserGender.getRealGender(object.getString("gender")))
|
||||
.token(authToken)
|
||||
.source(AuthSource.WEIBO)
|
||||
.source(source)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回获取userInfo的url
|
||||
*
|
||||
* @param authToken
|
||||
* @param authToken authToken
|
||||
* @return 返回获取userInfo的url
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,9 @@ public class AuthChecker {
|
||||
if (isSupported && AuthSource.ALIPAY == source) {
|
||||
isSupported = StringUtils.isNotEmpty(config.getAlipayPublicKey());
|
||||
}
|
||||
if (isSupported && AuthSource.STACK_OVERFLOW == source) {
|
||||
isSupported = StringUtils.isNotEmpty(config.getStackOverflowKey());
|
||||
}
|
||||
return isSupported;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class GlobalAuthUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static String urlEncode(String value) {
|
||||
public static String urlEncode(String value) {
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.Map;
|
||||
* </p>
|
||||
*
|
||||
* @author yangkai.shen (https://xkcoding.com)
|
||||
* @date Created in 2019-07-18 15:47
|
||||
* @version 1.0
|
||||
* @since 1.8
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user