Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
My_csdo
JustAuth
提交
13514d6a
J
JustAuth
项目概览
My_csdo
/
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看板
提交
13514d6a
编写于
3月 29, 2021
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
⚡
调整 map 声明时的初始容量
上级
6a479d9c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
24 addition
and
21 deletion
+24
-21
src/main/java/me/zhyd/oauth/request/AuthAmazonRequest.java
src/main/java/me/zhyd/oauth/request/AuthAmazonRequest.java
+2
-2
src/main/java/me/zhyd/oauth/request/AuthElemeRequest.java
src/main/java/me/zhyd/oauth/request/AuthElemeRequest.java
+4
-4
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
+3
-3
src/main/java/me/zhyd/oauth/request/AuthJdRequest.java
src/main/java/me/zhyd/oauth/request/AuthJdRequest.java
+2
-2
src/main/java/me/zhyd/oauth/request/AuthMeituanRequest.java
src/main/java/me/zhyd/oauth/request/AuthMeituanRequest.java
+3
-3
src/main/java/me/zhyd/oauth/request/AuthTeambitionRequest.java
...ain/java/me/zhyd/oauth/request/AuthTeambitionRequest.java
+2
-2
src/main/java/me/zhyd/oauth/request/AuthTwitterRequest.java
src/main/java/me/zhyd/oauth/request/AuthTwitterRequest.java
+3
-3
src/main/java/me/zhyd/oauth/request/AuthXmlyRequest.java
src/main/java/me/zhyd/oauth/request/AuthXmlyRequest.java
+1
-1
src/main/java/me/zhyd/oauth/utils/GlobalAuthUtils.java
src/main/java/me/zhyd/oauth/utils/GlobalAuthUtils.java
+4
-1
未找到文件。
src/main/java/me/zhyd/oauth/request/AuthAmazonRequest.java
浏览文件 @
13514d6a
...
...
@@ -78,7 +78,7 @@ public class AuthAmazonRequest extends AuthDefaultRequest {
*/
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
8
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
9
);
form
.
put
(
"grant_type"
,
"authorization_code"
);
form
.
put
(
"code"
,
authCallback
.
getCode
());
form
.
put
(
"redirect_uri"
,
config
.
getRedirectUri
());
...
...
@@ -95,7 +95,7 @@ public class AuthAmazonRequest extends AuthDefaultRequest {
@Override
public
AuthResponse
refresh
(
AuthToken
authToken
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
6
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
7
);
form
.
put
(
"grant_type"
,
"refresh_token"
);
form
.
put
(
"refresh_token"
,
authToken
.
getRefreshToken
());
form
.
put
(
"client_id"
,
config
.
getClientId
());
...
...
src/main/java/me/zhyd/oauth/request/AuthElemeRequest.java
浏览文件 @
13514d6a
...
...
@@ -45,7 +45,7 @@ public class AuthElemeRequest extends AuthDefaultRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
4
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
7
);
form
.
put
(
"client_id"
,
config
.
getClientId
());
form
.
put
(
"redirect_uri"
,
config
.
getRedirectUri
());
form
.
put
(
"code"
,
authCallback
.
getCode
());
...
...
@@ -67,13 +67,13 @@ public class AuthElemeRequest extends AuthDefaultRequest {
@Override
protected
AuthUser
getUserInfo
(
AuthToken
authToken
)
{
Map
<
String
,
Object
>
parameters
=
new
HashMap
<>();
Map
<
String
,
Object
>
parameters
=
new
HashMap
<>(
4
);
// 获取商户账号信息的API接口名称
String
action
=
"eleme.user.getUser"
;
// 时间戳,单位秒。API服务端允许客户端请求最大时间误差为正负5分钟。
final
long
timestamp
=
System
.
currentTimeMillis
();
// 公共参数
Map
<
String
,
Object
>
metasHashMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
metasHashMap
=
new
HashMap
<>(
4
);
metasHashMap
.
put
(
"app_key"
,
config
.
getClientId
());
metasHashMap
.
put
(
"timestamp"
,
timestamp
);
String
signature
=
GlobalAuthUtils
.
generateElemeSignature
(
config
.
getClientId
(),
config
.
getClientSecret
(),
timestamp
,
action
,
authToken
...
...
@@ -118,7 +118,7 @@ public class AuthElemeRequest extends AuthDefaultRequest {
@Override
public
AuthResponse
refresh
(
AuthToken
oldToken
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
2
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
4
);
form
.
put
(
"refresh_token"
,
oldToken
.
getRefreshToken
());
form
.
put
(
"grant_type"
,
"refresh_token"
);
...
...
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
浏览文件 @
13514d6a
...
...
@@ -47,7 +47,7 @@ public class AuthHuaweiRequest extends AuthDefaultRequest {
*/
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
5
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
8
);
form
.
put
(
"grant_type"
,
"authorization_code"
);
form
.
put
(
"code"
,
authCallback
.
getAuthorization_code
());
form
.
put
(
"client_id"
,
config
.
getClientId
());
...
...
@@ -67,7 +67,7 @@ public class AuthHuaweiRequest extends AuthDefaultRequest {
*/
@Override
protected
AuthUser
getUserInfo
(
AuthToken
authToken
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
4
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
7
);
form
.
put
(
"nsp_ts"
,
System
.
currentTimeMillis
()
+
""
);
form
.
put
(
"access_token"
,
authToken
.
getAccessToken
());
form
.
put
(
"nsp_fmt"
,
"JS"
);
...
...
@@ -100,7 +100,7 @@ public class AuthHuaweiRequest extends AuthDefaultRequest {
*/
@Override
public
AuthResponse
refresh
(
AuthToken
authToken
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
4
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
7
);
form
.
put
(
"client_id"
,
config
.
getClientId
());
form
.
put
(
"client_secret"
,
config
.
getClientSecret
());
form
.
put
(
"refresh_token"
,
authToken
.
getRefreshToken
());
...
...
src/main/java/me/zhyd/oauth/request/AuthJdRequest.java
浏览文件 @
13514d6a
...
...
@@ -41,7 +41,7 @@ public class AuthJdRequest extends AuthDefaultRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
Map
<
String
,
String
>
params
=
new
HashMap
<>(
5
);
Map
<
String
,
String
>
params
=
new
HashMap
<>(
7
);
params
.
put
(
"app_key"
,
config
.
getClientId
());
params
.
put
(
"app_secret"
,
config
.
getClientSecret
());
params
.
put
(
"grant_type"
,
"authorization_code"
);
...
...
@@ -104,7 +104,7 @@ public class AuthJdRequest extends AuthDefaultRequest {
@Override
public
AuthResponse
refresh
(
AuthToken
oldToken
)
{
Map
<
String
,
String
>
params
=
new
HashMap
<>(
5
);
Map
<
String
,
String
>
params
=
new
HashMap
<>(
7
);
params
.
put
(
"app_key"
,
config
.
getClientId
());
params
.
put
(
"app_secret"
,
config
.
getClientSecret
());
params
.
put
(
"grant_type"
,
"refresh_token"
);
...
...
src/main/java/me/zhyd/oauth/request/AuthMeituanRequest.java
浏览文件 @
13514d6a
...
...
@@ -35,7 +35,7 @@ public class AuthMeituanRequest extends AuthDefaultRequest {
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
4
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
7
);
form
.
put
(
"app_id"
,
config
.
getClientId
());
form
.
put
(
"secret"
,
config
.
getClientSecret
());
form
.
put
(
"code"
,
authCallback
.
getCode
());
...
...
@@ -55,7 +55,7 @@ public class AuthMeituanRequest extends AuthDefaultRequest {
@Override
protected
AuthUser
getUserInfo
(
AuthToken
authToken
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
3
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
5
);
form
.
put
(
"app_id"
,
config
.
getClientId
());
form
.
put
(
"secret"
,
config
.
getClientSecret
());
form
.
put
(
"access_token"
,
authToken
.
getAccessToken
());
...
...
@@ -79,7 +79,7 @@ public class AuthMeituanRequest extends AuthDefaultRequest {
@Override
public
AuthResponse
refresh
(
AuthToken
oldToken
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
4
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
7
);
form
.
put
(
"app_id"
,
config
.
getClientId
());
form
.
put
(
"secret"
,
config
.
getClientSecret
());
form
.
put
(
"refresh_token"
,
oldToken
.
getRefreshToken
());
...
...
src/main/java/me/zhyd/oauth/request/AuthTeambitionRequest.java
浏览文件 @
13514d6a
...
...
@@ -39,7 +39,7 @@ public class AuthTeambitionRequest extends AuthDefaultRequest {
*/
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
Map
<
String
,
String
>
form
=
new
HashMap
<>(
4
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
7
);
form
.
put
(
"client_id"
,
config
.
getClientId
());
form
.
put
(
"client_secret"
,
config
.
getClientSecret
());
form
.
put
(
"code"
,
authCallback
.
getCode
());
...
...
@@ -90,7 +90,7 @@ public class AuthTeambitionRequest extends AuthDefaultRequest {
String
uid
=
oldToken
.
getUid
();
String
refreshToken
=
oldToken
.
getRefreshToken
();
Map
<
String
,
String
>
form
=
new
HashMap
<>(
2
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
4
);
form
.
put
(
"_userId"
,
uid
);
form
.
put
(
"refresh_token"
,
refreshToken
);
String
response
=
new
HttpUtils
(
config
.
getHttpConfig
()).
post
(
source
.
refresh
(),
form
,
false
);
...
...
src/main/java/me/zhyd/oauth/request/AuthTwitterRequest.java
浏览文件 @
13514d6a
...
...
@@ -102,7 +102,7 @@ public class AuthTwitterRequest extends AuthDefaultRequest {
httpHeader
.
add
(
"Authorization"
,
header
);
httpHeader
.
add
(
Constants
.
CONTENT_TYPE
,
"application/x-www-form-urlencoded"
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
1
);
Map
<
String
,
String
>
form
=
new
HashMap
<>(
3
);
form
.
put
(
"oauth_verifier"
,
authCallback
.
getOauth_verifier
());
String
response
=
new
HttpUtils
(
config
.
getHttpConfig
()).
post
(
source
.
accessToken
(),
form
,
httpHeader
,
false
);
...
...
@@ -118,7 +118,7 @@ public class AuthTwitterRequest extends AuthDefaultRequest {
@Override
protected
AuthUser
getUserInfo
(
AuthToken
authToken
)
{
Map
<
String
,
String
>
queryParams
=
new
HashMap
<>();
Map
<
String
,
String
>
queryParams
=
new
HashMap
<>(
5
);
queryParams
.
put
(
"user_id"
,
authToken
.
getUserId
());
queryParams
.
put
(
"screen_name"
,
authToken
.
getScreenName
());
queryParams
.
put
(
"include_entities"
,
Boolean
.
toString
(
true
));
...
...
@@ -162,7 +162,7 @@ public class AuthTwitterRequest extends AuthDefaultRequest {
}
private
Map
<
String
,
String
>
buildOauthParams
()
{
Map
<
String
,
String
>
params
=
new
HashMap
<>(
5
);
Map
<
String
,
String
>
params
=
new
HashMap
<>(
12
);
params
.
put
(
"oauth_consumer_key"
,
config
.
getClientId
());
params
.
put
(
"oauth_nonce"
,
GlobalAuthUtils
.
generateNonce
(
32
));
params
.
put
(
"oauth_signature_method"
,
"HMAC-SHA1"
);
...
...
src/main/java/me/zhyd/oauth/request/AuthXmlyRequest.java
浏览文件 @
13514d6a
...
...
@@ -43,7 +43,7 @@ public class AuthXmlyRequest extends AuthDefaultRequest {
*/
@Override
protected
AuthToken
getAccessToken
(
AuthCallback
authCallback
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>(
6
);
Map
<
String
,
String
>
map
=
new
HashMap
<>(
9
);
map
.
put
(
"code"
,
authCallback
.
getCode
());
map
.
put
(
"client_id"
,
config
.
getClientId
());
map
.
put
(
"client_secret"
,
config
.
getClientSecret
());
...
...
src/main/java/me/zhyd/oauth/utils/GlobalAuthUtils.java
浏览文件 @
13514d6a
...
...
@@ -101,15 +101,18 @@ public class GlobalAuthUtils {
* @return map
*/
public
static
Map
<
String
,
String
>
parseStringToMap
(
String
accessTokenStr
)
{
Map
<
String
,
String
>
res
=
n
ew
HashMap
<>(
6
)
;
Map
<
String
,
String
>
res
=
n
ull
;
if
(
accessTokenStr
.
contains
(
"&"
))
{
String
[]
fields
=
accessTokenStr
.
split
(
"&"
);
res
=
new
HashMap
<>((
int
)
(
fields
.
length
/
0.75
+
1
));
for
(
String
field
:
fields
)
{
if
(
field
.
contains
(
"="
))
{
String
[]
keyValue
=
field
.
split
(
"="
);
res
.
put
(
GlobalAuthUtils
.
urlDecode
(
keyValue
[
0
]),
keyValue
.
length
==
2
?
GlobalAuthUtils
.
urlDecode
(
keyValue
[
1
])
:
null
);
}
}
}
else
{
res
=
new
HashMap
<>(
0
);
}
return
res
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录