Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
bc5187a7
Commit
bc5187a7
authored
Feb 10, 2020
by
Elune
Browse files
代码优化
parent
da006624
Changes
2
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/security/rest/OnlineController.java
View file @
bc5187a7
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
me.zhengjie.aop.log.Log
;
import
me.zhengjie.modules.security.service.OnlineUserService
;
import
me.zhengjie.utils.EncryptUtils
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -48,6 +49,8 @@ public class OnlineController {
@PreAuthorize
(
"@el.check()"
)
public
ResponseEntity
<
Object
>
delete
(
@RequestBody
Set
<
String
>
keys
)
throws
Exception
{
for
(
String
key
:
keys
)
{
// 解密Key
key
=
EncryptUtils
.
desDecrypt
(
key
);
onlineUserService
.
kickOut
(
key
);
}
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
...
...
eladmin-system/src/main/java/me/zhengjie/modules/security/service/OnlineUserService.java
View file @
bc5187a7
...
...
@@ -90,8 +90,8 @@ public class OnlineUserService {
* @param key /
* @throws Exception /
*/
public
void
kickOut
(
String
key
)
throws
Exception
{
key
=
properties
.
getOnlineKey
()
+
EncryptUtils
.
desDecrypt
(
key
)
;
public
void
kickOut
(
String
key
){
key
=
properties
.
getOnlineKey
()
+
key
;
redisUtils
.
del
(
key
);
}
...
...
@@ -148,9 +148,9 @@ public class OnlineUserService {
try
{
String
token
=
EncryptUtils
.
desDecrypt
(
onlineUser
.
getKey
());
if
(
StringUtils
.
isNotBlank
(
igoreToken
)&&!
igoreToken
.
equals
(
token
)){
this
.
kickOut
(
onlineUser
.
getKey
()
);
this
.
kickOut
(
token
);
}
else
if
(
StringUtils
.
isBlank
(
igoreToken
)){
this
.
kickOut
(
onlineUser
.
getKey
()
);
this
.
kickOut
(
token
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"checkUser is error"
,
e
);
...
...
Write
Preview
Supports
Markdown
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