1
0
mirror of synced 2026-04-26 03:28:45 +08:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
yadong.zhang
2019-06-25 19:33:27 +08:00
8 changed files with 23 additions and 23 deletions

View File

@@ -29,7 +29,7 @@ public class AuthBaiduRequest extends BaseAuthRequest {
HttpResponse response = HttpRequest.post(accessTokenUrl).execute();
JSONObject accessTokenObject = JSONObject.parseObject(response.body());
AuthBaiduErrorCode errorCode = AuthBaiduErrorCode.getErrorCode(accessTokenObject.getString("error"));
if (!AuthBaiduErrorCode.OK.equals(errorCode)) {
if (AuthBaiduErrorCode.OK != errorCode) {
throw new AuthException(errorCode.getDesc());
}
return AuthToken.builder().accessToken(accessTokenObject.getString("access_token")).build();
@@ -42,7 +42,7 @@ public class AuthBaiduRequest extends BaseAuthRequest {
String userInfo = response.body();
JSONObject object = JSONObject.parseObject(userInfo);
AuthBaiduErrorCode errorCode = AuthBaiduErrorCode.getErrorCode(object.getString("error"));
if (!AuthBaiduErrorCode.OK.equals(errorCode)) {
if (AuthBaiduErrorCode.OK != errorCode) {
throw new AuthException(errorCode.getDesc());
}
return AuthUser.builder()

View File

@@ -40,13 +40,12 @@ public class AuthDingTalkRequest extends BaseAuthRequest {
String urlEncodeSignature = GlobalAuthUtil.generateDingTalkSignature(config.getClientSecret(), timestamp);
JSONObject param = new JSONObject();
param.put("tmp_auth_code", code);
HttpResponse response = HttpRequest.post(UrlBuilder.getDingTalkUserInfoUrl(urlEncodeSignature, timestamp, config.getClientId()))
.body(param.toJSONString())
.execute();
HttpResponse response = HttpRequest.post(UrlBuilder.getDingTalkUserInfoUrl(urlEncodeSignature, timestamp, config
.getClientId())).body(param.toJSONString()).execute();
String userInfo = response.body();
JSONObject object = JSON.parseObject(userInfo);
AuthDingTalkErrorCode errorCode = AuthDingTalkErrorCode.getErrorCode(object.getIntValue("errcode"));
if (!AuthDingTalkErrorCode.EC0.equals(errorCode)) {
if (AuthDingTalkErrorCode.EC0 != errorCode) {
throw new AuthException(errorCode.getDesc());
}
object = object.getJSONObject("user_info");

View File

@@ -63,7 +63,7 @@ public class AuthMiRequest extends BaseAuthRequest {
.execute();
JSONObject userProfile = JSONObject.parseObject(userResponse.body());
if (StrUtil.equalsIgnoreCase(userProfile.getString("result"), "error")) {
if ("error".equalsIgnoreCase(userProfile.getString("result"))) {
throw new AuthException(userProfile.getString("description"));
}
@@ -86,7 +86,7 @@ public class AuthMiRequest extends BaseAuthRequest {
HttpResponse emailResponse = HttpRequest.get(emailPhoneUrl).execute();
JSONObject userEmailPhone = JSONObject.parseObject(emailResponse.body());
if (!StrUtil.equalsIgnoreCase(userEmailPhone.getString("result"), "error")) {
if (!"error".equalsIgnoreCase(userEmailPhone.getString("result"))) {
JSONObject emailPhone = userEmailPhone.getJSONObject("data");
authUser.setEmail(emailPhone.getString("email"));
}

View File

@@ -40,7 +40,8 @@ public class AuthWeiboRequest extends BaseAuthRequest {
return AuthToken.builder()
.accessToken(accessTokenObject.getString("access_token"))
.uid(accessTokenObject.getString("uid"))
.expireIn(accessTokenObject.getIntValue("remind_in"))
.openId(accessTokenObject.getString("uid"))
.expireIn(accessTokenObject.getIntValue("expires_in"))
.build();
}