Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_48050326
JustAuth
提交
d6452240
J
JustAuth
项目概览
weixin_48050326
/
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,发现更多精彩内容 >>
提交
d6452240
编写于
7月 05, 2020
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🔥
优化代码
上级
272d1ac8
变更
41
隐藏空白更改
内联
并排
Showing
41 changed file
with
98 addition
and
391 deletion
+98
-391
src/main/java/me/zhyd/oauth/enums/scope/AuthBaiduScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthBaiduScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthCodingScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthCodingScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthFacebookScope.java
...ain/java/me/zhyd/oauth/enums/scope/AuthFacebookScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthGiteeScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthGiteeScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthGithubScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthGithubScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthGitlabScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthGitlabScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthGoogleScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthGoogleScope.java
+0
-15
src/main/java/me/zhyd/oauth/enums/scope/AuthHuaweiScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthHuaweiScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthJdScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthJdScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthKujialeScope.java
...main/java/me/zhyd/oauth/enums/scope/AuthKujialeScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthLinkedinScope.java
...ain/java/me/zhyd/oauth/enums/scope/AuthLinkedinScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthMiScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthMiScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthMicrosoftScope.java
...in/java/me/zhyd/oauth/enums/scope/AuthMicrosoftScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthPinterestScope.java
...in/java/me/zhyd/oauth/enums/scope/AuthPinterestScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthQqScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthQqScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthRenrenScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthRenrenScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthScope.java
+12
-0
src/main/java/me/zhyd/oauth/enums/scope/AuthStackoverflowScope.java
...ava/me/zhyd/oauth/enums/scope/AuthStackoverflowScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthWechatMpScope.java
...ain/java/me/zhyd/oauth/enums/scope/AuthWechatMpScope.java
+0
-19
src/main/java/me/zhyd/oauth/enums/scope/AuthWeiboScope.java
src/main/java/me/zhyd/oauth/enums/scope/AuthWeiboScope.java
+0
-19
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthDefaultRequest.java
src/main/java/me/zhyd/oauth/request/AuthDefaultRequest.java
+2
-7
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthGitlabRequest.java
src/main/java/me/zhyd/oauth/request/AuthGitlabRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthJdRequest.java
src/main/java/me/zhyd/oauth/request/AuthJdRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthKujialeRequest.java
src/main/java/me/zhyd/oauth/request/AuthKujialeRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
...main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthPinterestRequest.java
...main/java/me/zhyd/oauth/request/AuthPinterestRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
+2
-5
src/main/java/me/zhyd/oauth/request/AuthRenrenRequest.java
src/main/java/me/zhyd/oauth/request/AuthRenrenRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthStackOverflowRequest.java
.../java/me/zhyd/oauth/request/AuthStackOverflowRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthWeChatMpRequest.java
src/main/java/me/zhyd/oauth/request/AuthWeChatMpRequest.java
+2
-1
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
+2
-5
src/main/java/me/zhyd/oauth/utils/AuthScopeUtils.java
src/main/java/me/zhyd/oauth/utils/AuthScopeUtils.java
+46
-0
未找到文件。
src/main/java/me/zhyd/oauth/enums/scope/AuthBaiduScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 边度平台 OAuth 授权范围
*
...
...
@@ -32,18 +27,4 @@ public enum AuthBaiduScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthBaiduScope
[]
scopes
=
AuthBaiduScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthBaiduScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthBaiduScope
.
values
()).
map
(
AuthBaiduScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthCodingScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Coding平台 OAuth 授权范围
*
...
...
@@ -33,18 +28,4 @@ public enum AuthCodingScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthCodingScope
[]
scopes
=
AuthCodingScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthCodingScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthCodingScope
.
values
()).
map
(
AuthCodingScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthFacebookScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Facebook 平台 OAuth 授权范围
*
...
...
@@ -42,18 +37,4 @@ public enum AuthFacebookScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthFacebookScope
[]
scopes
=
AuthFacebookScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthFacebookScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthFacebookScope
.
values
()).
map
(
AuthFacebookScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthGiteeScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Gitee 平台 OAuth 授权范围
*
...
...
@@ -38,18 +33,4 @@ public enum AuthGiteeScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthGiteeScope
[]
scopes
=
AuthGiteeScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthGiteeScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthGiteeScope
.
values
()).
map
(
AuthGiteeScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthGithubScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 边度平台 OAuth 授权范围
*
...
...
@@ -56,18 +51,4 @@ public enum AuthGithubScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthGithubScope
[]
scopes
=
AuthGithubScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthGithubScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthGithubScope
.
values
()).
map
(
AuthGithubScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthGitlabScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Gitlab 平台 OAuth 授权范围
*
...
...
@@ -39,18 +34,4 @@ public enum AuthGitlabScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthGitlabScope
[]
scopes
=
AuthGitlabScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthGitlabScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthGitlabScope
.
values
()).
map
(
AuthGitlabScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthGoogleScope.java
浏览文件 @
d6452240
...
...
@@ -3,7 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -286,20 +285,6 @@ public enum AuthGoogleScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthGoogleScope
[]
scopes
=
AuthGoogleScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthGoogleScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthGoogleScope
.
values
()).
map
(
AuthGoogleScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
public
static
List
<
String
>
getAdminDirectoryScopes
()
{
return
Arrays
.
stream
(
new
AuthGoogleScope
[]{
...
...
src/main/java/me/zhyd/oauth/enums/scope/AuthHuaweiScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 华为平台 OAuth 授权范围
*
...
...
@@ -48,18 +43,4 @@ public enum AuthHuaweiScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthHuaweiScope
[]
scopes
=
AuthHuaweiScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthHuaweiScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthHuaweiScope
.
values
()).
map
(
AuthHuaweiScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthJdScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 京东平台 OAuth 授权范围
*
...
...
@@ -28,18 +23,4 @@ public enum AuthJdScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthJdScope
[]
scopes
=
AuthJdScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthJdScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthJdScope
.
values
()).
map
(
AuthJdScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthKujialeScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 酷家乐平台 OAuth 授权范围
*
...
...
@@ -30,18 +25,4 @@ public enum AuthKujialeScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthKujialeScope
[]
scopes
=
AuthKujialeScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthKujialeScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthKujialeScope
.
values
()).
map
(
AuthKujialeScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthLinkedinScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 领英平台 OAuth 授权范围
*
...
...
@@ -45,18 +40,4 @@ public enum AuthLinkedinScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthLinkedinScope
[]
scopes
=
AuthLinkedinScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthLinkedinScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthLinkedinScope
.
values
()).
map
(
AuthLinkedinScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthMiScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 小米平台 OAuth 授权范围
*
...
...
@@ -30,18 +25,4 @@ public enum AuthMiScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthMiScope
[]
scopes
=
AuthMiScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthMiScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthMiScope
.
values
()).
map
(
AuthMiScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthMicrosoftScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 微软平台 OAuth 授权范围
*
...
...
@@ -69,18 +64,4 @@ public enum AuthMicrosoftScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthMicrosoftScope
[]
scopes
=
AuthMicrosoftScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthMicrosoftScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthMicrosoftScope
.
values
()).
map
(
AuthMicrosoftScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthPinterestScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Pinterest 平台 OAuth 授权范围
*
...
...
@@ -32,18 +27,4 @@ public enum AuthPinterestScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthPinterestScope
[]
scopes
=
AuthPinterestScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthPinterestScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthPinterestScope
.
values
()).
map
(
AuthPinterestScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthQqScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* QQ 平台 OAuth 授权范围
*
...
...
@@ -37,18 +32,4 @@ public enum AuthQqScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthQqScope
[]
scopes
=
AuthQqScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthQqScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthQqScope
.
values
()).
map
(
AuthQqScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthRenrenScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 人人平台 OAuth 授权范围
*
...
...
@@ -57,18 +52,4 @@ public enum AuthRenrenScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthRenrenScope
[]
scopes
=
AuthRenrenScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthRenrenScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthRenrenScope
.
values
()).
map
(
AuthRenrenScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthScope.java
浏览文件 @
d6452240
...
...
@@ -9,5 +9,17 @@ package me.zhyd.oauth.enums.scope;
*/
public
interface
AuthScope
{
/**
* 获取字符串 {@code scope},对应为各平台实际使用的 {@code scope}
*
* @return String
*/
String
getScope
();
/**
* 判断当前 {@code scope} 是否为各平台默认启用的
*
* @return boolean
*/
boolean
isDefault
();
}
src/main/java/me/zhyd/oauth/enums/scope/AuthStackoverflowScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Stackoverflow 平台 OAuth 授权范围
*
...
...
@@ -31,18 +26,4 @@ public enum AuthStackoverflowScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthStackoverflowScope
[]
scopes
=
AuthStackoverflowScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthStackoverflowScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthStackoverflowScope
.
values
()).
map
(
AuthStackoverflowScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthWechatMpScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 微信公众平台 OAuth 授权范围
*
...
...
@@ -28,18 +23,4 @@ public enum AuthWechatMpScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthWechatMpScope
[]
scopes
=
AuthWechatMpScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthWechatMpScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthWechatMpScope
.
values
()).
map
(
AuthWechatMpScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/enums/scope/AuthWeiboScope.java
浏览文件 @
d6452240
...
...
@@ -3,11 +3,6 @@ package me.zhyd.oauth.enums.scope;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 微博平台 OAuth 授权范围
*
...
...
@@ -36,18 +31,4 @@ public enum AuthWeiboScope implements AuthScope {
private
String
description
;
private
boolean
isDefault
;
public
static
List
<
AuthScope
>
getDefaultScopes
()
{
AuthWeiboScope
[]
scopes
=
AuthWeiboScope
.
values
();
List
<
AuthScope
>
defaultScopes
=
new
ArrayList
<>();
for
(
AuthWeiboScope
scope
:
scopes
)
{
if
(
scope
.
isDefault
())
{
defaultScopes
.
add
(
scope
);
}
}
return
defaultScopes
;
}
public
static
List
<
String
>
listScope
()
{
return
Arrays
.
stream
(
AuthWeiboScope
.
values
()).
map
(
AuthWeiboScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
浏览文件 @
d6452240
...
...
@@ -12,6 +12,7 @@ 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.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -105,7 +106,7 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"display"
,
"popup"
)
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
BaiduScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthBaiduScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java
浏览文件 @
d6452240
...
...
@@ -10,6 +10,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
/**
...
...
@@ -88,7 +89,7 @@ public class AuthCodingRequest extends AuthDefaultRequest {
.
queryParam
(
"response_type"
,
"code"
)
.
queryParam
(
"client_id"
,
config
.
getClientId
())
.
queryParam
(
"redirect_uri"
,
config
.
getRedirectUri
())
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
CodingScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthCodingScope
.
values
()
)))
.
queryParam
(
"state"
,
getRealState
(
state
))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthDefaultRequest.java
浏览文件 @
d6452240
...
...
@@ -6,7 +6,6 @@ import me.zhyd.oauth.cache.AuthStateCache;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.config.AuthSource
;
import
me.zhyd.oauth.enums.AuthResponseStatus
;
import
me.zhyd.oauth.enums.scope.AuthScope
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.log.Log
;
import
me.zhyd.oauth.model.AuthCallback
;
...
...
@@ -15,7 +14,6 @@ import me.zhyd.oauth.model.AuthToken;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.*
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -277,16 +275,13 @@ public abstract class AuthDefaultRequest implements AuthRequest {
* @return String
* @since 1.16.7
*/
protected
String
getScopes
(
String
separator
,
boolean
encode
,
List
<
AuthScope
>
defaultScopes
)
{
protected
String
getScopes
(
String
separator
,
boolean
encode
,
List
<
String
>
defaultScopes
)
{
List
<
String
>
scopes
=
config
.
getScopes
();
if
(
null
==
scopes
||
scopes
.
isEmpty
())
{
if
(
null
==
defaultScopes
||
defaultScopes
.
isEmpty
())
{
return
""
;
}
scopes
=
new
ArrayList
<>();
for
(
AuthScope
defaultScope
:
defaultScopes
)
{
scopes
.
add
(
defaultScope
.
getScope
());
}
scopes
=
defaultScopes
;
}
if
(
null
==
separator
)
{
// 默认为空格
...
...
src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java
浏览文件 @
d6452240
...
...
@@ -10,6 +10,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
/**
...
...
@@ -106,7 +107,7 @@ public class AuthFacebookRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
FacebookScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthFacebookScope
.
values
()
)))
.
build
();
}
}
src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java
浏览文件 @
d6452240
...
...
@@ -10,6 +10,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
/**
...
...
@@ -84,7 +85,7 @@ public class AuthGiteeRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
GiteeScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthGiteeScope
.
values
()
)))
.
build
();
}
}
src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java
浏览文件 @
d6452240
...
...
@@ -10,6 +10,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.GlobalAuthUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -84,7 +85,7 @@ public class AuthGithubRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
GithubScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthGithubScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthGitlabRequest.java
浏览文件 @
d6452240
...
...
@@ -10,6 +10,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
/**
...
...
@@ -89,7 +90,7 @@ public class AuthGitlabRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
"+"
,
false
,
Auth
GitlabScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
"+"
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthGitlabScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java
浏览文件 @
d6452240
...
...
@@ -11,6 +11,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -76,7 +77,7 @@ public class AuthGoogleRequest extends AuthDefaultRequest {
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"access_type"
,
"offline"
)
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
false
,
Auth
GoogleScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthGoogleScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
浏览文件 @
d6452240
...
...
@@ -11,6 +11,7 @@ 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.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -132,7 +133,7 @@ public class AuthHuaweiRequest extends AuthDefaultRequest {
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"access_type"
,
"offline"
)
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
HuaweiScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthHuaweiScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthJdRequest.java
浏览文件 @
d6452240
...
...
@@ -12,6 +12,7 @@ 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.AuthScopeUtils
;
import
me.zhyd.oauth.utils.GlobalAuthUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -137,7 +138,7 @@ public class AuthJdRequest extends AuthDefaultRequest {
.
queryParam
(
"app_key"
,
config
.
getClientId
())
.
queryParam
(
"response_type"
,
"code"
)
.
queryParam
(
"redirect_uri"
,
config
.
getRedirectUri
())
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
JdScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthJdScope
.
values
()
)))
.
queryParam
(
"state"
,
getRealState
(
state
))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthKujialeRequest.java
浏览文件 @
d6452240
...
...
@@ -11,6 +11,7 @@ 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.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -41,7 +42,7 @@ public class AuthKujialeRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
KujialeScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthKujialeScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
浏览文件 @
d6452240
...
...
@@ -14,6 +14,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -199,7 +200,7 @@ public class AuthLinkedinRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
false
,
Auth
LinkedinScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthLinkedinScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
浏览文件 @
d6452240
...
...
@@ -14,6 +14,7 @@ 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.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -127,7 +128,7 @@ public class AuthMiRequest extends AuthDefaultRequest {
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"skip_confirm"
,
"false"
)
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
MiScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthMiScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
浏览文件 @
d6452240
...
...
@@ -14,6 +14,7 @@ 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.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -125,7 +126,7 @@ public class AuthMicrosoftRequest extends AuthDefaultRequest {
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"response_mode"
,
"query"
)
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
MicrosoftScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
" "
,
true
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthMicrosoftScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthPinterestRequest.java
浏览文件 @
d6452240
...
...
@@ -9,6 +9,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -85,7 +86,7 @@ public class AuthPinterestRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
PinterestScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthPinterestScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthQqRequest.java
浏览文件 @
d6452240
...
...
@@ -12,10 +12,7 @@ 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.GlobalAuthUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.*
;
import
java.util.Map
;
...
...
@@ -130,7 +127,7 @@ public class AuthQqRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
QqScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthQqScope
.
values
()
)))
.
build
();
}
}
src/main/java/me/zhyd/oauth/request/AuthRenrenRequest.java
浏览文件 @
d6452240
...
...
@@ -12,6 +12,7 @@ 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.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -123,7 +124,7 @@ public class AuthRenrenRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
RenrenScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthRenrenScope
.
values
()
)))
.
build
();
}
}
src/main/java/me/zhyd/oauth/request/AuthStackOverflowRequest.java
浏览文件 @
d6452240
...
...
@@ -12,6 +12,7 @@ import me.zhyd.oauth.exception.AuthException;
import
me.zhyd.oauth.model.AuthCallback
;
import
me.zhyd.oauth.model.AuthToken
;
import
me.zhyd.oauth.model.AuthUser
;
import
me.zhyd.oauth.utils.AuthScopeUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -87,7 +88,7 @@ public class AuthStackOverflowRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
AuthS
tackoverflowScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
AuthS
copeUtils
.
getDefaultScopes
(
AuthStackoverflowScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthWeChatMpRequest.java
浏览文件 @
d6452240
...
...
@@ -12,6 +12,7 @@ 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.AuthScopeUtils
;
import
me.zhyd.oauth.utils.GlobalAuthUtils
;
import
me.zhyd.oauth.utils.HttpUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
...
...
@@ -124,7 +125,7 @@ public class AuthWeChatMpRequest extends AuthDefaultRequest {
.
queryParam
(
"redirect_uri"
,
GlobalAuthUtils
.
urlEncode
(
config
.
getRedirectUri
()))
.
queryParam
(
"response_type"
,
"code"
)
.
queryParam
(
"state"
,
getRealState
(
state
).
concat
(
"#wechat_redirect"
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
WechatMpScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthWechatMpScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java
浏览文件 @
d6452240
...
...
@@ -13,10 +13,7 @@ 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.HttpUtils
;
import
me.zhyd.oauth.utils.IpUtils
;
import
me.zhyd.oauth.utils.StringUtils
;
import
me.zhyd.oauth.utils.UrlBuilder
;
import
me.zhyd.oauth.utils.*
;
/**
...
...
@@ -97,7 +94,7 @@ public class AuthWeiboRequest extends AuthDefaultRequest {
@Override
public
String
authorize
(
String
state
)
{
return
UrlBuilder
.
fromBaseUrl
(
super
.
authorize
(
state
))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
WeiboScope
.
getDefaultScopes
(
)))
.
queryParam
(
"scope"
,
this
.
getScopes
(
","
,
false
,
Auth
ScopeUtils
.
getDefaultScopes
(
AuthWeiboScope
.
values
()
)))
.
build
();
}
...
...
src/main/java/me/zhyd/oauth/utils/AuthScopeUtils.java
0 → 100644
浏览文件 @
d6452240
package
me.zhyd.oauth.utils
;
import
me.zhyd.oauth.enums.scope.AuthScope
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* Scope 工具类,提供对 scope 类的统一操作
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0.0
* @since 1.15.7
*/
public
class
AuthScopeUtils
{
/**
* 获取 {@link me.zhyd.oauth.enums.scope.AuthScope} 数组中所有的被标记为 {@code default} 的 scope
*
* @param scopes scopes
* @return List
*/
public
static
List
<
String
>
getDefaultScopes
(
AuthScope
[]
scopes
)
{
if
(
null
==
scopes
||
scopes
.
length
==
0
)
{
return
null
;
}
return
Arrays
.
stream
(
scopes
)
.
filter
((
AuthScope:
:
isDefault
))
.
map
(
AuthScope:
:
getScope
)
.
collect
(
Collectors
.
toList
());
}
/**
* 从 {@link me.zhyd.oauth.enums.scope.AuthScope} 数组中获取实际的 scope 字符串
*
* @param scopes 可变参数,支持传任意 {@link me.zhyd.oauth.enums.scope.AuthScope}
* @return List
*/
public
static
List
<
String
>
getScopes
(
AuthScope
...
scopes
)
{
if
(
null
==
scopes
||
scopes
.
length
==
0
)
{
return
null
;
}
return
Arrays
.
stream
(
scopes
).
map
(
AuthScope:
:
getScope
).
collect
(
Collectors
.
toList
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录