From 4a271c583e99d0ab1d4e9694dcf1380e543091c2 Mon Sep 17 00:00:00 2001 From: "yadong.zhang" Date: Thu, 23 May 2019 09:06:13 +0800 Subject: [PATCH] =?UTF-8?q?:bulb:=20=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../me/zhyd/oauth/model/AuthBaiduErrorCode.java | 2 ++ .../me/zhyd/oauth/model/AuthDingTalkErrorCode.java | 5 ++--- src/main/java/me/zhyd/oauth/model/AuthResponse.java | 13 +++++++++++++ src/main/java/me/zhyd/oauth/model/AuthSource.java | 3 --- src/main/java/me/zhyd/oauth/model/AuthToken.java | 2 ++ src/main/java/me/zhyd/oauth/model/AuthUser.java | 2 ++ .../java/me/zhyd/oauth/model/AuthUserGender.java | 2 ++ .../java/me/zhyd/oauth/utils/AuthConfigChecker.java | 2 ++ .../java/me/zhyd/oauth/utils/GlobalAuthUtil.java | 7 +++++++ 9 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/zhyd/oauth/model/AuthBaiduErrorCode.java b/src/main/java/me/zhyd/oauth/model/AuthBaiduErrorCode.java index 83bc5b9..ee22c26 100644 --- a/src/main/java/me/zhyd/oauth/model/AuthBaiduErrorCode.java +++ b/src/main/java/me/zhyd/oauth/model/AuthBaiduErrorCode.java @@ -3,6 +3,8 @@ package me.zhyd.oauth.model; import me.zhyd.oauth.utils.StringUtils; /** + * 百度授权登录时的异常状态码 + * * @author yadong.zhang (yadong.zhang0415(a)gmail.com) * @version 1.0 * @since 1.8 diff --git a/src/main/java/me/zhyd/oauth/model/AuthDingTalkErrorCode.java b/src/main/java/me/zhyd/oauth/model/AuthDingTalkErrorCode.java index 4a5befc..ce8f9da 100644 --- a/src/main/java/me/zhyd/oauth/model/AuthDingTalkErrorCode.java +++ b/src/main/java/me/zhyd/oauth/model/AuthDingTalkErrorCode.java @@ -1,14 +1,13 @@ package me.zhyd.oauth.model; /** + * 钉钉授权登录时的异常状态码 + * * @author yadong.zhang (yadong.zhang0415(a)gmail.com) * @version 1.0 * @since 1.8 */ public enum AuthDingTalkErrorCode { - /** - * 异常状态码 - */ EC1_MINUS(-1, "系统繁忙", "服务器暂不可用,建议稍候再重试1次,最多重试3次"), EC0(0, "请求成功", "接口调用成功"), EC404(404, "请求的URI地址不存在", "地址不存在,检查下url是否和文档里写的一致"), diff --git a/src/main/java/me/zhyd/oauth/model/AuthResponse.java b/src/main/java/me/zhyd/oauth/model/AuthResponse.java index 97539ea..c8f1f0e 100644 --- a/src/main/java/me/zhyd/oauth/model/AuthResponse.java +++ b/src/main/java/me/zhyd/oauth/model/AuthResponse.java @@ -5,6 +5,8 @@ import lombok.Data; import me.zhyd.oauth.request.ResponseStatus; /** + * JustAuth统一授权响应类 + * * @author yadong.zhang (yadong.zhang0415(a)gmail.com) * @version 1.0 * @since 1.8 @@ -12,7 +14,18 @@ import me.zhyd.oauth.request.ResponseStatus; @Builder @Data public class AuthResponse { + /** + * 授权响应状态码,默认为2000 + */ private int code = ResponseStatus.SUCCESS.getCode(); + + /** + * 授权响应信息,默认为Success + */ private String msg = ResponseStatus.SUCCESS.getMsg(); + + /** + * 授权响应数据,当且仅当 code = 2000 时返回 + */ private T data; } diff --git a/src/main/java/me/zhyd/oauth/model/AuthSource.java b/src/main/java/me/zhyd/oauth/model/AuthSource.java index 04cb751..f53704a 100644 --- a/src/main/java/me/zhyd/oauth/model/AuthSource.java +++ b/src/main/java/me/zhyd/oauth/model/AuthSource.java @@ -21,9 +21,6 @@ public enum AuthSource { TAOBAO, QQ, WECHAT, - /** - * 谷歌登录,参考文档:https://developers.google.com/identity/protocols/OpenIDConnect - */ GOOGLE, FACEBOOK, } diff --git a/src/main/java/me/zhyd/oauth/model/AuthToken.java b/src/main/java/me/zhyd/oauth/model/AuthToken.java index ebadf0c..56ecb20 100644 --- a/src/main/java/me/zhyd/oauth/model/AuthToken.java +++ b/src/main/java/me/zhyd/oauth/model/AuthToken.java @@ -4,6 +4,8 @@ import lombok.Builder; import lombok.Data; /** + * 授权所需的token + * * @author yadong.zhang (yadong.zhang0415(a)gmail.com) * @version 1.0 * @since 1.8 diff --git a/src/main/java/me/zhyd/oauth/model/AuthUser.java b/src/main/java/me/zhyd/oauth/model/AuthUser.java index 82d15c5..43d3714 100644 --- a/src/main/java/me/zhyd/oauth/model/AuthUser.java +++ b/src/main/java/me/zhyd/oauth/model/AuthUser.java @@ -4,6 +4,8 @@ import lombok.Builder; import lombok.Data; /** + * 授权成功后的用户信息,根据授权平台的不同,获取的数据完整性也不同 + * * @author yadong.zhang (yadong.zhang0415(a)gmail.com) * @version 1.0 * @since 1.8 diff --git a/src/main/java/me/zhyd/oauth/model/AuthUserGender.java b/src/main/java/me/zhyd/oauth/model/AuthUserGender.java index be3a988..b5dbd05 100644 --- a/src/main/java/me/zhyd/oauth/model/AuthUserGender.java +++ b/src/main/java/me/zhyd/oauth/model/AuthUserGender.java @@ -3,6 +3,8 @@ package me.zhyd.oauth.model; import java.util.Arrays; /** + * 用户性别 + * * @author yadong.zhang (yadong.zhang0415(a)gmail.com) * @version 1.0 * @since 1.8 diff --git a/src/main/java/me/zhyd/oauth/utils/AuthConfigChecker.java b/src/main/java/me/zhyd/oauth/utils/AuthConfigChecker.java index 8ef644c..ca58d14 100644 --- a/src/main/java/me/zhyd/oauth/utils/AuthConfigChecker.java +++ b/src/main/java/me/zhyd/oauth/utils/AuthConfigChecker.java @@ -3,6 +3,8 @@ package me.zhyd.oauth.utils; import me.zhyd.oauth.config.AuthConfig; /** + * 授权配置类的校验器 + * * @author yadong.zhang (yadong.zhang0415(a)gmail.com) * @version 1.0 * @since 1.8 diff --git a/src/main/java/me/zhyd/oauth/utils/GlobalAuthUtil.java b/src/main/java/me/zhyd/oauth/utils/GlobalAuthUtil.java index dc12a65..5bf022e 100644 --- a/src/main/java/me/zhyd/oauth/utils/GlobalAuthUtil.java +++ b/src/main/java/me/zhyd/oauth/utils/GlobalAuthUtil.java @@ -14,6 +14,13 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; +/** + * 全局的工具类 + * + * @author yadong.zhang (yadong.zhang0415(a)gmail.com) + * @version 1.0 + * @since 1.8 + */ public class GlobalAuthUtil { private static final String DEFAULT_ENCODING = "UTF-8"; private static final String ALGORITHM = "HmacSHA256"; -- GitLab