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
ee2c6dbb
Commit
ee2c6dbb
authored
Jul 24, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
53ab7f56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
pom.xml
pom.xml
+5
-0
OAuthToken.java
src/main/java/com/egolm/sso/api/OAuthToken.java
+36
-0
No files found.
pom.xml
View file @
ee2c6dbb
...
...
@@ -18,6 +18,11 @@
<artifactId>
org.apache.oltu.oauth2.client
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.38
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
src/main/java/com/egolm/sso/api/OAuthToken.java
View file @
ee2c6dbb
...
...
@@ -2,6 +2,11 @@ package com.egolm.sso.api;
import
java.io.Serializable
;
import
org.apache.axis.encoding.Base64
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
public
class
OAuthToken
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
73234152183180980L
;
...
...
@@ -11,6 +16,9 @@ public class OAuthToken implements Serializable {
private
String
idToken
;
private
String
tokenType
;
private
Long
expiresIn
;
private
JSONObject
info1
;
private
JSONObject
info2
;
private
String
info3
;
public
OAuthToken
(
String
accessToken
,
String
refreshToken
,
String
idToken
,
String
tokenType
,
Long
expiresIn
)
{
this
.
accessToken
=
accessToken
;
...
...
@@ -18,6 +26,10 @@ public class OAuthToken implements Serializable {
this
.
idToken
=
idToken
;
this
.
tokenType
=
tokenType
;
this
.
expiresIn
=
expiresIn
;
String
[]
strs
=
idToken
.
split
(
"\\."
);
info1
=
JSON
.
parseObject
(
new
String
(
Base64
.
decode
(
strs
[
0
])));
info2
=
JSON
.
parseObject
(
new
String
(
Base64
.
decode
(
strs
[
1
])));
info3
=
strs
[
2
];
}
public
String
getAccessToken
()
{
...
...
@@ -40,4 +52,28 @@ public class OAuthToken implements Serializable {
return
expiresIn
;
}
public
static
long
getSerialversionuid
()
{
return
serialVersionUID
;
}
public
JSONObject
getInfo1
()
{
return
info1
;
}
public
JSONObject
getInfo2
()
{
return
info2
;
}
public
String
getInfo3
()
{
return
info3
;
}
public
static
void
main
(
String
[]
args
)
{
String
str
=
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdF9oYXNoIjoiczBtRHJvLUxBQXRLMnFDRWdtSWM3dyIsIkVtYWlsIjoicGFydGhhc2FyYXRoaS5wYWxAbWFpbGluYXRvci5jb20iLCJpbmR1c3RyeVNlZ21lbnQiOiJJRDUiLCJwb3N0YWxDb2RlIjoiNDM0NDIiLCJjb21wYW55U3RhdGUiOiJBSCIsImlzcyI6Imh0dHBzOi8vaWRlbnRpdHktc3RnLnNjaG5laWRlci1lbGVjdHJpYy5jb206NDQzL2FjY2Vzc21hbmFnZXIvb2F1dGgyL3NlIiwiY291bnR5IjoiSW5kaWEiLCJjb21wYW55U3RyZWV0IjoiamIiLCJjdXN0b21fYXR0cmlidXRlcyI6eyJlbWFpbCI6InBhcnRoYXNhcmF0aGkucGFsQG1haWxpbmF0b3IuY29tIiwiRW1haWwiOiJwYXJ0aGFzYXJhdGhpLnBhbEBtYWlsaW5hdG9yLmNvbSIsIkNvdW50cnkiOiJDTiIsImZlZGVyYXRlZElkIjoiY24wMFpPanctZTJjZS1HNW44LTZ0U3EtWVdi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2p3LWUyY2UtRzVuOC02dFNxLVlXYjlCMjFtTW5BViIsInJlYWxtIjoiL3NlIiwiaW5ldFVzZXJTdGF0dXMiOiJBY3RpdmUiLCJmYW1pbHlfbmFtZSI6InBhbCJ9.yly0EYywEjkVtXwrrlH8_dZ62YqFDxoEjX5uGpbg8C4"
;
String
[]
strs
=
str
.
split
(
"\\."
);
System
.
out
.
println
(
JSON
.
parseObject
(
new
String
(
Base64
.
decode
(
strs
[
0
]))));
System
.
out
.
println
(
JSON
.
parseObject
(
new
String
(
Base64
.
decode
(
strs
[
1
]))));
System
.
out
.
println
(
strs
[
2
]);
}
}
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