Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Yanxianyang
JustAuth
提交
65334d0f
J
JustAuth
项目概览
Yanxianyang
/
JustAuth
与 Fork 源项目一致
Fork自
justauth / JustAuth
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
JustAuth
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
65334d0f
编写于
7月 16, 2019
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
♻
优化代码
上级
67c668b7
变更
46
显示空白变更内容
内联
并排
Showing
46 changed file
with
186 addition
and
422 deletion
+186
-422
README.md
README.md
+3
-1
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
+2
-9
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java
src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
+2
-10
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
+2
-10
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
+2
-10
src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
...main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
+2
-10
src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java
src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java
src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthTencentCloudRequest.java
...n/java/me/zhyd/oauth/request/AuthTencentCloudRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
+2
-10
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
+1
-5
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
+2
-4
src/main/java/me/zhyd/oauth/url/AbstractUrlBuilder.java
src/main/java/me/zhyd/oauth/url/AbstractUrlBuilder.java
+23
-14
src/main/java/me/zhyd/oauth/url/AlipayUrlBuilder.java
src/main/java/me/zhyd/oauth/url/AlipayUrlBuilder.java
+5
-7
src/main/java/me/zhyd/oauth/url/BaiduUrlBuilder.java
src/main/java/me/zhyd/oauth/url/BaiduUrlBuilder.java
+7
-10
src/main/java/me/zhyd/oauth/url/CodingUrlBuilder.java
src/main/java/me/zhyd/oauth/url/CodingUrlBuilder.java
+7
-12
src/main/java/me/zhyd/oauth/url/CsdnUrlBuilder.java
src/main/java/me/zhyd/oauth/url/CsdnUrlBuilder.java
+6
-9
src/main/java/me/zhyd/oauth/url/DingtalkUrlBuilder.java
src/main/java/me/zhyd/oauth/url/DingtalkUrlBuilder.java
+5
-7
src/main/java/me/zhyd/oauth/url/DouyinUrlBuilder.java
src/main/java/me/zhyd/oauth/url/DouyinUrlBuilder.java
+7
-11
src/main/java/me/zhyd/oauth/url/FacebookUrlBuilder.java
src/main/java/me/zhyd/oauth/url/FacebookUrlBuilder.java
+6
-9
src/main/java/me/zhyd/oauth/url/GiteeUrlBuilder.java
src/main/java/me/zhyd/oauth/url/GiteeUrlBuilder.java
+5
-8
src/main/java/me/zhyd/oauth/url/GithubUrlBuilder.java
src/main/java/me/zhyd/oauth/url/GithubUrlBuilder.java
+6
-9
src/main/java/me/zhyd/oauth/url/GoogleUrlBuilder.java
src/main/java/me/zhyd/oauth/url/GoogleUrlBuilder.java
+6
-9
src/main/java/me/zhyd/oauth/url/LinkedinUrlBuilder.java
src/main/java/me/zhyd/oauth/url/LinkedinUrlBuilder.java
+7
-11
src/main/java/me/zhyd/oauth/url/MiUrlBuilder.java
src/main/java/me/zhyd/oauth/url/MiUrlBuilder.java
+7
-11
src/main/java/me/zhyd/oauth/url/MicrosoftUrlBuilder.java
src/main/java/me/zhyd/oauth/url/MicrosoftUrlBuilder.java
+7
-11
src/main/java/me/zhyd/oauth/url/OschinaUrlBuilder.java
src/main/java/me/zhyd/oauth/url/OschinaUrlBuilder.java
+7
-12
src/main/java/me/zhyd/oauth/url/QqUrlBuilder.java
src/main/java/me/zhyd/oauth/url/QqUrlBuilder.java
+7
-12
src/main/java/me/zhyd/oauth/url/TaobaoUrlBuilder.java
src/main/java/me/zhyd/oauth/url/TaobaoUrlBuilder.java
+7
-12
src/main/java/me/zhyd/oauth/url/TencentCloudUrlBuilder.java
src/main/java/me/zhyd/oauth/url/TencentCloudUrlBuilder.java
+7
-12
src/main/java/me/zhyd/oauth/url/ToutiaoUrlBuilder.java
src/main/java/me/zhyd/oauth/url/ToutiaoUrlBuilder.java
+7
-12
src/main/java/me/zhyd/oauth/url/WechatUrlBuilder.java
src/main/java/me/zhyd/oauth/url/WechatUrlBuilder.java
+7
-10
src/main/java/me/zhyd/oauth/url/WeiboUrlBuilder.java
src/main/java/me/zhyd/oauth/url/WeiboUrlBuilder.java
+7
-12
src/main/java/me/zhyd/oauth/url/entity/AuthAccessTokenEntity.java
.../java/me/zhyd/oauth/url/entity/AuthAccessTokenEntity.java
+0
-25
src/main/java/me/zhyd/oauth/url/entity/AuthAuthorizeEntity.java
...in/java/me/zhyd/oauth/url/entity/AuthAuthorizeEntity.java
+0
-20
src/main/java/me/zhyd/oauth/url/entity/AuthRefreshTokenEntity.java
...java/me/zhyd/oauth/url/entity/AuthRefreshTokenEntity.java
+0
-18
src/main/java/me/zhyd/oauth/url/entity/AuthRevokeEntity.java
src/main/java/me/zhyd/oauth/url/entity/AuthRevokeEntity.java
+0
-15
update.md
update.md
+4
-0
未找到文件。
README.md
浏览文件 @
65334d0f
...
...
@@ -88,7 +88,9 @@ authRequest.login(callback);
注:
`1.8.0`
版本后,增加了
`state`
参数校验,用于防止
[
CSRF
](
https://zh.wikipedia.org/wiki/%E8%B7%A8%E7%AB%99%E8%AF%B7%E6%B1%82%E4%BC%AA%E9%80%A0
)
。强烈建议,保证单次流程内
`state`
的唯一性,且每个
`state`
只可用一次。
**配套Demo**
:
[
JustAuth-demo
](
https://gitee.com/yadong.zhang/JustAuth-demo
)
**配套Demo**
:
-
[
Springboot版
](
https://gitee.com/yadong.zhang/JustAuth-demo
)
-
[
jFinal版
](
https://github.com/zhangyd-c/jfinal-justauth-demo
)
具体的例子可以参考:
...
...
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
浏览文件 @
65334d0f
...
...
@@ -9,8 +9,6 @@ import me.zhyd.oauth.enums.AuthBaiduErrorCode;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.url.BaiduUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthRevokeEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -28,10 +26,7 @@ public class AuthBaiduRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
AuthBaiduErrorCode
errorCode
=
AuthBaiduErrorCode
.
getErrorCode
(
accessTokenObject
.
getString
(
"error"
));
...
...
@@ -71,9 +66,7 @@ public class AuthBaiduRequest extends BaseAuthRequest {
@Override
public
AuthResponse
revoke
(
AuthToken
authToken
)
{
String
accessToken
=
authToken
.
getAccessToken
();
HttpResponse
response
=
HttpRequest
.
get
(
this
.
urlBuilder
.
getRevokeUrl
(
AuthRevokeEntity
.
builder
()
.
accessToken
(
accessToken
)
.
build
())).
execute
();
HttpResponse
response
=
HttpRequest
.
get
(
this
.
urlBuilder
.
getRevokeUrl
(
accessToken
)).
execute
();
String
userInfo
=
response
.
body
();
JSONObject
object
=
JSONObject
.
parseObject
(
userInfo
);
if
(
object
.
containsKey
(
"error_code"
))
{
...
...
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.CodingUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -29,10 +28,7 @@ public class AuthCodingRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
get
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
if
(
accessTokenObject
.
getIntValue
(
"code"
)
!=
0
)
{
...
...
src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.CsdnUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -30,10 +29,7 @@ public class AuthCsdnRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
if
(
accessTokenObject
.
containsKey
(
"error_code"
))
{
...
...
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
浏览文件 @
65334d0f
...
...
@@ -8,8 +8,6 @@ import me.zhyd.oauth.config.AuthSource;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.url.DouyinUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthRefreshTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
...
...
@@ -28,10 +26,7 @@ public class AuthDouyinRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
return
this
.
getToken
(
accessTokenUrl
);
}
...
...
@@ -62,10 +57,7 @@ public class AuthDouyinRequest extends BaseAuthRequest {
@Override
public
AuthResponse
refresh
(
AuthToken
oldToken
)
{
String
refreshTokenUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
AuthRefreshTokenEntity
.
builder
()
.
config
(
config
)
.
refreshToken
(
oldToken
.
getRefreshToken
())
.
build
());
String
refreshTokenUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
oldToken
.
getRefreshToken
());
return
AuthResponse
.
builder
()
.
code
(
ResponseStatus
.
SUCCESS
.
getCode
())
.
data
(
this
.
getToken
(
refreshTokenUrl
))
...
...
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.FacebookUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -29,10 +28,7 @@ public class AuthFacebookRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
...
...
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.GiteeUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -29,10 +28,7 @@ public class AuthGiteeRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
if
(
accessTokenObject
.
containsKey
(
"error"
))
{
...
...
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.GithubUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
import
me.zhyd.oauth.utils.GlobalAuthUtil
;
...
...
@@ -32,10 +31,7 @@ public class AuthGithubRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
Map
<
String
,
String
>
res
=
GlobalAuthUtil
.
parseStringToMap
(
response
.
body
());
if
(
res
.
containsKey
(
"error"
))
{
...
...
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.GoogleUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -29,10 +28,7 @@ public class AuthGoogleRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
...
...
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
浏览文件 @
65334d0f
...
...
@@ -9,8 +9,6 @@ import me.zhyd.oauth.config.AuthSource;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.url.LinkedinUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthRefreshTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
import
me.zhyd.oauth.utils.StringUtils
;
...
...
@@ -30,10 +28,7 @@ public class AuthLinkedinRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
return
this
.
getToken
(
accessTokenUrl
);
}
...
...
@@ -123,10 +118,7 @@ public class AuthLinkedinRequest extends BaseAuthRequest {
if
(
StringUtils
.
isEmpty
(
oldToken
.
getRefreshToken
()))
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
String
refreshTokenUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
AuthRefreshTokenEntity
.
builder
()
.
config
(
config
)
.
refreshToken
(
oldToken
.
getRefreshToken
())
.
build
());
String
refreshTokenUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
oldToken
.
getRefreshToken
());
return
AuthResponse
.
builder
()
.
code
(
ResponseStatus
.
SUCCESS
.
getCode
())
.
data
(
this
.
getToken
(
refreshTokenUrl
))
...
...
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
浏览文件 @
65334d0f
...
...
@@ -9,8 +9,6 @@ import me.zhyd.oauth.config.AuthSource;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.url.MiUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthRefreshTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -31,10 +29,7 @@ public class AuthMiRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
return
getToken
(
accessTokenUrl
);
}
...
...
@@ -108,10 +103,7 @@ public class AuthMiRequest extends BaseAuthRequest {
*/
@Override
public
AuthResponse
refresh
(
AuthToken
authToken
)
{
String
miRefreshUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
AuthRefreshTokenEntity
.
builder
()
.
config
(
config
)
.
refreshToken
(
authToken
.
getRefreshToken
())
.
build
());
String
miRefreshUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
authToken
.
getRefreshToken
());
return
AuthResponse
.
builder
().
code
(
ResponseStatus
.
SUCCESS
.
getCode
()).
data
(
getToken
(
miRefreshUrl
)).
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
浏览文件 @
65334d0f
...
...
@@ -9,8 +9,6 @@ import me.zhyd.oauth.config.AuthSource;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.url.MicrosoftUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthRefreshTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
import
java.util.HashMap
;
...
...
@@ -30,10 +28,7 @@ public class AuthMicrosoftRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
return
getToken
(
accessTokenUrl
);
}
...
...
@@ -102,10 +97,7 @@ public class AuthMicrosoftRequest extends BaseAuthRequest {
*/
@Override
public
AuthResponse
refresh
(
AuthToken
authToken
)
{
String
refreshTokenUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
AuthRefreshTokenEntity
.
builder
()
.
config
(
config
)
.
refreshToken
(
authToken
.
getRefreshToken
())
.
build
());
String
refreshTokenUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
authToken
.
getRefreshToken
());
return
AuthResponse
.
builder
().
code
(
ResponseStatus
.
SUCCESS
.
getCode
()).
data
(
getToken
(
refreshTokenUrl
)).
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.OschinaUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -29,10 +28,7 @@ public class AuthOschinaRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
if
(
accessTokenObject
.
containsKey
(
"error"
))
{
...
...
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
浏览文件 @
65334d0f
...
...
@@ -12,7 +12,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.QqUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
import
me.zhyd.oauth.utils.GlobalAuthUtil
;
import
me.zhyd.oauth.utils.StringUtils
;
...
...
@@ -34,10 +33,7 @@ public class AuthQqRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
get
(
accessTokenUrl
).
execute
();
Map
<
String
,
String
>
accessTokenObject
=
GlobalAuthUtil
.
parseStringToMap
(
response
.
body
());
if
(!
accessTokenObject
.
containsKey
(
"access_token"
))
{
...
...
src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.TaobaoUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.utils.GlobalAuthUtil
;
/**
...
...
@@ -35,10 +34,7 @@ public class AuthTaobaoRequest extends BaseAuthRequest {
@Override
protected
AuthUser
getUserInfo
(
AuthToken
authToken
)
{
String
accessCode
=
authToken
.
getAccessCode
();
HttpResponse
response
=
HttpRequest
.
post
(
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
accessCode
)
.
build
())).
execute
();
HttpResponse
response
=
HttpRequest
.
post
(
this
.
urlBuilder
.
getAccessTokenUrl
(
accessCode
)).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
if
(
accessTokenObject
.
containsKey
(
"error"
))
{
throw
new
AuthException
(
ResponseStatus
.
FAILURE
+
":"
+
accessTokenObject
.
getString
(
"error_description"
));
...
...
src/main/java/me/zhyd/oauth/request/AuthTencentCloudRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.TencentCloudUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -29,10 +28,7 @@ public class AuthTencentCloudRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
get
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
if
(
accessTokenObject
.
getIntValue
(
"code"
)
!=
0
)
{
...
...
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
浏览文件 @
65334d0f
...
...
@@ -12,7 +12,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.ToutiaoUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -30,10 +29,7 @@ public class AuthToutiaoRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
get
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
...
...
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
浏览文件 @
65334d0f
...
...
@@ -8,8 +8,6 @@ import me.zhyd.oauth.config.AuthSource;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.url.WechatUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthRefreshTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
/**
...
...
@@ -32,10 +30,7 @@ public class AuthWeChatRequest extends BaseAuthRequest {
*/
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
return
this
.
getToken
(
accessTokenUrl
);
}
...
...
@@ -67,10 +62,7 @@ public class AuthWeChatRequest extends BaseAuthRequest {
@Override
public
AuthResponse
refresh
(
AuthToken
oldToken
)
{
String
refreshTokenUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
AuthRefreshTokenEntity
.
builder
()
.
config
(
config
)
.
refreshToken
(
oldToken
.
getRefreshToken
())
.
build
());
String
refreshTokenUrl
=
this
.
urlBuilder
.
getRefreshUrl
(
oldToken
.
getRefreshToken
());
return
AuthResponse
.
builder
()
.
code
(
ResponseStatus
.
SUCCESS
.
getCode
())
.
data
(
this
.
getToken
(
refreshTokenUrl
))
...
...
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
浏览文件 @
65334d0f
...
...
@@ -11,7 +11,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.model.AuthUserGender
;
import
me.zhyd.oauth.url.WeiboUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAccessTokenEntity
;
import
me.zhyd.oauth.url.entity.AuthUserInfoEntity
;
import
me.zhyd.oauth.utils.IpUtils
;
import
me.zhyd.oauth.utils.StringUtils
;
...
...
@@ -32,10 +31,7 @@ public class AuthWeiboRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
AuthAccessTokenEntity
.
builder
()
.
config
(
config
)
.
code
(
authCallback
.
getCode
())
.
build
());
String
accessTokenUrl
=
this
.
urlBuilder
.
getAccessTokenUrl
(
authCallback
.
getCode
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
String
accessTokenStr
=
response
.
body
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
accessTokenStr
);
...
...
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
浏览文件 @
65334d0f
...
...
@@ -9,7 +9,6 @@ import me.zhyd.oauth.model.AuthResponse;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.url.AbstractUrlBuilder
;
import
me.zhyd.oauth.url.entity.AuthAuthorizeEntity
;
import
me.zhyd.oauth.utils.AuthChecker
;
/**
...
...
@@ -36,6 +35,7 @@ public abstract class BaseAuthRequest implements AuthRequest {
public
BaseAuthRequest
(
AuthConfig
config
,
AuthSource
source
,
AbstractUrlBuilder
urlBuilder
)
{
this
(
config
,
source
);
this
.
urlBuilder
=
urlBuilder
;
this
.
urlBuilder
.
setAuthConfig
(
config
);
}
protected
abstract
AuthToken
getAccessToken
(
AuthCallback
authCallback
);
...
...
@@ -71,8 +71,6 @@ public abstract class BaseAuthRequest implements AuthRequest {
*/
@Override
public
String
authorize
()
{
return
this
.
urlBuilder
.
getAuthorizeUrl
(
AuthAuthorizeEntity
.
builder
()
.
config
(
config
)
.
build
());
return
this
.
urlBuilder
.
getAuthorizeUrl
();
}
}
src/main/java/me/zhyd/oauth/url/AbstractUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.request.ResponseStatus
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
me.zhyd.oauth.utils.StringUtils
;
/**
...
...
@@ -12,18 +13,20 @@ import me.zhyd.oauth.utils.StringUtils;
*/
public
abstract
class
AbstractUrlBuilder
{
protected
AuthConfig
config
;
/**
* 获取AccessToken的URL
*
* @param
accessTokenEntity
* @param
code 第三方平台返回的code
* @return AccessTokenUrl
*/
public
abstract
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
);
public
abstract
String
getAccessTokenUrl
(
String
code
);
/**
* 获取用户信息的URL
*
* @param userInfoEntity
* @param userInfoEntity
传递生成 UserInfoUrl 必须的参数
* @return UserInfoUrl
*/
public
abstract
String
getUserInfoUrl
(
AuthUserInfoEntity
userInfoEntity
);
...
...
@@ -31,33 +34,34 @@ public abstract class AbstractUrlBuilder {
/**
* 获取跳转授权页面的URL
*
* @param authorizeEntity
* @return AuthorizeUrl
*/
public
abstract
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
);
public
abstract
String
getAuthorizeUrl
();
/**
* 获取刷新token的URL
*
* @param refreshToken
Entity
* @param refreshToken
授权后取得的refresh token
* @return RefreshUrl
*/
public
abstract
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
);
public
abstract
String
getRefreshUrl
(
String
refreshToken
);
/**
* 获取取消授权的URL
*
* @param
revokeEntity
* @param
accessToken 授权后的token
* @return RevokeUrl
*/
public
abstract
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
);
public
abstract
String
getRevokeUrl
(
String
accessToken
);
/**
* 获取openId的地址,目前只有qq平台需要,故不需要子类强制重写
*
* @param accessToken
* @param unionid
* @return
* @param accessToken 用户授权后返回的accesstoken
* @param unionid 是否需要申请unionid,目前只针对qq登录
* 注:qq授权登录时,获取unionid需要单独发送邮件申请权限。如果个人开发者账号中申请了该权限,可以将该值置为true,在获取openId时就会同步获取unionId
* 参考链接:http://wiki.connect.qq.com/unionid%E4%BB%8B%E7%BB%8D
* @return openIdUrl
*/
public
String
getOpenIdUrl
(
String
accessToken
,
boolean
unionid
)
{
throw
new
AuthException
(
ResponseStatus
.
NOT_IMPLEMENTED
);
...
...
@@ -66,9 +70,14 @@ public abstract class AbstractUrlBuilder {
/**
* 获取state,如果为空, 则默认去当前日期的时间戳
*
* @param state state
* @param state 原始的state
* @return 返回不为null的state
*/
protected
String
getRealState
(
String
state
)
{
return
StringUtils
.
isEmpty
(
state
)
?
String
.
valueOf
(
System
.
currentTimeMillis
())
:
state
;
}
public
void
setAuthConfig
(
AuthConfig
config
)
{
this
.
config
=
config
;
}
}
src/main/java/me/zhyd/oauth/url/AlipayUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -18,7 +17,7 @@ public class AlipayUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
ALIPAY_AUTHORIZE_PATTERN
=
"{0}?app_id={1}&scope=auth_user&redirect_uri={2}&state={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
public
String
getAccessTokenUrl
(
String
code
)
{
return
null
;
}
...
...
@@ -28,18 +27,17 @@ public class AlipayUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
ALIPAY_AUTHORIZE_PATTERN
,
AuthSource
.
ALIPAY
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/BaiduUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -21,9 +20,8 @@ public class BaiduUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
BAIDU_REVOKE_PATTERN
=
"{0}?access_token={1}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
BAIDU_ACCESS_TOKEN_PATTERN
,
AuthSource
.
BAIDU
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
BAIDU_ACCESS_TOKEN_PATTERN
,
AuthSource
.
BAIDU
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -32,18 +30,17 @@ public class BaiduUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
BAIDU_AUTHORIZE_PATTERN
,
AuthSource
.
BAIDU
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
return
MessageFormat
.
format
(
BAIDU_REVOKE_PATTERN
,
AuthSource
.
BAIDU
.
revoke
(),
revokeEntity
.
getAccessToken
()
);
public
String
getRevokeUrl
(
String
accessToken
)
{
return
MessageFormat
.
format
(
BAIDU_REVOKE_PATTERN
,
AuthSource
.
BAIDU
.
revoke
(),
accessToken
);
}
}
src/main/java/me/zhyd/oauth/url/CodingUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -20,10 +19,8 @@ public class CodingUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
CODING_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&response_type=code&redirect_uri={2}&scope=user&state={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
CODING_ACCESS_TOKEN_PATTERN
,
AuthSource
.
CODING
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
CODING_ACCESS_TOKEN_PATTERN
,
AuthSource
.
CODING
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
);
}
@Override
...
...
@@ -32,19 +29,17 @@ public class CodingUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
return
MessageFormat
.
format
(
CODING_AUTHORIZE_PATTERN
,
AuthSource
.
CODING
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
CODING_AUTHORIZE_PATTERN
,
AuthSource
.
CODING
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/CsdnUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -21,9 +20,8 @@ public class CsdnUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
CSDN_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&response_type=code&redirect_uri={2}&state={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
CSDN_ACCESS_TOKEN_PATTERN
,
AuthSource
.
CSDN
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
CSDN_ACCESS_TOKEN_PATTERN
,
AuthSource
.
CSDN
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -32,18 +30,17 @@ public class CsdnUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
CSDN_AUTHORIZE_PATTERN
,
AuthSource
.
CSDN
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/DingtalkUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -19,7 +18,7 @@ public class DingtalkUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
DING_TALK_USER_INFO_PATTERN
=
"{0}?signature={1}×tamp={2}&accessKey={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
public
String
getAccessTokenUrl
(
String
code
)
{
return
null
;
}
...
...
@@ -29,18 +28,17 @@ public class DingtalkUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
DING_TALK_QRCONNECT_PATTERN
,
AuthSource
.
DINGTALK
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/DouyinUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -21,9 +20,8 @@ public class DouyinUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
DOUYIN_REFRESH_TOKEN_PATTERN
=
"{0}?client_key={1}&refresh_token={2}&grant_type=refresh_token"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
DOUYIN_ACCESS_TOKEN_PATTERN
,
AuthSource
.
DOUYIN
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
DOUYIN_ACCESS_TOKEN_PATTERN
,
AuthSource
.
DOUYIN
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
);
}
@Override
...
...
@@ -32,19 +30,17 @@ public class DouyinUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
DOUYIN_AUTHORIZE_PATTERN
,
AuthSource
.
DOUYIN
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
AuthConfig
config
=
refreshTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
DOUYIN_REFRESH_TOKEN_PATTERN
,
AuthSource
.
DOUYIN
.
refresh
(),
config
.
getClientId
(),
refreshTokenEntity
.
getRefreshToken
());
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
MessageFormat
.
format
(
DOUYIN_REFRESH_TOKEN_PATTERN
,
AuthSource
.
DOUYIN
.
refresh
(),
config
.
getClientId
(),
refreshToken
);
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/FacebookUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -20,9 +19,8 @@ public class FacebookUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
FACEBOOK_USER_INFO_PATTERN
=
"{0}?access_token={1}&fields=id,name,birthday,gender,hometown,email,devices,picture.width(400)"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
FACEBOOK_ACCESS_TOKEN_PATTERN
,
AuthSource
.
FACEBOOK
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
FACEBOOK_ACCESS_TOKEN_PATTERN
,
AuthSource
.
FACEBOOK
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -31,18 +29,17 @@ public class FacebookUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
FACEBOOK_AUTHORIZE_PATTERN
,
AuthSource
.
FACEBOOK
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/GiteeUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.*
;
...
...
@@ -20,9 +19,8 @@ public class GiteeUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
GITEE_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&response_type=code&redirect_uri={2}&state={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
GITEE_ACCESS_TOKEN_PATTERN
,
AuthSource
.
GITEE
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
GITEE_ACCESS_TOKEN_PATTERN
,
AuthSource
.
GITEE
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -31,18 +29,17 @@ public class GiteeUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
GITEE_AUTHORIZE_PATTERN
,
AuthSource
.
GITEE
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/GithubUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -20,9 +19,8 @@ public class GithubUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
GITHUB_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&redirect_uri={2}&state={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
GITHUB_ACCESS_TOKEN_PATTERN
,
AuthSource
.
GITHUB
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
GITHUB_ACCESS_TOKEN_PATTERN
,
AuthSource
.
GITHUB
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -31,18 +29,17 @@ public class GithubUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
GITHUB_AUTHORIZE_PATTERN
,
AuthSource
.
GITHUB
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/GoogleUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -20,9 +19,8 @@ public class GoogleUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
GOOGLE_USER_INFO_PATTERN
=
"{0}?id_token={1}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
GOOGLE_ACCESS_TOKEN_PATTERN
,
AuthSource
.
GOOGLE
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
GOOGLE_ACCESS_TOKEN_PATTERN
,
AuthSource
.
GOOGLE
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -31,18 +29,17 @@ public class GoogleUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
GOOGLE_AUTHORIZE_PATTERN
,
AuthSource
.
GOOGLE
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/LinkedinUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -21,9 +20,8 @@ public class LinkedinUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
LINKEDIN_REFRESH_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&refresh_token={3}&grant_type=refresh_token"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
LINKEDIN_ACCESS_TOKEN_PATTERN
,
AuthSource
.
LINKEDIN
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
LINKEDIN_ACCESS_TOKEN_PATTERN
,
AuthSource
.
LINKEDIN
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -32,19 +30,17 @@ public class LinkedinUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
LINKEDIN_AUTHORIZE_PATTERN
,
AuthSource
.
LINKEDIN
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
AuthConfig
config
=
refreshTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
LINKEDIN_REFRESH_TOKEN_PATTERN
,
AuthSource
.
LINKEDIN
.
refresh
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
refreshTokenEntity
.
getRefreshToken
());
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
MessageFormat
.
format
(
LINKEDIN_REFRESH_TOKEN_PATTERN
,
AuthSource
.
LINKEDIN
.
refresh
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
refreshToken
);
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/MiUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -21,9 +20,8 @@ public class MiUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
MI_REFRESH_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
MI_ACCESS_TOKEN_PATTERN
,
AuthSource
.
MI
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
config
.
getRedirectUri
(),
accessTokenEntity
.
getCode
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
MI_ACCESS_TOKEN_PATTERN
,
AuthSource
.
MI
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
config
.
getRedirectUri
(),
code
);
}
@Override
...
...
@@ -32,19 +30,17 @@ public class MiUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
MI_AUTHORIZE_PATTERN
,
AuthSource
.
MI
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
AuthConfig
config
=
refreshTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
MI_REFRESH_TOKEN_PATTERN
,
AuthSource
.
MI
.
refresh
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
config
.
getRedirectUri
(),
refreshTokenEntity
.
getRefreshToken
());
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
MessageFormat
.
format
(
MI_REFRESH_TOKEN_PATTERN
,
AuthSource
.
MI
.
refresh
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
config
.
getRedirectUri
(),
refreshToken
);
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/MicrosoftUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -21,9 +20,8 @@ public class MicrosoftUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
MICROSOFT_REFRESH_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&scope=user.read%20mail.read&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
MICROSOFT_ACCESS_TOKEN_PATTERN
,
AuthSource
.
MICROSOFT
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
config
.
getRedirectUri
(),
accessTokenEntity
.
getCode
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
MICROSOFT_ACCESS_TOKEN_PATTERN
,
AuthSource
.
MICROSOFT
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
config
.
getRedirectUri
(),
code
);
}
@Override
...
...
@@ -32,19 +30,17 @@ public class MicrosoftUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
MICROSOFT_AUTHORIZE_PATTERN
,
AuthSource
.
MICROSOFT
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
AuthConfig
config
=
refreshTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
MICROSOFT_REFRESH_TOKEN_PATTERN
,
AuthSource
.
MICROSOFT
.
refresh
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
config
.
getRedirectUri
(),
refreshTokenEntity
.
getRefreshToken
());
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
MessageFormat
.
format
(
MICROSOFT_REFRESH_TOKEN_PATTERN
,
AuthSource
.
MICROSOFT
.
refresh
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
config
.
getRedirectUri
(),
refreshToken
);
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/OschinaUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -20,10 +19,8 @@ public class OschinaUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
OSCHINA_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&response_type=code&redirect_uri={2}&state={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
OSCHINA_ACCESS_TOKEN_PATTERN
,
AuthSource
.
OSCHINA
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
OSCHINA_ACCESS_TOKEN_PATTERN
,
AuthSource
.
OSCHINA
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -32,19 +29,17 @@ public class OschinaUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
return
MessageFormat
.
format
(
OSCHINA_AUTHORIZE_PATTERN
,
AuthSource
.
OSCHINA
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
OSCHINA_AUTHORIZE_PATTERN
,
AuthSource
.
OSCHINA
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/QqUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -21,10 +20,8 @@ public class QqUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
QQ_OPENID_PATTERN
=
"{0}?access_token={1}&unionid={2}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
QQ_ACCESS_TOKEN_PATTERN
,
AuthSource
.
QQ
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
QQ_ACCESS_TOKEN_PATTERN
,
AuthSource
.
QQ
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -33,19 +30,17 @@ public class QqUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
return
MessageFormat
.
format
(
QQ_AUTHORIZE_PATTERN
,
AuthSource
.
QQ
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
QQ_AUTHORIZE_PATTERN
,
AuthSource
.
QQ
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
...
...
src/main/java/me/zhyd/oauth/url/TaobaoUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -19,10 +18,8 @@ public class TaobaoUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
TAOBAO_ACCESS_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&code={3}&redirect_uri={4}&grant_type=authorization_code"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
TAOBAO_ACCESS_TOKEN_PATTERN
,
AuthSource
.
TAOBAO
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
TAOBAO_ACCESS_TOKEN_PATTERN
,
AuthSource
.
TAOBAO
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -31,19 +28,17 @@ public class TaobaoUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
return
MessageFormat
.
format
(
TAOBAO_AUTHORIZE_PATTERN
,
AuthSource
.
TAOBAO
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
TAOBAO_AUTHORIZE_PATTERN
,
AuthSource
.
TAOBAO
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/TencentCloudUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -20,10 +19,8 @@ public class TencentCloudUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
TENCENT_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&response_type=code&redirect_uri={2}&scope=user&state={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
TENCENT_ACCESS_TOKEN_PATTERN
,
AuthSource
.
TENCENT_CLOUD
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
TENCENT_ACCESS_TOKEN_PATTERN
,
AuthSource
.
TENCENT_CLOUD
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
);
}
@Override
...
...
@@ -32,19 +29,17 @@ public class TencentCloudUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
return
MessageFormat
.
format
(
TENCENT_AUTHORIZE_PATTERN
,
AuthSource
.
TENCENT_CLOUD
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
TENCENT_AUTHORIZE_PATTERN
,
AuthSource
.
TENCENT_CLOUD
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/ToutiaoUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -20,10 +19,8 @@ public class ToutiaoUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
TOUTIAO_AUTHORIZE_PATTERN
=
"{0}?client_key={1}&redirect_uri={2}&state={3}&response_type=code&auth_only=1&display=0"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
TOUTIAO_ACCESS_TOKEN_PATTERN
,
AuthSource
.
TOUTIAO
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
TOUTIAO_ACCESS_TOKEN_PATTERN
,
AuthSource
.
TOUTIAO
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
);
}
@Override
...
...
@@ -32,19 +29,17 @@ public class ToutiaoUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
return
MessageFormat
.
format
(
TOUTIAO_AUTHORIZE_PATTERN
,
AuthSource
.
TOUTIAO
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
TOUTIAO_AUTHORIZE_PATTERN
,
AuthSource
.
TOUTIAO
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/WechatUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -21,9 +20,8 @@ public class WechatUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
WECHAT_USER_INFO_PATTERN
=
"{0}?access_token={1}&openid={2}&lang=zh_CN"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
WECHAT_ACCESS_TOKEN_PATTERN
,
AuthSource
.
WECHAT
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
WECHAT_ACCESS_TOKEN_PATTERN
,
AuthSource
.
WECHAT
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
);
}
@Override
...
...
@@ -32,18 +30,17 @@ public class WechatUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
WECHAT_AUTHORIZE_PATTERN
,
AuthSource
.
WECHAT
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
return
MessageFormat
.
format
(
WECHAT_REFRESH_TOKEN_PATTERN
,
AuthSource
.
WECHAT
.
refresh
(),
refreshTokenEntity
.
getConfig
().
getClientId
(),
refreshTokenEntity
.
getRefreshToken
()
);
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
MessageFormat
.
format
(
WECHAT_REFRESH_TOKEN_PATTERN
,
AuthSource
.
WECHAT
.
refresh
(),
config
.
getClientId
(),
refreshToken
);
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/WeiboUrlBuilder.java
浏览文件 @
65334d0f
package
me.zhyd.oauth.url
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.url.entity.
*
;
import
me.zhyd.oauth.url.entity.
AuthUserInfoEntity
;
import
java.text.MessageFormat
;
...
...
@@ -20,10 +19,8 @@ public class WeiboUrlBuilder extends AbstractUrlBuilder {
private
static
final
String
WEIBO_AUTHORIZE_PATTERN
=
"{0}?client_id={1}&response_type=code&redirect_uri={2}&state={3}"
;
@Override
public
String
getAccessTokenUrl
(
AuthAccessTokenEntity
accessTokenEntity
)
{
AuthConfig
config
=
accessTokenEntity
.
getConfig
();
return
MessageFormat
.
format
(
WEIBO_ACCESS_TOKEN_PATTERN
,
AuthSource
.
WEIBO
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
accessTokenEntity
.
getCode
(),
config
.
getRedirectUri
());
public
String
getAccessTokenUrl
(
String
code
)
{
return
MessageFormat
.
format
(
WEIBO_ACCESS_TOKEN_PATTERN
,
AuthSource
.
WEIBO
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
}
@Override
...
...
@@ -32,19 +29,17 @@ public class WeiboUrlBuilder extends AbstractUrlBuilder {
}
@Override
public
String
getAuthorizeUrl
(
AuthAuthorizeEntity
authorizeEntity
)
{
AuthConfig
config
=
authorizeEntity
.
getConfig
();
return
MessageFormat
.
format
(
WEIBO_AUTHORIZE_PATTERN
,
AuthSource
.
WEIBO
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
public
String
getAuthorizeUrl
()
{
return
MessageFormat
.
format
(
WEIBO_AUTHORIZE_PATTERN
,
AuthSource
.
WEIBO
.
authorize
(),
config
.
getClientId
(),
config
.
getRedirectUri
(),
this
.
getRealState
(
config
.
getState
()));
}
@Override
public
String
getRefreshUrl
(
AuthRefreshTokenEntity
refreshTokenEntity
)
{
public
String
getRefreshUrl
(
String
refreshToken
)
{
return
null
;
}
@Override
public
String
getRevokeUrl
(
AuthRevokeEntity
revokeEntity
)
{
public
String
getRevokeUrl
(
String
accessToken
)
{
return
null
;
}
}
src/main/java/me/zhyd/oauth/url/entity/AuthAccessTokenEntity.java
已删除
100644 → 0
浏览文件 @
67c668b7
package
me.zhyd.oauth.url.entity
;
import
lombok.Builder
;
import
lombok.Getter
;
import
me.zhyd.oauth.config.AuthConfig
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
@Builder
public
class
AuthAccessTokenEntity
{
/**
* JustAuth的配置类
*/
private
AuthConfig
config
;
/**
* 访问AuthorizeUrl后回调时带的参数code
*/
private
String
code
;
}
src/main/java/me/zhyd/oauth/url/entity/AuthAuthorizeEntity.java
已删除
100644 → 0
浏览文件 @
67c668b7
package
me.zhyd.oauth.url.entity
;
import
lombok.Builder
;
import
lombok.Getter
;
import
me.zhyd.oauth.config.AuthConfig
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
@Builder
public
class
AuthAuthorizeEntity
{
/**
* JustAuth的配置类
*/
private
AuthConfig
config
;
}
src/main/java/me/zhyd/oauth/url/entity/AuthRefreshTokenEntity.java
已删除
100644 → 0
浏览文件 @
67c668b7
package
me.zhyd.oauth.url.entity
;
import
lombok.Builder
;
import
lombok.Getter
;
import
me.zhyd.oauth.config.AuthConfig
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
@Builder
public
class
AuthRefreshTokenEntity
{
private
AuthConfig
config
;
private
String
refreshToken
;
}
src/main/java/me/zhyd/oauth/url/entity/AuthRevokeEntity.java
已删除
100644 → 0
浏览文件 @
67c668b7
package
me.zhyd.oauth.url.entity
;
import
lombok.*
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
@Getter
@Builder
public
class
AuthRevokeEntity
{
private
String
accessToken
;
}
update.md
浏览文件 @
65334d0f
### 2019/07/16
1.
重构UrlBuilder类
2.
将CSDN相关的类置为
`Deprecated`
,后续可能会删除,也可能一直保留。毕竟CSDN的openAPI已经不对外开放了。
### 2019/07/15
1.
新增
`AuthState`
类,内置默认的state生成规则和校验规则
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录