Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
AS_LXG
JustAuth
提交
fabfff60
J
JustAuth
项目概览
AS_LXG
/
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,发现更多精彩内容 >>
未验证
提交
fabfff60
编写于
8月 03, 2019
作者:
智布道
👁
提交者:
GitHub
8月 03, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #32 from xkcoding/extract-cache
抽取缓存接口
上级
d9967b28
d4296d16
变更
31
显示空白变更内容
内联
并排
Showing
31 changed file
with
299 addition
and
57 deletion
+299
-57
pom.xml
pom.xml
+32
-1
src/main/java/me/zhyd/oauth/cache/AuthCacheScheduler.java
src/main/java/me/zhyd/oauth/cache/AuthCacheScheduler.java
+3
-0
src/main/java/me/zhyd/oauth/cache/AuthDefaultStateCache.java
src/main/java/me/zhyd/oauth/cache/AuthDefaultStateCache.java
+65
-0
src/main/java/me/zhyd/oauth/cache/AuthStateCache.java
src/main/java/me/zhyd/oauth/cache/AuthStateCache.java
+11
-18
src/main/java/me/zhyd/oauth/request/AuthAlipayRequest.java
src/main/java/me/zhyd/oauth/request/AuthAlipayRequest.java
+7
-0
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
+9
-1
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java
src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthDefaultRequest.java
src/main/java/me/zhyd/oauth/request/AuthDefaultRequest.java
+25
-6
src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java
src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
+9
-1
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
+9
-1
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
...main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
+9
-1
src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java
src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthPinterestRequest.java
...main/java/me/zhyd/oauth/request/AuthPinterestRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
+10
-5
src/main/java/me/zhyd/oauth/request/AuthRenrenRequest.java
src/main/java/me/zhyd/oauth/request/AuthRenrenRequest.java
+9
-1
src/main/java/me/zhyd/oauth/request/AuthStackOverflowRequest.java
.../java/me/zhyd/oauth/request/AuthStackOverflowRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java
src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthTeambitionRequest.java
...ain/java/me/zhyd/oauth/request/AuthTeambitionRequest.java
+9
-1
src/main/java/me/zhyd/oauth/request/AuthTencentCloudRequest.java
...n/java/me/zhyd/oauth/request/AuthTencentCloudRequest.java
+5
-0
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
+6
-2
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
+9
-1
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
+5
-0
src/main/java/me/zhyd/oauth/utils/AuthChecker.java
src/main/java/me/zhyd/oauth/utils/AuthChecker.java
+0
-11
src/test/java/me/zhyd/oauth/cache/AuthStateCacheTest.java
src/test/java/me/zhyd/oauth/cache/AuthStateCacheTest.java
+7
-7
未找到文件。
pom.xml
浏览文件 @
fabfff60
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<groupId>
me.zhyd.oauth
</groupId>
<groupId>
me.zhyd.oauth
</groupId>
<artifactId>
JustAuth
</artifactId>
<artifactId>
JustAuth
</artifactId>
<version>
1.9.
5
</version>
<version>
1.9.
6-SNAPSHOT
</version>
<name>
JustAuth
</name>
<name>
JustAuth
</name>
<url>
https://gitee.com/yadong.zhang/JustAuth
</url>
<url>
https://gitee.com/yadong.zhang/JustAuth
</url>
...
@@ -230,5 +230,36 @@
...
@@ -230,5 +230,36 @@
</repository>
</repository>
</distributionManagement>
</distributionManagement>
</profile>
</profile>
<!--私服-->
<profile>
<id>
nexus
</id>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-gpg-plugin
</artifactId>
<version>
${maven-gpg-version}
</version>
<executions>
<execution>
<phase>
verify
</phase>
<goals>
<goal>
sign
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>
xkcoding-nexus
</id>
<url>
https://nexus.xkcoding.com/repository/maven-releases/
</url>
</repository>
<snapshotRepository>
<id>
xkcoding-nexus
</id>
<url>
https://nexus.xkcoding.com/repository/maven-snapshots/
</url>
</snapshotRepository>
</distributionManagement>
</profile>
</profiles>
</profiles>
</project>
</project>
src/main/java/me/zhyd/oauth/cache/AuthCacheScheduler.java
浏览文件 @
fabfff60
...
@@ -13,6 +13,9 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -13,6 +13,9 @@ import java.util.concurrent.atomic.AtomicInteger;
*/
*/
public
enum
AuthCacheScheduler
{
public
enum
AuthCacheScheduler
{
/**
* 当前实例
*/
INSTANCE
;
INSTANCE
;
private
AtomicInteger
cacheTaskNumber
=
new
AtomicInteger
(
1
);
private
AtomicInteger
cacheTaskNumber
=
new
AtomicInteger
(
1
);
...
...
src/main/java/me/zhyd/oauth/cache/AuthDefaultStateCache.java
0 → 100644
浏览文件 @
fabfff60
package
me.zhyd.oauth.cache
;
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public
enum
AuthDefaultStateCache
implements
AuthStateCache
{
/**
* 当前实例
*/
INSTANCE
;
private
AuthCache
authCache
;
AuthDefaultStateCache
()
{
authCache
=
new
AuthDefaultCache
();
}
/**
* 存入缓存
*
* @param key 缓存key
* @param value 缓存内容
*/
@Override
public
void
cache
(
String
key
,
String
value
)
{
authCache
.
set
(
key
,
value
);
}
/**
* 存入缓存
*
* @param key 缓存key
* @param value 缓存内容
* @param timeout 指定缓存过期时间(毫秒)
*/
@Override
public
void
cache
(
String
key
,
String
value
,
long
timeout
)
{
authCache
.
set
(
key
,
value
,
timeout
);
}
/**
* 获取缓存内容
*
* @param key 缓存key
* @return 缓存内容
*/
@Override
public
String
get
(
String
key
)
{
return
authCache
.
get
(
key
);
}
/**
* 是否存在key,如果对应key的value值已过期,也返回false
*
* @param key 缓存key
* @return true:存在key,并且value没过期;false:key不存在或者已过期
*/
@Override
public
boolean
containsKey
(
String
key
)
{
return
authCache
.
containsKey
(
key
);
}
}
src/main/java/me/zhyd/oauth/cache/AuthStateCache.java
浏览文件 @
fabfff60
package
me.zhyd.oauth.cache
;
package
me.zhyd.oauth.cache
;
/**
/**
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* <p>
* @version 1.0
* State缓存接口,方便用户扩展
* @since 1.8
* </p>
*
* @author yangkai.shen
* @date Created in 2019-08-02 10:55
*/
*/
public
class
AuthStateCache
{
public
interface
AuthStateCache
{
private
static
AuthCache
authCache
=
new
AuthDefaultCache
();
/**
/**
* 存入缓存
* 存入缓存
*
*
* @param key 缓存key
* @param key 缓存key
* @param value 缓存内容
* @param value 缓存内容
*/
*/
public
static
void
cache
(
String
key
,
String
value
)
{
void
cache
(
String
key
,
String
value
);
authCache
.
set
(
key
,
value
);
}
/**
/**
* 存入缓存
* 存入缓存
...
@@ -25,9 +24,7 @@ public class AuthStateCache {
...
@@ -25,9 +24,7 @@ public class AuthStateCache {
* @param value 缓存内容
* @param value 缓存内容
* @param timeout 指定缓存过期时间(毫秒)
* @param timeout 指定缓存过期时间(毫秒)
*/
*/
public
static
void
cache
(
String
key
,
String
value
,
long
timeout
)
{
void
cache
(
String
key
,
String
value
,
long
timeout
);
authCache
.
set
(
key
,
value
,
timeout
);
}
/**
/**
* 获取缓存内容
* 获取缓存内容
...
@@ -35,9 +32,7 @@ public class AuthStateCache {
...
@@ -35,9 +32,7 @@ public class AuthStateCache {
* @param key 缓存key
* @param key 缓存key
* @return 缓存内容
* @return 缓存内容
*/
*/
public
static
String
get
(
String
key
)
{
String
get
(
String
key
);
return
authCache
.
get
(
key
);
}
/**
/**
* 是否存在key,如果对应key的value值已过期,也返回false
* 是否存在key,如果对应key的value值已过期,也返回false
...
@@ -45,7 +40,5 @@ public class AuthStateCache {
...
@@ -45,7 +40,5 @@ public class AuthStateCache {
* @param key 缓存key
* @param key 缓存key
* @return true:存在key,并且value没过期;false:key不存在或者已过期
* @return true:存在key,并且value没过期;false:key不存在或者已过期
*/
*/
public
static
boolean
containsKey
(
String
key
)
{
boolean
containsKey
(
String
key
);
return
authCache
.
containsKey
(
key
);
}
}
}
src/main/java/me/zhyd/oauth/request/AuthAlipayRequest.java
浏览文件 @
fabfff60
...
@@ -7,6 +7,7 @@ import com.alipay.api.request.AlipaySystemOauthTokenRequest;
...
@@ -7,6 +7,7 @@ import com.alipay.api.request.AlipaySystemOauthTokenRequest;
import
com.alipay.api.request.AlipayUserInfoShareRequest
;
import
com.alipay.api.request.AlipayUserInfoShareRequest
;
import
com.alipay.api.response.AlipaySystemOauthTokenResponse
;
import
com.alipay.api.response.AlipaySystemOauthTokenResponse
;
import
com.alipay.api.response.AlipayUserInfoShareResponse
;
import
com.alipay.api.response.AlipayUserInfoShareResponse
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -33,6 +34,12 @@ public class AuthAlipayRequest extends AuthDefaultRequest {
...
@@ -33,6 +34,12 @@ public class AuthAlipayRequest extends AuthDefaultRequest {
.
getAlipayPublicKey
(),
"RSA2"
);
.
getAlipayPublicKey
(),
"RSA2"
);
}
}
public
AuthAlipayRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
ALIPAY
,
authStateCache
);
this
.
alipayClient
=
new
DefaultAlipayClient
(
AuthSource
.
ALIPAY
.
accessToken
(),
config
.
getClientId
(),
config
.
getClientSecret
(),
"json"
,
"UTF-8"
,
config
.
getAlipayPublicKey
(),
"RSA2"
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
AlipaySystemOauthTokenRequest
request
=
new
AlipaySystemOauthTokenRequest
();
AlipaySystemOauthTokenRequest
request
=
new
AlipaySystemOauthTokenRequest
();
...
...
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
浏览文件 @
fabfff60
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthResponse
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
@@ -24,6 +28,10 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
...
@@ -24,6 +28,10 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
BAIDU
);
super
(
config
,
AuthSource
.
BAIDU
);
}
}
public
AuthBaiduRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
BAIDU
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -23,6 +24,10 @@ public class AuthCodingRequest extends AuthDefaultRequest {
...
@@ -23,6 +24,10 @@ public class AuthCodingRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
CODING
);
super
(
config
,
AuthSource
.
CODING
);
}
}
public
AuthCodingRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
CODING
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doGetAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doGetAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -23,6 +24,10 @@ public class AuthCsdnRequest extends AuthDefaultRequest {
...
@@ -23,6 +24,10 @@ public class AuthCsdnRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
CSDN
);
super
(
config
,
AuthSource
.
CSDN
);
}
}
public
AuthCsdnRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
CSDN
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthDefaultRequest.java
浏览文件 @
fabfff60
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhyd.oauth.cache.AuthDefaultStateCache
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
...
@@ -28,10 +29,16 @@ import me.zhyd.oauth.utils.UuidUtils;
...
@@ -28,10 +29,16 @@ import me.zhyd.oauth.utils.UuidUtils;
public
abstract
class
AuthDefaultRequest
implements
AuthRequest
{
public
abstract
class
AuthDefaultRequest
implements
AuthRequest
{
protected
AuthConfig
config
;
protected
AuthConfig
config
;
protected
AuthSource
source
;
protected
AuthSource
source
;
protected
AuthStateCache
authStateCache
;
public
AuthDefaultRequest
(
AuthConfig
config
,
AuthSource
source
)
{
public
AuthDefaultRequest
(
AuthConfig
config
,
AuthSource
source
)
{
this
(
config
,
source
,
AuthDefaultStateCache
.
INSTANCE
);
}
public
AuthDefaultRequest
(
AuthConfig
config
,
AuthSource
source
,
AuthStateCache
authStateCache
)
{
this
.
config
=
config
;
this
.
config
=
config
;
this
.
source
=
source
;
this
.
source
=
source
;
this
.
authStateCache
=
authStateCache
;
if
(!
AuthChecker
.
isSupportedAuth
(
config
,
source
))
{
if
(!
AuthChecker
.
isSupportedAuth
(
config
,
source
))
{
throw
new
AuthException
(
AuthResponseStatus
.
PARAMETER_INCOMPLETE
);
throw
new
AuthException
(
AuthResponseStatus
.
PARAMETER_INCOMPLETE
);
}
}
...
@@ -69,7 +76,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
...
@@ -69,7 +76,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
public
AuthResponse
login
(
AuthCallback
authCallback
)
{
public
AuthResponse
login
(
AuthCallback
authCallback
)
{
try
{
try
{
AuthChecker
.
checkCode
(
source
==
AuthSource
.
ALIPAY
?
authCallback
.
getAuth_code
()
:
authCallback
.
getCode
());
AuthChecker
.
checkCode
(
source
==
AuthSource
.
ALIPAY
?
authCallback
.
getAuth_code
()
:
authCallback
.
getCode
());
AuthChecker
.
checkState
(
authCallback
.
getState
());
this
.
checkState
(
authCallback
.
getState
());
AuthToken
authToken
=
this
.
getAccessToken
(
authCallback
);
AuthToken
authToken
=
this
.
getAccessToken
(
authCallback
);
AuthUser
user
=
this
.
getUserInfo
(
authToken
);
AuthUser
user
=
this
.
getUserInfo
(
authToken
);
...
@@ -156,7 +163,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
...
@@ -156,7 +163,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
.
queryParam
(
"grant_type"
,
"refresh_token"
)
.
queryParam
(
"grant_type"
,
"refresh_token"
)
.
queryParam
(
"redirect_uri"
,
config
.
getRedirectUri
())
.
queryParam
(
"redirect_uri"
,
config
.
getRedirectUri
())
.
build
();
.
build
();
}
}
/**
/**
* 返回获取userInfo的url
* 返回获取userInfo的url
...
@@ -189,7 +196,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
...
@@ -189,7 +196,7 @@ public abstract class AuthDefaultRequest implements AuthRequest {
state
=
UuidUtils
.
getUUID
();
state
=
UuidUtils
.
getUUID
();
}
}
// 缓存state
// 缓存state
A
uthStateCache
.
cache
(
state
,
state
);
a
uthStateCache
.
cache
(
state
,
state
);
return
state
;
return
state
;
}
}
...
@@ -254,4 +261,16 @@ public abstract class AuthDefaultRequest implements AuthRequest {
...
@@ -254,4 +261,16 @@ public abstract class AuthDefaultRequest implements AuthRequest {
protected
HttpResponse
doGetRevoke
(
AuthToken
authToken
)
{
protected
HttpResponse
doGetRevoke
(
AuthToken
authToken
)
{
return
HttpRequest
.
get
(
revokeUrl
(
authToken
)).
execute
();
return
HttpRequest
.
get
(
revokeUrl
(
authToken
)).
execute
();
}
}
/**
* 校验回调传回的state
*
* @param state {@code state}一定不为空
*/
protected
void
checkState
(
String
state
)
{
if
(
StringUtils
.
isEmpty
(
state
)
||
!
authStateCache
.
containsKey
(
state
))
{
throw
new
AuthException
(
AuthResponseStatus
.
ILLEGAL_REQUEST
);
}
}
}
}
src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java
浏览文件 @
fabfff60
...
@@ -4,6 +4,7 @@ import cn.hutool.http.HttpRequest;
...
@@ -4,6 +4,7 @@ import cn.hutool.http.HttpRequest;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -26,6 +27,10 @@ public class AuthDingTalkRequest extends AuthDefaultRequest {
...
@@ -26,6 +27,10 @@ public class AuthDingTalkRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
DINGTALK
);
super
(
config
,
AuthSource
.
DINGTALK
);
}
}
public
AuthDingTalkRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
DINGTALK
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
return
AuthToken
.
builder
().
accessCode
(
authCallback
.
getCode
()).
build
();
return
AuthToken
.
builder
().
accessCode
(
authCallback
.
getCode
()).
build
();
...
...
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
浏览文件 @
fabfff60
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthResponse
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
@@ -24,6 +28,10 @@ public class AuthDouyinRequest extends AuthDefaultRequest {
...
@@ -24,6 +28,10 @@ public class AuthDouyinRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
DOUYIN
);
super
(
config
,
AuthSource
.
DOUYIN
);
}
}
public
AuthDouyinRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
DOUYIN
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
return
this
.
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
return
this
.
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
...
...
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -23,6 +24,10 @@ public class AuthFacebookRequest extends AuthDefaultRequest {
...
@@ -23,6 +24,10 @@ public class AuthFacebookRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
FACEBOOK
);
super
(
config
,
AuthSource
.
FACEBOOK
);
}
}
public
AuthFacebookRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
FACEBOOK
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -22,6 +23,10 @@ public class AuthGiteeRequest extends AuthDefaultRequest {
...
@@ -22,6 +23,10 @@ public class AuthGiteeRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
GITEE
);
super
(
config
,
AuthSource
.
GITEE
);
}
}
public
AuthGiteeRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
GITEE
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -25,6 +26,10 @@ public class AuthGithubRequest extends AuthDefaultRequest {
...
@@ -25,6 +26,10 @@ public class AuthGithubRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
GITHUB
);
super
(
config
,
AuthSource
.
GITHUB
);
}
}
public
AuthGithubRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
GITHUB
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
浏览文件 @
fabfff60
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -24,6 +25,10 @@ public class AuthGoogleRequest extends AuthDefaultRequest {
...
@@ -24,6 +25,10 @@ public class AuthGoogleRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
GOOGLE
);
super
(
config
,
AuthSource
.
GOOGLE
);
}
}
public
AuthGoogleRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
GOOGLE
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
浏览文件 @
fabfff60
...
@@ -5,12 +5,16 @@ import cn.hutool.http.HttpResponse;
...
@@ -5,12 +5,16 @@ import cn.hutool.http.HttpResponse;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONPath
;
import
com.alibaba.fastjson.JSONPath
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthResponse
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
@@ -27,6 +31,10 @@ public class AuthLinkedinRequest extends AuthDefaultRequest {
...
@@ -27,6 +31,10 @@ public class AuthLinkedinRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
LINKEDIN
);
super
(
config
,
AuthSource
.
LINKEDIN
);
}
}
public
AuthLinkedinRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
LINKEDIN
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
return
this
.
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
return
this
.
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
...
...
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
浏览文件 @
fabfff60
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
...
@@ -28,6 +29,10 @@ public class AuthMiRequest extends AuthDefaultRequest {
...
@@ -28,6 +29,10 @@ public class AuthMiRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
MI
);
super
(
config
,
AuthSource
.
MI
);
}
}
public
AuthMiRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
MI
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
return
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
return
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
...
...
src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
浏览文件 @
fabfff60
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthResponse
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
static
me
.
zhyd
.
oauth
.
utils
.
GlobalAuthUtil
.
parseQueryToMap
;
import
static
me
.
zhyd
.
oauth
.
utils
.
GlobalAuthUtil
.
parseQueryToMap
;
...
@@ -24,6 +28,10 @@ public class AuthMicrosoftRequest extends AuthDefaultRequest {
...
@@ -24,6 +28,10 @@ public class AuthMicrosoftRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
MICROSOFT
);
super
(
config
,
AuthSource
.
MICROSOFT
);
}
}
public
AuthMicrosoftRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
MICROSOFT
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
return
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
return
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
...
...
src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -23,6 +24,10 @@ public class AuthOschinaRequest extends AuthDefaultRequest {
...
@@ -23,6 +24,10 @@ public class AuthOschinaRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
OSCHINA
);
super
(
config
,
AuthSource
.
OSCHINA
);
}
}
public
AuthOschinaRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
OSCHINA
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthPinterestRequest.java
浏览文件 @
fabfff60
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
...
@@ -29,6 +30,10 @@ public class AuthPinterestRequest extends AuthDefaultRequest {
...
@@ -29,6 +30,10 @@ public class AuthPinterestRequest extends AuthDefaultRequest {
super
(
config
,
PINTEREST
);
super
(
config
,
PINTEREST
);
}
}
public
AuthPinterestRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
PINTEREST
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
浏览文件 @
fabfff60
...
@@ -4,12 +4,16 @@ import cn.hutool.core.util.StrUtil;
...
@@ -4,12 +4,16 @@ import cn.hutool.core.util.StrUtil;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthResponse
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.GlobalAuthUtil
;
import
me.zhyd.oauth.utils.GlobalAuthUtil
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
@@ -28,6 +32,10 @@ public class AuthQqRequest extends AuthDefaultRequest {
...
@@ -28,6 +32,10 @@ public class AuthQqRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
QQ
);
super
(
config
,
AuthSource
.
QQ
);
}
}
public
AuthQqRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
QQ
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doGetAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doGetAuthorizationCode
(
authCallback
.
getCode
());
...
@@ -37,10 +45,7 @@ public class AuthQqRequest extends AuthDefaultRequest {
...
@@ -37,10 +45,7 @@ public class AuthQqRequest extends AuthDefaultRequest {
@Override
@Override
public
AuthResponse
refresh
(
AuthToken
authToken
)
{
public
AuthResponse
refresh
(
AuthToken
authToken
)
{
HttpResponse
response
=
HttpRequest
.
get
(
refreshTokenUrl
(
authToken
.
getRefreshToken
())).
execute
();
HttpResponse
response
=
HttpRequest
.
get
(
refreshTokenUrl
(
authToken
.
getRefreshToken
())).
execute
();
return
AuthResponse
.
builder
()
return
AuthResponse
.
builder
().
code
(
AuthResponseStatus
.
SUCCESS
.
getCode
()).
data
(
getAuthToken
(
response
)).
build
();
.
code
(
AuthResponseStatus
.
SUCCESS
.
getCode
())
.
data
(
getAuthToken
(
response
))
.
build
();
}
}
@Override
@Override
...
...
src/main/java/me/zhyd/oauth/request/AuthRenrenRequest.java
浏览文件 @
fabfff60
...
@@ -4,10 +4,14 @@ import cn.hutool.http.HttpRequest;
...
@@ -4,10 +4,14 @@ import cn.hutool.http.HttpRequest;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthResponse
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -27,6 +31,10 @@ public class AuthRenrenRequest extends AuthDefaultRequest {
...
@@ -27,6 +31,10 @@ public class AuthRenrenRequest extends AuthDefaultRequest {
super
(
config
,
RENREN
);
super
(
config
,
RENREN
);
}
}
public
AuthRenrenRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
RENREN
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
return
this
.
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
return
this
.
getToken
(
accessTokenUrl
(
authCallback
.
getCode
()));
...
...
src/main/java/me/zhyd/oauth/request/AuthStackOverflowRequest.java
浏览文件 @
fabfff60
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
...
@@ -26,6 +27,10 @@ public class AuthStackOverflowRequest extends AuthDefaultRequest {
...
@@ -26,6 +27,10 @@ public class AuthStackOverflowRequest extends AuthDefaultRequest {
super
(
config
,
STACK_OVERFLOW
);
super
(
config
,
STACK_OVERFLOW
);
}
}
public
AuthStackOverflowRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
STACK_OVERFLOW
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
String
accessTokenUrl
=
accessTokenUrl
(
authCallback
.
getCode
());
String
accessTokenUrl
=
accessTokenUrl
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -24,6 +25,10 @@ public class AuthTaobaoRequest extends AuthDefaultRequest {
...
@@ -24,6 +25,10 @@ public class AuthTaobaoRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
TAOBAO
);
super
(
config
,
AuthSource
.
TAOBAO
);
}
}
public
AuthTaobaoRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
TAOBAO
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
return
AuthToken
.
builder
().
accessCode
(
authCallback
.
getCode
()).
build
();
return
AuthToken
.
builder
().
accessCode
(
authCallback
.
getCode
()).
build
();
...
...
src/main/java/me/zhyd/oauth/request/AuthTeambitionRequest.java
浏览文件 @
fabfff60
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthResponse
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
/**
/**
* Teambition授权登录
* Teambition授权登录
...
@@ -22,6 +26,10 @@ public class AuthTeambitionRequest extends AuthDefaultRequest {
...
@@ -22,6 +26,10 @@ public class AuthTeambitionRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
TEAMBITION
);
super
(
config
,
AuthSource
.
TEAMBITION
);
}
}
public
AuthTeambitionRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
TEAMBITION
,
authStateCache
);
}
/**
/**
* @param authCallback 回调返回的参数
* @param authCallback 回调返回的参数
* @return 所有信息
* @return 所有信息
...
...
src/main/java/me/zhyd/oauth/request/AuthTencentCloudRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -23,6 +24,10 @@ public class AuthTencentCloudRequest extends AuthDefaultRequest {
...
@@ -23,6 +24,10 @@ public class AuthTencentCloudRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
TENCENT_CLOUD
);
super
(
config
,
AuthSource
.
TENCENT_CLOUD
);
}
}
public
AuthTencentCloudRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
TENCENT_CLOUD
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doGetAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doGetAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
浏览文件 @
fabfff60
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
...
@@ -2,6 +2,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthToutiaoErrorCode
;
import
me.zhyd.oauth.enums.AuthToutiaoErrorCode
;
...
@@ -24,6 +25,10 @@ public class AuthToutiaoRequest extends AuthDefaultRequest {
...
@@ -24,6 +25,10 @@ public class AuthToutiaoRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
TOUTIAO
);
super
(
config
,
AuthSource
.
TOUTIAO
);
}
}
public
AuthToutiaoRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
TOUTIAO
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doGetAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doGetAuthorizationCode
(
authCallback
.
getCode
());
...
@@ -119,8 +124,7 @@ public class AuthToutiaoRequest extends AuthDefaultRequest {
...
@@ -119,8 +124,7 @@ public class AuthToutiaoRequest extends AuthDefaultRequest {
*/
*/
private
void
checkResponse
(
JSONObject
object
)
{
private
void
checkResponse
(
JSONObject
object
)
{
if
(
object
.
containsKey
(
"error_code"
))
{
if
(
object
.
containsKey
(
"error_code"
))
{
throw
new
AuthException
(
AuthToutiaoErrorCode
.
getErrorCode
(
object
.
getIntValue
(
"error_code"
))
throw
new
AuthException
(
AuthToutiaoErrorCode
.
getErrorCode
(
object
.
getIntValue
(
"error_code"
)).
getDesc
());
.
getDesc
());
}
}
}
}
}
}
src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java
浏览文件 @
fabfff60
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
...
@@ -3,12 +3,16 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthResponse
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.UrlBuilder
;
/**
/**
...
@@ -22,6 +26,10 @@ public class AuthWeChatRequest extends AuthDefaultRequest {
...
@@ -22,6 +26,10 @@ public class AuthWeChatRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
WECHAT
);
super
(
config
,
AuthSource
.
WECHAT
);
}
}
public
AuthWeChatRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
WECHAT
,
authStateCache
);
}
/**
/**
* 微信的特殊性,此时返回的信息同时包含 openid 和 access_token
* 微信的特殊性,此时返回的信息同时包含 openid 和 access_token
*
*
...
...
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
浏览文件 @
fabfff60
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
...
@@ -3,6 +3,7 @@ package me.zhyd.oauth.request;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.cache.AuthStateCache
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthUserGender
;
import
me.zhyd.oauth.enums.AuthUserGender
;
...
@@ -27,6 +28,10 @@ public class AuthWeiboRequest extends AuthDefaultRequest {
...
@@ -27,6 +28,10 @@ public class AuthWeiboRequest extends AuthDefaultRequest {
super
(
config
,
AuthSource
.
WEIBO
);
super
(
config
,
AuthSource
.
WEIBO
);
}
}
public
AuthWeiboRequest
(
AuthConfig
config
,
AuthStateCache
authStateCache
)
{
super
(
config
,
AuthSource
.
WEIBO
,
authStateCache
);
}
@Override
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
HttpResponse
response
=
doPostAuthorizationCode
(
authCallback
.
getCode
());
...
...
src/main/java/me/zhyd/oauth/utils/AuthChecker.java
浏览文件 @
fabfff60
...
@@ -66,15 +66,4 @@ public class AuthChecker {
...
@@ -66,15 +66,4 @@ public class AuthChecker {
throw
new
AuthException
(
AuthResponseStatus
.
ILLEGAL_CODE
);
throw
new
AuthException
(
AuthResponseStatus
.
ILLEGAL_CODE
);
}
}
}
}
/**
* 校验回调传回的state
*
* @param state {@code state}一定不为空
*/
public
static
void
checkState
(
String
state
)
{
if
(
StringUtils
.
isEmpty
(
state
)
||
!
AuthStateCache
.
containsKey
(
state
))
{
throw
new
AuthException
(
AuthResponseStatus
.
ILLEGAL_REQUEST
);
}
}
}
}
src/test/java/me/zhyd/oauth/cache/AuthStateCacheTest.java
浏览文件 @
fabfff60
...
@@ -9,24 +9,24 @@ public class AuthStateCacheTest {
...
@@ -9,24 +9,24 @@ public class AuthStateCacheTest {
@Test
@Test
public
void
cache1
()
throws
InterruptedException
{
public
void
cache1
()
throws
InterruptedException
{
Auth
StateCache
.
cache
(
"key"
,
"value"
);
Auth
DefaultStateCache
.
INSTANCE
.
cache
(
"key"
,
"value"
);
Assert
.
assertEquals
(
Auth
StateCache
.
get
(
"key"
),
"value"
);
Assert
.
assertEquals
(
Auth
DefaultStateCache
.
INSTANCE
.
get
(
"key"
),
"value"
);
TimeUnit
.
MILLISECONDS
.
sleep
(
4
);
TimeUnit
.
MILLISECONDS
.
sleep
(
4
);
Assert
.
assertEquals
(
Auth
StateCache
.
get
(
"key"
),
"value"
);
Assert
.
assertEquals
(
Auth
DefaultStateCache
.
INSTANCE
.
get
(
"key"
),
"value"
);
}
}
@Test
@Test
public
void
cache2
()
throws
InterruptedException
{
public
void
cache2
()
throws
InterruptedException
{
Auth
StateCache
.
cache
(
"key"
,
"value"
,
10
);
Auth
DefaultStateCache
.
INSTANCE
.
cache
(
"key"
,
"value"
,
10
);
Assert
.
assertEquals
(
Auth
StateCache
.
get
(
"key"
),
"value"
);
Assert
.
assertEquals
(
Auth
DefaultStateCache
.
INSTANCE
.
get
(
"key"
),
"value"
);
// 没过期
// 没过期
TimeUnit
.
MILLISECONDS
.
sleep
(
5
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
);
Assert
.
assertEquals
(
Auth
StateCache
.
get
(
"key"
),
"value"
);
Assert
.
assertEquals
(
Auth
DefaultStateCache
.
INSTANCE
.
get
(
"key"
),
"value"
);
// 过期
// 过期
TimeUnit
.
MILLISECONDS
.
sleep
(
6
);
TimeUnit
.
MILLISECONDS
.
sleep
(
6
);
Assert
.
assertNull
(
Auth
StateCache
.
get
(
"key"
));
Assert
.
assertNull
(
Auth
DefaultStateCache
.
INSTANCE
.
get
(
"key"
));
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录