Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sso
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
sso
Commits
c26c71f0
Commit
c26c71f0
authored
Aug 08, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
5b8f4703
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
10 deletions
+23
-10
NoTokenException.java
src/main/java/com/egolm/sso/oauth/NoTokenException.java
+0
-7
OAuthApi.java
src/main/java/com/egolm/sso/oauth/OAuthApi.java
+3
-3
OAuthTokenException.java
src/main/java/com/egolm/sso/oauth/OAuthTokenException.java
+20
-0
No files found.
src/main/java/com/egolm/sso/oauth/NoTokenException.java
deleted
100644 → 0
View file @
5b8f4703
package
com
.
egolm
.
sso
.
oauth
;
public
class
NoTokenException
extends
OAuthApiException
{
private
static
final
long
serialVersionUID
=
1L
;
}
src/main/java/com/egolm/sso/oauth/OAuthApi.java
View file @
c26c71f0
...
...
@@ -345,9 +345,9 @@ public interface OAuthApi {
* @param headers HTTP头信息
* @param data HTTP请求参数
* @return HTTP请求响应结果
* @throws
NoTokenException
* @throws
OAuthTokenException Token不存在(没有授权)时,抛出此异常
*/
default
String
doPost
(
String
url
,
Map
<
String
,
String
>
headers
,
JSONObject
data
)
throws
No
TokenException
{
default
String
doPost
(
String
url
,
Map
<
String
,
String
>
headers
,
JSONObject
data
)
throws
OAuth
TokenException
{
try
{
String
jsonData
=
data
==
null
?
""
:
data
.
toString
();
logger
.
debug
(
"oauth post url: "
+
url
);
...
...
@@ -355,7 +355,7 @@ public interface OAuthApi {
logger
.
debug
(
"oauth post data: "
+
jsonData
);
OAuthToken
token
=
this
.
getOAuthToken
();
if
(
token
==
null
)
{
throw
new
NoTokenException
(
);
throw
new
OAuthTokenException
(
"OAuthToken not found"
);
}
if
(
System
.
currentTimeMillis
()
-
token
.
getCreateMillis
()
>
((
token
.
getExpiresIn
()-
5
)
*
60
*
1000
))
{
token
=
this
.
refreshOAuthToken
();
...
...
src/main/java/com/egolm/sso/oauth/OAuthTokenException.java
0 → 100644
View file @
c26c71f0
package
com
.
egolm
.
sso
.
oauth
;
public
class
OAuthTokenException
extends
OAuthApiException
{
private
static
final
long
serialVersionUID
=
5506671150969428663L
;
public
OAuthTokenException
()
{
super
();
}
public
OAuthTokenException
(
String
message
,
Throwable
e
)
{
super
(
message
,
e
);
}
public
OAuthTokenException
(
String
message
)
{
super
(
message
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment