Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
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
zengtianlai3
ioc_sixiang_license
Commits
5543af64
Commit
5543af64
authored
Jun 14, 2022
by
AfirSraftGarrier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文档说明
parent
27f45898
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
LoginController.java
.../java/iot/sixiang/license/controller/LoginController.java
+10
-3
JwtFilter.java
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
+2
-3
No files found.
license/src/main/java/iot/sixiang/license/controller/LoginController.java
View file @
5543af64
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -33,7 +34,7 @@ public class LoginController {
...
@@ -33,7 +34,7 @@ public class LoginController {
static
Map
<
String
,
LoginUser
>
userMap
=
new
HashMap
<>();
static
Map
<
String
,
LoginUser
>
userMap
=
new
HashMap
<>();
static
{
static
{
LoginUser
user1
=
new
LoginUser
(
"2147483647"
,
"root"
,
"123456"
);
LoginUser
user1
=
new
LoginUser
(
"2147483647"
,
"root"
,
"123456"
);
userMap
.
put
(
"2147483647"
,
user1
);
userMap
.
put
(
"2147483647"
,
user1
);
}
}
...
@@ -44,8 +45,8 @@ public class LoginController {
...
@@ -44,8 +45,8 @@ public class LoginController {
@GetMapping
(
"login"
)
@GetMapping
(
"login"
)
@MyLog
(
title
=
"登录"
,
optParam
=
"#{userName},#{password}"
,
businessType
=
BusinessType
.
OTHER
)
@MyLog
(
title
=
"登录"
,
optParam
=
"#{userName},#{password}"
,
businessType
=
BusinessType
.
OTHER
)
@ApiImplicitParams
({
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"userName"
,
value
=
"用户名"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"password"
,
value
=
"密码"
,
required
=
true
)
@ApiImplicitParam
(
name
=
"password"
,
value
=
"密码"
,
required
=
true
)
})
})
public
ResResult
<
LoginVo
>
login
(
@RequestParam
(
"userName"
)
String
userName
,
@RequestParam
(
"password"
)
String
password
)
{
public
ResResult
<
LoginVo
>
login
(
@RequestParam
(
"userName"
)
String
userName
,
@RequestParam
(
"password"
)
String
password
)
{
...
@@ -67,4 +68,10 @@ public class LoginController {
...
@@ -67,4 +68,10 @@ public class LoginController {
public
BaseResult
logout
()
{
public
BaseResult
logout
()
{
return
BaseResult
.
success
();
return
BaseResult
.
success
();
}
}
@GetMapping
(
"fail"
)
@ApiIgnore
public
ResResult
fail
()
{
return
ResResult
.
fail
().
msg
(
"认证信息非法"
);
}
}
}
license/src/main/java/iot/sixiang/license/jwt/JwtFilter.java
View file @
5543af64
...
@@ -44,7 +44,7 @@ public class JwtFilter implements Filter {
...
@@ -44,7 +44,7 @@ public class JwtFilter implements Filter {
String
uri
=
request
.
getRequestURI
();
String
uri
=
request
.
getRequestURI
();
if
(
uri
.
contains
(
url1
)
||
uri
.
contains
(
url2
)
||
uri
.
contains
(
url3
)
||
uri
.
contains
(
url4
)
||
uri
.
contains
(
url7
)
||
uri
.
contains
(
url8
))
{
if
(
uri
.
contains
(
url1
)
||
uri
.
contains
(
url2
)
||
uri
.
contains
(
url3
)
||
uri
.
contains
(
url4
)
||
uri
.
contains
(
url7
)
||
uri
.
contains
(
url8
))
{
if
(
uri
.
contains
(
url1
)
||
uri
.
contains
(
url2
)
)
{
if
(
uri
.
contains
(
url1
)
||
uri
.
contains
(
url2
)
)
{
UserUtils
.
setUri
(
uri
);
UserUtils
.
setUri
(
uri
);
}
}
check
=
false
;
check
=
false
;
...
@@ -61,8 +61,7 @@ public class JwtFilter implements Filter {
...
@@ -61,8 +61,7 @@ public class JwtFilter implements Filter {
}
else
{
}
else
{
DecodedJWT
jwt
=
JwtUtil
.
verifyToken
(
token
);
DecodedJWT
jwt
=
JwtUtil
.
verifyToken
(
token
);
if
(
jwt
==
null
)
{
if
(
jwt
==
null
)
{
String
resultStr
=
JSON
.
toJSONString
(
ResResult
.
fail
().
msg
(
"认证信息非法"
));
request
.
getRequestDispatcher
(
"/fail"
).
forward
(
request
,
response
);
response
.
getWriter
().
write
(
resultStr
);
return
;
return
;
}
else
{
}
else
{
Map
<
String
,
Claim
>
userData
=
jwt
.
getClaims
();
Map
<
String
,
Claim
>
userData
=
jwt
.
getClaims
();
...
...
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