mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-22 20:54:25 +08:00
♻️ Refactoring code. close #I60453 令牌管理 时间格式化
This commit is contained in:
parent
6d9713ec0e
commit
57d3aa9bbf
@ -16,6 +16,8 @@
|
||||
|
||||
package com.pig4cloud.pig.auth.endpoint;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.TemporalAccessorUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -213,8 +215,14 @@ public class PigTokenEndpoint {
|
||||
tokenVo.setUsername(authorization.getPrincipalName());
|
||||
OAuth2Authorization.Token<OAuth2AccessToken> accessToken = authorization.getAccessToken();
|
||||
tokenVo.setAccessToken(accessToken.getToken().getTokenValue());
|
||||
tokenVo.setExpiresAt(accessToken.getToken().getExpiresAt());
|
||||
tokenVo.setIssuedAt(accessToken.getToken().getIssuedAt());
|
||||
|
||||
String expiresAt = TemporalAccessorUtil.format(accessToken.getToken().getExpiresAt(),
|
||||
DatePattern.NORM_DATETIME_PATTERN);
|
||||
tokenVo.setExpiresAt(expiresAt);
|
||||
|
||||
String issuedAt = TemporalAccessorUtil.format(accessToken.getToken().getIssuedAt(),
|
||||
DatePattern.NORM_DATETIME_PATTERN);
|
||||
tokenVo.setIssuedAt(issuedAt);
|
||||
return tokenVo;
|
||||
}).collect(Collectors.toList());
|
||||
result.setRecords(tokenVoList);
|
||||
|
@ -2,8 +2,6 @@ package com.pig4cloud.pig.admin.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* 前端展示令牌管理
|
||||
*
|
||||
@ -23,8 +21,8 @@ public class TokenVo {
|
||||
|
||||
private String accessToken;
|
||||
|
||||
private Instant issuedAt;
|
||||
private String issuedAt;
|
||||
|
||||
private Instant expiresAt;
|
||||
private String expiresAt;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user