Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
My_csdo
JustAuth
提交
84b59149
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看板
提交
84b59149
编写于
2月 24, 2019
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
👽
更新代码
上级
579c6ece
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
320 addition
and
180 deletion
+320
-180
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
+288
-0
src/main/java/me/zhyd/oauth/consts/ApiUrlConst.java
src/main/java/me/zhyd/oauth/consts/ApiUrlConst.java
+0
-149
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
+1
-1
src/main/java/me/zhyd/oauth/request/ResponseStatus.java
src/main/java/me/zhyd/oauth/request/ResponseStatus.java
+3
-2
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
+28
-28
未找到文件。
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
0 → 100644
浏览文件 @
84b59149
package
me.zhyd.oauth.consts
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.request.ResponseStatus
;
/**
* 各api需要的url, 用枚举类分平台类型管理
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @date 2019/2/24 21:20
* @since 1.0
*/
public
enum
ApiUrl
{
/**
* Github
*/
GITHUB
{
@Override
public
String
authorize
()
{
return
"https://github.com/login/oauth/authorize"
;
}
@Override
public
String
accessToken
()
{
return
"https://github.com/login/oauth/access_token"
;
}
@Override
public
String
userInfo
()
{
return
"https://api.github.com/user"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
},
/**
* 新浪微博
*/
WEIBO
{
@Override
public
String
authorize
()
{
return
"https://api.weibo.com/oauth2/authorize"
;
}
@Override
public
String
accessToken
()
{
return
"https://api.weibo.com/oauth2/access_token"
;
}
@Override
public
String
userInfo
()
{
return
"https://api.weibo.com/2/users/show.json"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
},
/**
* gitee
*/
GITEE
{
@Override
public
String
authorize
()
{
return
"https://gitee.com/oauth/authorize"
;
}
@Override
public
String
accessToken
()
{
return
"https://gitee.com/oauth/token"
;
}
@Override
public
String
userInfo
()
{
return
"https://gitee.com/api/v5/user"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
},
/**
* 钉钉
*/
DINGTALK
{
@Override
public
String
authorize
()
{
return
"https://oapi.dingtalk.com/connect/qrconnect"
;
}
@Override
public
String
accessToken
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
userInfo
()
{
return
"https://oapi.dingtalk.com/sns/getuserinfo_bycode"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
},
/**
* 百度
*/
BAIDU
{
@Override
public
String
authorize
()
{
return
"https://openapi.baidu.com/oauth/2.0/authorize"
;
}
@Override
public
String
accessToken
()
{
return
"https://openapi.baidu.com/oauth/2.0/token"
;
}
@Override
public
String
userInfo
()
{
return
"https://openapi.baidu.com/rest/2.0/passport/users/getInfo"
;
}
@Override
public
String
revoke
()
{
return
"https://openapi.baidu.com/rest/2.0/passport/auth/revokeAuthorization"
;
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
},
/**
* csdn
*/
CSDN
{
@Override
public
String
authorize
()
{
return
"https://api.csdn.net/oauth2/authorize"
;
}
@Override
public
String
accessToken
()
{
return
"https://api.csdn.net/oauth2/access_token"
;
}
@Override
public
String
userInfo
()
{
return
"https://api.csdn.net/user/getinfo"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
},
/**
* Coding
*/
CODING
{
@Override
public
String
authorize
()
{
return
"https://coding.net/oauth_authorize.html"
;
}
@Override
public
String
accessToken
()
{
return
"https://coding.net/api/oauth/access_token"
;
}
@Override
public
String
userInfo
()
{
return
"https://coding.net/api/account/current_user"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
},
/**
* 腾讯云开发者平台(coding升级后就变成腾讯云开发者平台了)
*/
TENCENTCLOUD
{
@Override
public
String
authorize
()
{
return
"https://dev.tencent.com/oauth_authorize.html"
;
}
@Override
public
String
accessToken
()
{
return
"https://dev.tencent.com/api/oauth/access_token"
;
}
@Override
public
String
userInfo
()
{
return
"https://dev.tencent.com/api/account/current_user"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
},
/**
* oschina 开源中国
*/
OSCHINA
{
@Override
public
String
authorize
()
{
return
"https://www.oschina.net/action/oauth2/authorize"
;
}
@Override
public
String
accessToken
()
{
return
"https://www.oschina.net/action/openapi/token"
;
}
@Override
public
String
userInfo
()
{
return
"https://www.oschina.net/action/openapi/user"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
};
public
abstract
String
authorize
();
public
abstract
String
accessToken
();
public
abstract
String
userInfo
();
public
abstract
String
revoke
();
public
abstract
String
refresh
();
}
src/main/java/me/zhyd/oauth/consts/ApiUrlConst.java
已删除
100644 → 0
浏览文件 @
579c6ece
package
me.zhyd.oauth.consts
;
/**
* 各api需要的url常量类
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @website https://www.zhyd.me
* @date 2019/1/31 12:26
* @since 1.0
*/
public
class
ApiUrlConst
{
/**
* 获取github access_token的地址
*/
public
static
final
String
GITHUB_ACCESS_TOKEN_URL
=
"https://github.com/login/oauth/access_token"
;
/**
* 获取github用户信息的地址
*/
public
static
final
String
GITHUB_USER_INFO_URL
=
"https://api.github.com/user"
;
/**
* 获取github授权地址
*/
public
static
final
String
GITHUB_AUTHORIZE_URL
=
"https://github.com/login/oauth/authorize"
;
/**
* 获取weibo access_token的地址
*/
public
static
final
String
WEIBO_ACCESS_TOKEN_URL
=
"https://api.weibo.com/oauth2/access_token"
;
/**
* 获取weibo用户信息的地址
*/
public
static
final
String
WEIBO_USER_INFO_URL
=
"https://api.weibo.com/2/users/show.json"
;
/**
* 获取weibo授权地址
*/
public
static
final
String
WEIBO_AUTHORIZE_URL
=
"https://api.weibo.com/oauth2/authorize"
;
/**
* 获取gitee access_token的地址
*/
public
static
final
String
GITEE_ACCESS_TOKEN_URL
=
"https://gitee.com/oauth/token"
;
/**
* 获取gitee用户信息的地址
*/
public
static
final
String
GITEE_USER_INFO_URL
=
"https://gitee.com/api/v5/user"
;
/**
* 获取gitee授权地址
*/
public
static
final
String
GITEE_AUTHORIZE_URL
=
"https://gitee.com/oauth/authorize"
;
/**
* 获取钉钉登录二维码的地址
*/
public
static
final
String
DING_TALK_QRCONNECT_URL
=
"https://oapi.dingtalk.com/connect/qrconnect"
;
/**
* 获取钉钉用户信息的地址
*/
public
static
final
String
DING_TALK_USER_INFO_URL
=
"https://oapi.dingtalk.com/sns/getuserinfo_bycode"
;
/**
* 获取baidu access_token的地址
*/
public
static
final
String
BAIDU_ACCESS_TOKEN_URL
=
"https://openapi.baidu.com/oauth/2.0/token"
;
/**
* 获取baidu用户信息的地址
*/
public
static
final
String
BAIDU_USER_INFO_URL
=
"https://openapi.baidu.com/rest/2.0/passport/users/getInfo"
;
/**
* 获取baidu授权地址
*/
public
static
final
String
BAIDU_AUTHORIZE_URL
=
"https://openapi.baidu.com/oauth/2.0/authorize"
;
/**
* 收回baidu授权的地址
*/
public
static
final
String
BAIDU_REVOKE_URL
=
"https://openapi.baidu.com/rest/2.0/passport/auth/revokeAuthorization"
;
/**
* 获取csdn access_token的地址
*/
public
static
final
String
CSDN_ACCESS_TOKEN_URL
=
"https://api.csdn.net/oauth2/access_token"
;
/**
* 获取csdn用户信息的地址
*/
public
static
final
String
CSDN_USER_INFO_URL
=
"https://api.csdn.net/user/getinfo"
;
/**
* 获取csdn授权地址
*/
public
static
final
String
CSDN_AUTHORIZE_URL
=
"https://api.csdn.net/oauth2/authorize"
;
/**
* 获取coding access_token的地址
*/
public
static
final
String
CODING_ACCESS_TOKEN_URL
=
"https://coding.net/api/oauth/access_token"
;
/**
* 获取coding用户信息的地址
*/
public
static
final
String
CODING_USER_INFO_URL
=
"https://coding.net/api/account/current_user"
;
/**
* 获取coding授权地址
*/
public
static
final
String
CODING_AUTHORIZE_URL
=
"https://coding.net/oauth_authorize.html"
;
/**
* 获取腾讯云开发者平台 access_token的地址(coding升级后就变成腾讯云开发者平台了)
*/
public
static
final
String
TENCENT_ACCESS_TOKEN_URL
=
"https://dev.tencent.com/api/oauth/access_token"
;
/**
* 获取腾讯云开发者平台用户信息的地址(coding升级后就变成腾讯云开发者平台了)
*/
public
static
final
String
TENCENT_USER_INFO_URL
=
"https://dev.tencent.com/api/account/current_user"
;
/**
* 获取腾讯云开发者平台授权地址(coding升级后就变成腾讯云开发者平台了)
*/
public
static
final
String
TENCENT_AUTHORIZE_URL
=
"https://dev.tencent.com/oauth_authorize.html"
;
/**
* 获取oschina access_token的地址
*/
public
static
final
String
OSCHINA_ACCESS_TOKEN_URL
=
"https://www.oschina.net/action/openapi/token"
;
/**
* 获取oschina用户信息的地址
*/
public
static
final
String
OSCHINA_USER_INFO_URL
=
"https://www.oschina.net/action/openapi/user"
;
/**
* 获取oschina授权地址
*/
public
static
final
String
OSCHINA_AUTHORIZE_URL
=
"https://www.oschina.net/action/oauth2/authorize"
;
}
src/main/java/me/zhyd/oauth/request/BaseAuthRequest.java
浏览文件 @
84b59149
...
...
@@ -28,7 +28,7 @@ public abstract class BaseAuthRequest implements AuthRequest {
this
.
config
=
config
;
this
.
source
=
source
;
if
(!
AuthConfigChecker
.
isSupportedAuth
(
config
))
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
throw
new
AuthException
(
ResponseStatus
.
PARAMETER_INCOMPLETE
);
}
}
...
...
src/main/java/me/zhyd/oauth/request/ResponseStatus.java
浏览文件 @
84b59149
...
...
@@ -9,9 +9,10 @@ package me.zhyd.oauth.request;
*/
public
enum
ResponseStatus
{
SUCCESS
(
2000
,
"Success"
),
FAILURE
(
5000
,
"
Authentication f
ailure"
),
FAILURE
(
5000
,
"
F
ailure"
),
NOT_IMPLEMENTED
(
5001
,
"Not Implemented"
),
UNSUPPORTED
(
5002
,
"Unsupported authentication, please check the configuration."
),
PARAMETER_INCOMPLETE
(
5002
,
"Parameter incomplete"
),
UNSUPPORTED
(
5003
,
"Unsupported operation"
),
;
private
int
code
;
...
...
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
浏览文件 @
84b59149
package
me.zhyd.oauth.utils
;
import
me.zhyd.oauth.consts.ApiUrl
Const
;
import
me.zhyd.oauth.consts.ApiUrl
;
import
java.text.MessageFormat
;
...
...
@@ -61,7 +61,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getGithubAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
,
String
redirectUri
)
{
return
MessageFormat
.
format
(
GITHUB_ACCESS_TOKEN_PATTERN
,
ApiUrl
Const
.
GITHUB_ACCESS_TOKEN_URL
,
clientId
,
clientSecret
,
code
,
redirectUri
);
return
MessageFormat
.
format
(
GITHUB_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
GITHUB
.
accessToken
()
,
clientId
,
clientSecret
,
code
,
redirectUri
);
}
/**
...
...
@@ -71,7 +71,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getGithubUserInfoUrl
(
String
token
)
{
return
MessageFormat
.
format
(
GITHUB_USER_INFO_PATTERN
,
ApiUrl
Const
.
GITHUB_USER_INFO_URL
,
token
);
return
MessageFormat
.
format
(
GITHUB_USER_INFO_PATTERN
,
ApiUrl
.
GITHUB
.
userInfo
()
,
token
);
}
/**
...
...
@@ -82,7 +82,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getGithubAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
GITHUB_AUTHORIZE_PATTERN
,
ApiUrl
Const
.
GITHUB_AUTHORIZE_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
GITHUB_AUTHORIZE_PATTERN
,
ApiUrl
.
GITHUB
.
authorize
()
,
clientId
,
redirectUrl
);
}
/**
...
...
@@ -95,7 +95,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getWeiboAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
,
String
redirectUri
)
{
return
MessageFormat
.
format
(
WEIBO_ACCESS_TOKEN_PATTERN
,
ApiUrl
Const
.
WEIBO_ACCESS_TOKEN_URL
,
clientId
,
clientSecret
,
code
,
redirectUri
);
return
MessageFormat
.
format
(
WEIBO_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
WEIBO
.
accessToken
()
,
clientId
,
clientSecret
,
code
,
redirectUri
);
}
/**
...
...
@@ -105,7 +105,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getWeiboUserInfoUrl
(
String
token
)
{
return
MessageFormat
.
format
(
WEIBO_USER_INFO_PATTERN
,
ApiUrl
Const
.
WEIBO_USER_INFO_URL
,
token
);
return
MessageFormat
.
format
(
WEIBO_USER_INFO_PATTERN
,
ApiUrl
.
WEIBO
.
userInfo
()
,
token
);
}
/**
...
...
@@ -116,7 +116,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getWeiboAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
WEIBO_AUTHORIZE_PATTERN
,
ApiUrl
Const
.
WEIBO_AUTHORIZE_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
WEIBO_AUTHORIZE_PATTERN
,
ApiUrl
.
WEIBO
.
authorize
()
,
clientId
,
redirectUrl
);
}
/**
...
...
@@ -129,7 +129,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getGiteeAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
,
String
redirectUri
)
{
return
MessageFormat
.
format
(
GITEE_ACCESS_TOKEN_PATTERN
,
ApiUrl
Const
.
GITEE_ACCESS_TOKEN_URL
,
clientId
,
clientSecret
,
code
,
redirectUri
);
return
MessageFormat
.
format
(
GITEE_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
GITEE
.
accessToken
()
,
clientId
,
clientSecret
,
code
,
redirectUri
);
}
/**
...
...
@@ -139,7 +139,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getGiteeUserInfoUrl
(
String
token
)
{
return
MessageFormat
.
format
(
GITEE_USER_INFO_PATTERN
,
ApiUrl
Const
.
GITEE_USER_INFO_URL
,
token
);
return
MessageFormat
.
format
(
GITEE_USER_INFO_PATTERN
,
ApiUrl
.
GITEE
.
userInfo
()
,
token
);
}
/**
...
...
@@ -150,7 +150,7 @@ public class UrlBuilder {
* @return json
*/
public
static
String
getGiteeAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
GITEE_AUTHORIZE_PATTERN
,
ApiUrl
Const
.
GITEE_AUTHORIZE_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
GITEE_AUTHORIZE_PATTERN
,
ApiUrl
.
GITEE
.
authorize
()
,
clientId
,
redirectUrl
);
}
/**
...
...
@@ -161,7 +161,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getDingTalkQrConnectUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
DING_TALK_QRCONNECT_PATTERN
,
ApiUrl
Const
.
DING_TALK_QRCONNECT_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
DING_TALK_QRCONNECT_PATTERN
,
ApiUrl
.
DINGTALK
.
authorize
()
,
clientId
,
redirectUrl
);
}
/**
...
...
@@ -173,7 +173,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getDingTalkUserInfoUrl
(
String
signature
,
String
timestamp
,
String
accessKey
)
{
return
MessageFormat
.
format
(
DING_TALK_USER_INFO_PATTERN
,
ApiUrl
Const
.
DING_TALK_USER_INFO_URL
,
signature
,
timestamp
,
accessKey
);
return
MessageFormat
.
format
(
DING_TALK_USER_INFO_PATTERN
,
ApiUrl
.
DINGTALK
.
userInfo
()
,
signature
,
timestamp
,
accessKey
);
}
/**
...
...
@@ -186,7 +186,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getBaiduAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
,
String
redirectUri
)
{
return
MessageFormat
.
format
(
BAIDU_ACCESS_TOKEN_PATTERN
,
ApiUrl
Const
.
BAIDU_ACCESS_TOKEN_URL
,
clientId
,
clientSecret
,
code
,
redirectUri
);
return
MessageFormat
.
format
(
BAIDU_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
BAIDU
.
accessToken
()
,
clientId
,
clientSecret
,
code
,
redirectUri
);
}
/**
...
...
@@ -196,7 +196,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getBaiduUserInfoUrl
(
String
token
)
{
return
MessageFormat
.
format
(
BAIDU_USER_INFO_PATTERN
,
ApiUrl
Const
.
BAIDU_USER_INFO_URL
,
token
);
return
MessageFormat
.
format
(
BAIDU_USER_INFO_PATTERN
,
ApiUrl
.
BAIDU
.
userInfo
()
,
token
);
}
/**
...
...
@@ -207,7 +207,7 @@ public class UrlBuilder {
* @return json
*/
public
static
String
getBaiduAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
BAIDU_AUTHORIZE_PATTERN
,
ApiUrl
Const
.
BAIDU_AUTHORIZE_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
BAIDU_AUTHORIZE_PATTERN
,
ApiUrl
.
BAIDU
.
authorize
()
,
clientId
,
redirectUrl
);
}
/**
...
...
@@ -217,7 +217,7 @@ public class UrlBuilder {
* @return json
*/
public
static
String
getBaiduRevokeUrl
(
String
accessToken
)
{
return
MessageFormat
.
format
(
BAIDU_REVOKE_PATTERN
,
ApiUrl
Const
.
BAIDU_REVOKE_URL
,
accessToken
);
return
MessageFormat
.
format
(
BAIDU_REVOKE_PATTERN
,
ApiUrl
.
BAIDU
.
revoke
()
,
accessToken
);
}
/**
...
...
@@ -230,7 +230,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getCsdnAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
,
String
redirectUri
)
{
return
MessageFormat
.
format
(
CSDN_ACCESS_TOKEN_PATTERN
,
ApiUrl
Const
.
CSDN_ACCESS_TOKEN_URL
,
clientId
,
clientSecret
,
code
,
redirectUri
);
return
MessageFormat
.
format
(
CSDN_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
CSDN
.
accessToken
()
,
clientId
,
clientSecret
,
code
,
redirectUri
);
}
/**
...
...
@@ -240,7 +240,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getCsdnUserInfoUrl
(
String
token
)
{
return
MessageFormat
.
format
(
CSDN_USER_INFO_PATTERN
,
ApiUrl
Const
.
CSDN_USER_INFO_URL
,
token
);
return
MessageFormat
.
format
(
CSDN_USER_INFO_PATTERN
,
ApiUrl
.
CSDN
.
userInfo
()
,
token
);
}
/**
...
...
@@ -251,7 +251,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getCsdnAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
CSDN_AUTHORIZE_PATTERN
,
ApiUrl
Const
.
CSDN_AUTHORIZE_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
CSDN_AUTHORIZE_PATTERN
,
ApiUrl
.
CSDN
.
authorize
()
,
clientId
,
redirectUrl
);
}
/**
...
...
@@ -263,7 +263,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getCodingAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
)
{
return
MessageFormat
.
format
(
CODING_ACCESS_TOKEN_PATTERN
,
ApiUrl
Const
.
CODING_ACCESS_TOKEN_URL
,
clientId
,
clientSecret
,
code
);
return
MessageFormat
.
format
(
CODING_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
CODING
.
accessToken
()
,
clientId
,
clientSecret
,
code
);
}
/**
...
...
@@ -273,7 +273,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getCodingUserInfoUrl
(
String
token
)
{
return
MessageFormat
.
format
(
CODING_USER_INFO_PATTERN
,
ApiUrl
Const
.
CODING_USER_INFO_URL
,
token
);
return
MessageFormat
.
format
(
CODING_USER_INFO_PATTERN
,
ApiUrl
.
CODING
.
userInfo
()
,
token
);
}
/**
...
...
@@ -284,7 +284,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getCodingAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
CODING_AUTHORIZE_PATTERN
,
ApiUrl
Const
.
CODING_AUTHORIZE_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
CODING_AUTHORIZE_PATTERN
,
ApiUrl
.
CODING
.
authorize
()
,
clientId
,
redirectUrl
);
}
/**
...
...
@@ -296,7 +296,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getTencentCloudAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
)
{
return
MessageFormat
.
format
(
TENCENT_ACCESS_TOKEN_PATTERN
,
ApiUrl
Const
.
TENCENT_ACCESS_TOKEN_URL
,
clientId
,
clientSecret
,
code
);
return
MessageFormat
.
format
(
TENCENT_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
TENCENTCLOUD
.
accessToken
()
,
clientId
,
clientSecret
,
code
);
}
/**
...
...
@@ -306,7 +306,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getTencentCloudUserInfoUrl
(
String
token
)
{
return
MessageFormat
.
format
(
TENCENT_USER_INFO_PATTERN
,
ApiUrl
Const
.
TENCENT_USER_INFO_URL
,
token
);
return
MessageFormat
.
format
(
TENCENT_USER_INFO_PATTERN
,
ApiUrl
.
TENCENTCLOUD
.
userInfo
()
,
token
);
}
/**
...
...
@@ -317,7 +317,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getTencentCloudAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
TENCENT_AUTHORIZE_PATTERN
,
ApiUrl
Const
.
TENCENT_AUTHORIZE_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
TENCENT_AUTHORIZE_PATTERN
,
ApiUrl
.
TENCENTCLOUD
.
authorize
()
,
clientId
,
redirectUrl
);
}
/**
...
...
@@ -330,7 +330,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getOschinaAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
,
String
redirectUri
)
{
return
MessageFormat
.
format
(
OSCHINA_ACCESS_TOKEN_PATTERN
,
ApiUrl
Const
.
OSCHINA_ACCESS_TOKEN_URL
,
clientId
,
clientSecret
,
code
,
redirectUri
);
return
MessageFormat
.
format
(
OSCHINA_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
OSCHINA
.
accessToken
()
,
clientId
,
clientSecret
,
code
,
redirectUri
);
}
/**
...
...
@@ -340,7 +340,7 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getOschinaUserInfoUrl
(
String
token
)
{
return
MessageFormat
.
format
(
OSCHINA_USER_INFO_PATTERN
,
ApiUrl
Const
.
OSCHINA_USER_INFO_URL
,
token
);
return
MessageFormat
.
format
(
OSCHINA_USER_INFO_PATTERN
,
ApiUrl
.
OSCHINA
.
userInfo
()
,
token
);
}
/**
...
...
@@ -351,6 +351,6 @@ public class UrlBuilder {
* @return full url
*/
public
static
String
getOschinaAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
OSCHINA_AUTHORIZE_PATTERN
,
ApiUrl
Const
.
OSCHINA_AUTHORIZE_URL
,
clientId
,
redirectUrl
);
return
MessageFormat
.
format
(
OSCHINA_AUTHORIZE_PATTERN
,
ApiUrl
.
OSCHINA
.
authorize
()
,
clientId
,
redirectUrl
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录