parent
c47daeb5cb
commit
0d85576263
|
@ -79,11 +79,11 @@ public class AuthController {
|
||||||
.userName(mr.getMsgContent().getUserName())
|
.userName(mr.getMsgContent().getUserName())
|
||||||
.token(ret.getSecondParam())
|
.token(ret.getSecondParam())
|
||||||
.logTime(System.currentTimeMillis())
|
.logTime(System.currentTimeMillis())
|
||||||
.expireTime(System.currentTimeMillis() + expTime)
|
.expireTime((System.currentTimeMillis() / 1000 / 60) + expTime)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
rspInfo.setStatus(ErrorCode.ERR_OK.getCode());
|
rspInfo.setStatus(ErrorCode.ERR_OK.getCode());
|
||||||
rspInfo.setMessage(new String[] {ErrorCode.ERR_OK.getMsg()});
|
rspInfo.setMessage(new String[]{ErrorCode.ERR_OK.getMsg()});
|
||||||
|
|
||||||
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
|
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ public class AuthController {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
rspInfo.setStatus(err.getCode());
|
rspInfo.setStatus(err.getCode());
|
||||||
rspInfo.setMessage(new String[] {err.getMsg()});
|
rspInfo.setMessage(new String[]{err.getMsg()});
|
||||||
|
|
||||||
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
|
return ProtocolRespDTO.result(ErrorCode.ERR_OK, rspInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class UserAccountManagerImpl implements UserAccountManager {
|
||||||
if (findRet.isPresent()) {
|
if (findRet.isPresent()) {
|
||||||
user = findRet.get();
|
user = findRet.get();
|
||||||
|
|
||||||
// token过期获取以前没有token,创建一个新token
|
// token过期或者以前没有token,创建一个新token
|
||||||
if (tokenTimeout(user.getLastAccess()) || user.getToken().length() == 0) {
|
if (tokenTimeout(user.getLastAccess()) || user.getToken().length() == 0) {
|
||||||
token = createUserToken(username);
|
token = createUserToken(username);
|
||||||
// 移除过期的项
|
// 移除过期的项
|
||||||
|
@ -420,12 +420,7 @@ public class UserAccountManagerImpl implements UserAccountManager {
|
||||||
user = userAccountMapper.getUserByToken(token);
|
user = userAccountMapper.getUserByToken(token);
|
||||||
|
|
||||||
// 用户未登录或者已经注销
|
// 用户未登录或者已经注销
|
||||||
if (user == null) {
|
if (user == null || user.getToken().length() == 0) {
|
||||||
return ErrorCode.ERR_LOGOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用户未登录或者已经注销
|
|
||||||
if (user.getToken().length() == 0) {
|
|
||||||
return ErrorCode.ERR_LOGOUT;
|
return ErrorCode.ERR_LOGOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,8 @@ public class LoginReq {
|
||||||
@NotBlank(message = "userName 用户名不能为空", groups = ValidGroups.LogoutReqValid.class)
|
@NotBlank(message = "userName 用户名不能为空", groups = ValidGroups.LogoutReqValid.class)
|
||||||
@Pattern(regexp = AuthConfigValue.MYSQL_REGEX_CHARS,
|
@Pattern(regexp = AuthConfigValue.MYSQL_REGEX_CHARS,
|
||||||
flags = Pattern.Flag.CASE_INSENSITIVE,
|
flags = Pattern.Flag.CASE_INSENSITIVE,
|
||||||
message = "userName 用户名存在非法字符串")
|
message = "userName 用户名存在非法字符串",
|
||||||
|
groups = ValidGroups.LogoutReqValid.class)
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue