Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
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
liqin
chnmuseum-party
Commits
e47f5418
Commit
e47f5418
authored
Mar 12, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
cdc14100
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
MyShiroRealm.java
...cn/wisenergy/chnmuseum/party/auth/realm/MyShiroRealm.java
+3
-2
LoginController.java
...nergy/chnmuseum/party/web/controller/LoginController.java
+1
-1
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/auth/realm/MyShiroRealm.java
View file @
e47f5418
...
...
@@ -32,7 +32,7 @@ public class MyShiroRealm extends AuthorizingRealm {
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
MyShiroRealm
.
class
);
private
static
final
String
SHIRO_JWT_TOKEN
=
"shiro:jwt:token"
;
private
static
final
String
SHIRO_JWT_TOKEN
=
"shiro:jwt:token
:
"
;
//用户登录次数计数 redisKey 前缀
private
String
SHIRO_LOGIN_COUNT
=
"shiro_login_count_"
;
...
...
@@ -76,12 +76,13 @@ public class MyShiroRealm extends AuthorizingRealm {
if
(
credentials
==
null
)
{
throw
new
AuthenticationException
(
"token为空!"
);
}
LOGGER
.
info
(
"MyShiroRealm doGetAuthenticationInfo().token="
+
token
);
Boolean
hasToken
=
stringRedisTemplate
.
hasKey
(
SHIRO_JWT_TOKEN
+
token
);
if
(
hasToken
==
null
||
!
hasToken
)
{
throw
new
AuthenticationException
(
"用户未登录!"
);
}
LOGGER
.
info
(
"MyShiroRealm doGetAuthenticationInfo().token="
+
token
);
String
username
=
JwtTokenUtil
.
getUsername
(
credentials
);
if
(
username
==
null
)
{
throw
new
AuthenticationException
(
"token invalid"
);
...
...
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/LoginController.java
View file @
e47f5418
...
...
@@ -53,7 +53,7 @@ public class LoginController {
@Resource
private
SysLogController
sysLogController
;
private
static
final
String
SHIRO_JWT_TOKEN
=
"shiro:jwt:token"
;
private
static
final
String
SHIRO_JWT_TOKEN
=
"shiro:jwt:token
:
"
;
//用户登录次数计数 redisKey 前缀
private
String
SHIRO_LOGIN_COUNT
=
"shiro_login_count_"
;
//用户登录是否被锁定 一小时 redisKey 前缀
...
...
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