👌 修改获取accessToken时的返回值为实体类,方便扩展
This commit is contained in:
@@ -6,8 +6,8 @@ import cn.hutool.json.JSONObject;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.exception.AuthException;
|
||||
import me.zhyd.oauth.model.AuthDingTalkErrorCode;
|
||||
import me.zhyd.oauth.model.AuthResponse;
|
||||
import me.zhyd.oauth.model.AuthSource;
|
||||
import me.zhyd.oauth.model.AuthToken;
|
||||
import me.zhyd.oauth.model.AuthUser;
|
||||
import me.zhyd.oauth.utils.GlobalAuthUtil;
|
||||
import me.zhyd.oauth.utils.UrlBuilder;
|
||||
@@ -28,12 +28,15 @@ public class AuthDingTalkRequest extends BaseAuthRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAccessToken(String code) {
|
||||
throw new AuthException(ResponseStatus.NOT_IMPLEMENTED);
|
||||
protected AuthToken getAccessToken(String code) {
|
||||
return AuthToken.builder()
|
||||
.accessCode(code)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AuthUser getUserInfo(String code) {
|
||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
||||
String code = authToken.getAccessCode();
|
||||
// 根据timestamp, appSecret计算签名值
|
||||
String stringToSign = System.currentTimeMillis() + "";
|
||||
String urlEncodeSignature = GlobalAuthUtil.generateDingTalkSignature(config.getClientSecret(), stringToSign);
|
||||
@@ -52,11 +55,4 @@ public class AuthDingTalkRequest extends BaseAuthRequest {
|
||||
.source(AuthSource.DINGTALK)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthResponse login(String code) {
|
||||
return AuthResponse.builder()
|
||||
.data(this.getUserInfo(code))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user