新增登陆接口

pull/3/head
rays 2021-01-07 16:19:07 +08:00
parent 4b7e0d60e4
commit f6e609e742
5 changed files with 22 additions and 3 deletions

View File

@ -22,9 +22,15 @@ public class LoginResponse {
*/
private String token;
public LoginResponse(LoginUser loginUser, String token) {
/**
*
*/
private Long expireAt;
public LoginResponse(LoginUser loginUser, String token, Long expireAt) {
this.loginUser = loginUser;
this.token = token;
this.expireAt = expireAt;
}
}

View File

@ -26,4 +26,9 @@ public class SimpleRoleInfo {
*/
private String roleCode;
/**
* 10-20-30-40-50-
*/
private Integer dataScopeType;
}

View File

@ -157,7 +157,7 @@ public class AuthServiceImpl implements AuthServiceApi {
}
// 2. 解密密码的密文
// String decryptPassword = passwordTransferEncryptApi.decrypt(loginRequest.getPassword());
// String decryptPassword = passwordTransferEncryptApi.decrypt(loginRequest.getPassword());
// 3. 获取用户密码的加密值和用户的状态
UserLoginInfoDTO userValidateInfo = userServiceApi.getUserLoginInfo(loginRequest.getAccount());
@ -199,7 +199,7 @@ public class AuthServiceImpl implements AuthServiceApi {
userServiceApi.updateUserLoginInfo(loginUser.getUserId(), new Date(), ip);
// 11. 组装返回结果
return new LoginResponse(loginUser, jwtToken);
return new LoginResponse(loginUser, jwtToken, defaultJwtPayload.getExpirationDate());
}
}

View File

@ -34,6 +34,11 @@ public class DefaultJwtPayload {
*/
private Boolean rememberMe;
/**
*
*/
private Long expirationDate;
/**
*
*/

View File

@ -54,6 +54,9 @@ public class JwtTokenOperator implements JwtApi {
// 计算过期时间
DateTime expirationDate = DateUtil.offsetMillisecond(new Date(), Convert.toInt(jwtConfig.getExpiredSeconds()) * 1000);
// 设置过期时间
defaultJwtPayload.setExpirationDate(expirationDate.getTime());
// 构造jwt token
return Jwts.builder()
.setClaims(BeanUtil.beanToMap(defaultJwtPayload))