mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-26 05:38:20 +00:00
update 调整 代码顺序
This commit is contained in:
@@ -57,17 +57,6 @@ public class AuthTopIamRequest extends AuthDefaultRequest {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String doPostAuthorizationCode(String code) {
|
|
||||||
HttpRequest request = HttpRequest.post(source.accessToken())
|
|
||||||
.header("Authorization", "Basic " + Base64.encode("%s:%s".formatted(config.getClientId(), config.getClientSecret())))
|
|
||||||
.form("grant_type", "authorization_code")
|
|
||||||
.form("code", code)
|
|
||||||
.form("redirect_uri", config.getRedirectUri());
|
|
||||||
HttpResponse response = request.execute();
|
|
||||||
return response.body();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthUser getUserInfo(AuthToken authToken) {
|
public AuthUser getUserInfo(AuthToken authToken) {
|
||||||
String body = doGetUserInfo(authToken);
|
String body = doGetUserInfo(authToken);
|
||||||
@@ -84,6 +73,16 @@ public class AuthTopIamRequest extends AuthDefaultRequest {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String doPostAuthorizationCode(String code) {
|
||||||
|
HttpRequest request = HttpRequest.post(source.accessToken())
|
||||||
|
.header("Authorization", "Basic " + Base64.encode("%s:%s".formatted(config.getClientId(), config.getClientSecret())))
|
||||||
|
.form("grant_type", "authorization_code")
|
||||||
|
.form("code", code)
|
||||||
|
.form("redirect_uri", config.getRedirectUri());
|
||||||
|
HttpResponse response = request.execute();
|
||||||
|
return response.body();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String doGetUserInfo(AuthToken authToken) {
|
protected String doGetUserInfo(AuthToken authToken) {
|
||||||
@@ -100,7 +99,7 @@ public class AuthTopIamRequest extends AuthDefaultRequest {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkResponse(Dict object) {
|
private static void checkResponse(Dict object) {
|
||||||
// oauth/token 验证异常
|
// oauth/token 验证异常
|
||||||
if (object.containsKey("error")) {
|
if (object.containsKey("error")) {
|
||||||
throw new AuthException(object.getStr("error_description"));
|
throw new AuthException(object.getStr("error_description"));
|
||||||
|
Reference in New Issue
Block a user