redis反序列化问题
This commit is contained in:
@@ -210,7 +210,7 @@ public class AuthController {
|
||||
|
||||
// 通过sessionId验证手机验证码
|
||||
String smsCodeKey = "sms:code:" + smsSessionId;
|
||||
String storedSmsValue = (String) redisService.get(smsCodeKey);
|
||||
String storedSmsValue = redisService.get(smsCodeKey, String.class);
|
||||
if (storedSmsValue == null) {
|
||||
return ResultDomain.failure("验证码已过期,请重新获取");
|
||||
}
|
||||
@@ -258,7 +258,7 @@ public class AuthController {
|
||||
|
||||
// 通过sessionId验证邮箱验证码
|
||||
String emailCodeKey = "email:code:" + emailSessionId;
|
||||
String storedEmailValue = (String) redisService.get(emailCodeKey);
|
||||
String storedEmailValue = redisService.get(emailCodeKey, String.class);
|
||||
if (storedEmailValue == null) {
|
||||
return ResultDomain.failure("验证码已过期,请重新获取");
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class AuthServiceImpl implements AuthService{
|
||||
|
||||
// 2. 从Redis获取登录信息
|
||||
String loginKey = "login:token:" + token;
|
||||
String loginJson = (String) redisService.get(loginKey);
|
||||
String loginJson = redisService.get(loginKey, String.class);
|
||||
if (loginJson == null) {
|
||||
return ResultDomain.failure("登录信息已失效");
|
||||
}
|
||||
@@ -422,7 +422,7 @@ public class AuthServiceImpl implements AuthService{
|
||||
|
||||
// 2. 从Redis获取登录信息
|
||||
String loginKey = "login:token:" + token;
|
||||
String loginJson = (String) redisService.get(loginKey);
|
||||
String loginJson = redisService.get(loginKey, String.class);
|
||||
if (loginJson == null) {
|
||||
return ResultDomain.failure("登录信息已失效");
|
||||
}
|
||||
@@ -481,7 +481,7 @@ public class AuthServiceImpl implements AuthService{
|
||||
|
||||
// 1. 从Redis获取登录信息
|
||||
String loginKey = "login:token:" + token;
|
||||
String loginJson = (String) redisService.get(loginKey);
|
||||
String loginJson = redisService.get(loginKey, String.class);
|
||||
if (loginJson == null) {
|
||||
return ResultDomain.success("登出成功", (LoginDomain) null); // 已经过期的token,直接返回成功
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class EmailLoginStrategy implements LoginStrategy {
|
||||
|
||||
// 从Redis获取验证码
|
||||
String codeKey = "email:code:" + captchaId;
|
||||
String storedValue = (String) redisService.get(codeKey);
|
||||
String storedValue = redisService.get(codeKey, String.class);
|
||||
|
||||
if (storedValue == null) {
|
||||
return false;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class PhoneLoginStrategy implements LoginStrategy {
|
||||
|
||||
// 从Redis获取验证码
|
||||
String codeKey = "sms:code:" + captchaId;
|
||||
String storedValue = (String) redisService.get(codeKey);
|
||||
String storedValue = redisService.get(codeKey, String.class);
|
||||
|
||||
if (storedValue == null) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user