提交 64aa1940 编写于 作者: 智布道's avatar 智布道 👁

💡 优化注释

上级 56c1e4ea
......@@ -6,7 +6,6 @@ import lombok.*;
* JustAuth配置类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.9.3
* @since 1.8
*/
@Getter
......
......@@ -7,7 +7,6 @@ import me.zhyd.oauth.model.AuthResponseStatus;
* 各api需要的url, 用枚举类分平台类型管理
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.0
*/
public enum AuthSource {
......
......@@ -7,7 +7,6 @@ import lombok.Getter;
* 今日头条授权登录时的异常状态码
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
......
......@@ -9,7 +9,6 @@ import java.util.Arrays;
* 用户性别
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
......
......@@ -4,7 +4,6 @@ import me.zhyd.oauth.model.AuthResponseStatus;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthException extends RuntimeException {
......
......@@ -7,7 +7,6 @@ import lombok.Setter;
* 授权回调时的参数类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
......
......@@ -8,7 +8,6 @@ import lombok.Setter;
* JustAuth统一授权响应类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
......
......@@ -5,7 +5,6 @@ import lombok.Getter;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
......
......@@ -9,7 +9,6 @@ import lombok.Setter;
* 授权所需的token
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
......
......@@ -10,7 +10,6 @@ import me.zhyd.oauth.enums.AuthUserGender;
* 授权成功后的用户信息,根据授权平台的不同,获取的数据完整性也不同
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
......
......@@ -21,7 +21,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 支付宝登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthAlipayRequest extends AuthDefaultRequest {
......@@ -90,6 +89,7 @@ public class AuthAlipayRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -15,7 +15,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 百度账号登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthBaiduRequest extends AuthDefaultRequest {
......@@ -83,6 +82,7 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -15,7 +15,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* Cooding登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthCodingRequest extends AuthDefaultRequest {
......@@ -75,6 +74,7 @@ public class AuthCodingRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -14,7 +14,6 @@ import me.zhyd.oauth.model.AuthUser;
* CSDN登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Deprecated
......
......@@ -16,7 +16,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @author yangkai.shen (https://xkcoding.com)
* @version 1.0
* @since 1.8
*/
@Slf4j
......@@ -67,6 +66,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
* 建议使用{@link AuthDefaultRequest#authorize(String)}方法生成授权地址,在回调方法中对{@code state}进行校验
*
* @return 返回授权地址
* @see AuthDefaultRequest#authorize(String)
*/
@Deprecated
@Override
......@@ -79,6 +79,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......@@ -178,6 +179,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
* @param authToken token封装
* @return HttpResponse
*/
@Deprecated
protected HttpResponse doPostUserInfo(AuthToken authToken) {
return HttpRequest.post(userInfoUrl(authToken)).execute();
}
......@@ -197,7 +199,9 @@ public abstract class AuthDefaultRequest implements AuthRequest {
*
* @param authToken token封装
* @return HttpResponse
* @since
*/
@Deprecated
protected HttpResponse doPostRevoke(AuthToken authToken) {
return HttpRequest.post(revokeUrl(authToken)).execute();
}
......
......@@ -18,7 +18,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 钉钉登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthDingTalkRequest extends AuthDefaultRequest {
......@@ -62,6 +61,7 @@ public class AuthDingTalkRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -15,7 +15,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 抖音登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthDouyinRequest extends AuthDefaultRequest {
......@@ -93,6 +92,7 @@ public class AuthDouyinRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -15,7 +15,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* Facebook登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthFacebookRequest extends AuthDefaultRequest {
......
......@@ -14,7 +14,6 @@ import me.zhyd.oauth.model.AuthUser;
* Gitee登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthGiteeRequest extends AuthDefaultRequest {
......
......@@ -17,7 +17,6 @@ import java.util.Map;
* Github登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthGithubRequest extends AuthDefaultRequest {
......
......@@ -16,7 +16,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* Google登录
*
* @author yangkai.shen (https://xkcoding.com)
* @version 1.3
* @since 1.3
*/
public class AuthGoogleRequest extends AuthDefaultRequest {
......@@ -65,6 +64,7 @@ public class AuthGoogleRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -18,7 +18,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 领英登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthLinkedinRequest extends AuthDefaultRequest {
......@@ -186,6 +185,7 @@ public class AuthLinkedinRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -18,7 +18,6 @@ import java.text.MessageFormat;
* 小米登录
*
* @author yangkai.shen (https://xkcoding.com)
* @version 1.5
* @since 1.5
*/
@Slf4j
......@@ -113,6 +112,7 @@ public class AuthMiRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -16,7 +16,6 @@ import static me.zhyd.oauth.utils.GlobalAuthUtil.parseQueryToMap;
* 微软登录
*
* @author yangkai.shen (https://xkcoding.com)
* @version 1.5
* @since 1.5
*/
public class AuthMicrosoftRequest extends AuthDefaultRequest {
......@@ -106,6 +105,7 @@ public class AuthMicrosoftRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -15,7 +15,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* oschina登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthOschinaRequest extends AuthDefaultRequest {
......
......@@ -19,7 +19,6 @@ import static me.zhyd.oauth.config.AuthSource.PINTEREST;
* Pinterest登录
*
* @author hongwei.peng (pengisgood(at)gmail(dot)com)
* @version 1.9.0
* @since 1.8
*/
public class AuthPinterestRequest extends AuthDefaultRequest {
......@@ -74,6 +73,7 @@ public class AuthPinterestRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -20,7 +20,6 @@ import java.util.Map;
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @author yangkai.shen (https://xkcoding.com)
* @version 1.0
* @since 1.8
*/
public class AuthQqRequest extends AuthDefaultRequest {
......
......@@ -19,7 +19,6 @@ import static me.zhyd.oauth.model.AuthResponseStatus.SUCCESS;
* 人人登录
*
* @author hongwei.peng (pengisgood(at)gmail(dot)com)
* @version 1.9.0
* @since 1.8
*/
public class AuthRenrenRequest extends AuthDefaultRequest {
......
......@@ -8,7 +8,6 @@ import me.zhyd.oauth.model.AuthToken;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public interface AuthRequest {
......
......@@ -18,7 +18,6 @@ import static me.zhyd.oauth.utils.GlobalAuthUtil.parseQueryToMap;
* Stack Overflow登录
*
* @author hongwei.peng (pengisgood(at)gmail(dot)com)
* @version 1.9.0
* @since 1.8
*/
public class AuthStackOverflowRequest extends AuthDefaultRequest {
......@@ -72,6 +71,7 @@ public class AuthStackOverflowRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -16,7 +16,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 淘宝登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthTaobaoRequest extends AuthDefaultRequest {
......@@ -59,6 +58,7 @@ public class AuthTaobaoRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -13,7 +13,6 @@ import me.zhyd.oauth.model.*;
* Teambition授权登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthTeambitionRequest extends AuthDefaultRequest {
......
......@@ -15,7 +15,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 腾讯云登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthTencentCloudRequest extends AuthDefaultRequest {
......@@ -75,6 +74,7 @@ public class AuthTencentCloudRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -16,7 +16,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 今日头条登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.5
* @since 1.5
*/
public class AuthToutiaoRequest extends AuthDefaultRequest {
......@@ -69,6 +68,7 @@ public class AuthToutiaoRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -14,7 +14,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 微信登录
*
* @author yangkai.shen (https://xkcoding.com)
* @version 1.0
* @since 1.8
*/
public class AuthWeChatRequest extends AuthDefaultRequest {
......@@ -104,6 +103,7 @@ public class AuthWeChatRequest extends AuthDefaultRequest {
*
* @param state state 验证授权流程的参数,可以防止csrf
* @return 返回授权地址
* @since 1.9.3
*/
@Override
public String authorize(String state) {
......
......@@ -19,7 +19,6 @@ import me.zhyd.oauth.utils.UrlBuilder;
* 微博登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthWeiboRequest extends AuthDefaultRequest {
......@@ -51,7 +50,7 @@ public class AuthWeiboRequest extends AuthDefaultRequest {
String oauthParam = String.format("uid=%s&access_token=%s", uid, accessToken);
HttpResponse response = HttpRequest.get(userInfoUrl(authToken))
.header("Authorization", "OAuth2 " + oauthParam)
.header("API-RemoteIP", IpUtils.getIp())
.header("API-RemoteIP", IpUtils.getLocalIp())
.execute();
String userInfo = response.body();
JSONObject object = JSONObject.parseObject(userInfo);
......
......@@ -9,7 +9,6 @@ import me.zhyd.oauth.model.AuthResponseStatus;
* 授权配置类的校验器
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthChecker {
......
......@@ -21,7 +21,6 @@ import java.util.*;
* 全局的工具类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class GlobalAuthUtil {
......
......@@ -7,7 +7,6 @@ import java.net.UnknownHostException;
* 获取IP的工具类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.0
*/
public class IpUtils {
......@@ -17,7 +16,7 @@ public class IpUtils {
*
* @return ip
*/
public static String getIp() {
public static String getLocalIp() {
try {
return InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
......@@ -25,4 +24,4 @@ public class IpUtils {
return null;
}
}
}
\ No newline at end of file
}
......@@ -14,7 +14,6 @@ import java.util.Map;
* </p>
*
* @author yangkai.shen (https://xkcoding.com)
* @version 1.0
* @since 1.8
*/
@Setter
......
......@@ -8,7 +8,6 @@ import org.junit.Test;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public class AuthRequestTest {
......
......@@ -13,9 +13,6 @@ import java.util.Map;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @date 2019/7/19 15:52
* @since 1.8
*/
public class CustomTest {
......
### 2019/07/27
1. `IpUtils.getIp`改名为`IpUtils.getLocalIp`
2. 规范注释
### 2019/07/25
1. `AuthConfig`类中去掉state参数
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册