增加token续期

master
bynt 3 years ago
parent c048af80aa
commit 543af053b6

@ -112,6 +112,7 @@ public class TokenProvider implements InitializingBean {
if (differ <= properties.getDetect()) { if (differ <= properties.getDetect()) {
long renew = time + properties.getRenew(); long renew = time + properties.getRenew();
redisUtils.expire(properties.getOnlineKey() + token, renew, TimeUnit.MILLISECONDS); redisUtils.expire(properties.getOnlineKey() + token, renew, TimeUnit.MILLISECONDS);
redisUtils.expire(token, renew, TimeUnit.MILLISECONDS);
return true; return true;
} }
return false; return false;

@ -19,7 +19,6 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
@ -31,6 +30,7 @@ import java.util.Date;
@NoArgsConstructor @NoArgsConstructor
public class OnlineUserDto { public class OnlineUserDto {
/** /**
* *
*/ */

@ -49,6 +49,7 @@ public class OnlineUserService {
/** /**
* 线 * 线
*
* @param jwtUserDto / * @param jwtUserDto /
* @param token / * @param token /
* @param request / * @param request /
@ -69,6 +70,7 @@ public class OnlineUserService {
/** /**
* *
*
* @param filter / * @param filter /
* @param pageable / * @param pageable /
* @return / * @return /
@ -83,6 +85,7 @@ public class OnlineUserService {
/** /**
* *
*
* @param filter / * @param filter /
* @return / * @return /
*/ */
@ -106,6 +109,7 @@ public class OnlineUserService {
/** /**
* *
*
* @param key / * @param key /
*/ */
public void kickOut(String key) { public void kickOut(String key) {
@ -115,6 +119,7 @@ public class OnlineUserService {
/** /**
* 退 * 退
*
* @param token / * @param token /
*/ */
public void logout(String token) { public void logout(String token) {
@ -124,6 +129,7 @@ public class OnlineUserService {
/** /**
* *
*
* @param all / * @param all /
* @param response / * @param response /
* @throws IOException / * @throws IOException /
@ -145,6 +151,7 @@ public class OnlineUserService {
/** /**
* *
*
* @param key / * @param key /
* @return / * @return /
*/ */
@ -154,6 +161,7 @@ public class OnlineUserService {
/** /**
* 线 * 线
*
* @param userName * @param userName
*/ */
public void checkLoginOnUser(String userName, String igoreToken) { public void checkLoginOnUser(String userName, String igoreToken) {
@ -179,6 +187,7 @@ public class OnlineUserService {
/** /**
* 退 * 退
*
* @param username / * @param username /
*/ */
@Async @Async

@ -135,6 +135,7 @@ public class WebSocketServer {
break; break;
case DefaultNumberConstants.FIVE_NUMBER: case DefaultNumberConstants.FIVE_NUMBER:
Long userId = getUserId(session); Long userId = getUserId(session);
log.info("================= userId as {} ====================", userId);
if (userId != null) { if (userId != null) {
messageNotificationService.create messageNotificationService.create
(message, userId); (message, userId);

Loading…
Cancel
Save