Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-backend
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AutogeneralShanghai
yd-backend
Commits
c8b9e1f7
Commit
c8b9e1f7
authored
Oct 28, 2021
by
hongzhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取token
parent
e21ce2be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
yd-api/src/main/java/com/yd/util/auth/service/AuthorizeServiceImpl.java
+1
-1
yd-api/src/main/java/com/yd/util/auth/setting/JwtTokenUtil.java
+7
-3
No files found.
yd-api/src/main/java/com/yd/util/auth/service/AuthorizeServiceImpl.java
View file @
c8b9e1f7
...
...
@@ -29,7 +29,7 @@ public class AuthorizeServiceImpl implements AuthorizeService {
return
responseVO
;
}
//获取TOKEN
String
token
=
jwtTokenUtil
.
generateToken
(
requestVO
.
getTicket
());
String
token
=
jwtTokenUtil
.
generateToken
(
requestVO
.
getTicket
()
,
requestVO
.
getLoginId
()
);
responseVO
.
setToken
(
token
);
responseVO
.
setCommonResult
(
new
CommonResult
(
true
,
ZHBErrorConfig
.
getErrorInfo
(
"800000"
)));
return
responseVO
;
...
...
yd-api/src/main/java/com/yd/util/auth/setting/JwtTokenUtil.java
View file @
c8b9e1f7
...
...
@@ -4,6 +4,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.Map
;
import
com.yd.util.CommonUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -205,9 +206,12 @@ public class JwtTokenUtil {
* @param ticket
* @return
*/
public
String
generateToken
(
String
ticket
){
String
token
=
null
;
Map
<
String
,
Object
>
claims
=
new
HashMap
<>();
public
String
generateToken
(
String
ticket
,
String
loginId
){
String
token
=
null
;
Map
<
String
,
Object
>
claims
=
new
HashMap
<>();
if
(!
CommonUtil
.
isNullOrBlank
(
loginId
)){
claims
.
put
(
CLAIM_KEY_USERID
,
loginId
);
}
claims
.
put
(
CLAIM_KEY_SUBJECT
,
ticket
);
claims
.
put
(
CLAIM_KEY_CREATED
,
new
Date
());
...
...
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