Jackson定制版Session,避免timeout属性的序列化

This commit is contained in:
click33
2022-02-04 11:40:30 +08:00
parent 9ffc85e749
commit 978c8dd71e
5 changed files with 75 additions and 32 deletions

View File

@@ -30,19 +30,19 @@ public class SaOAuth2Config implements Serializable {
/** 是否在每次 Refresh-Token 刷新 Access-Token 时,产生一个新的 Refresh-Token */
public Boolean isNewRefresh = false;
/** Code授权码 保存的时间(单位秒) 默认五分钟 */
/** Code授权码 保存的时间(单位秒) 默认五分钟 */
public long codeTimeout = 60 * 5;
/** Access-Token 保存的时间(单位秒) 默认两个小时 */
/** Access-Token 保存的时间(单位秒) 默认两个小时 */
public long accessTokenTimeout = 60 * 60 * 2;
/** Refresh-Token 保存的时间(单位秒) 默认30 天 */
/** Refresh-Token 保存的时间(单位秒) 默认30 天 */
public long refreshTokenTimeout = 60 * 60 * 24 * 30;
/** Client-Token 保存的时间(单位秒) 默认两个小时 */
/** Client-Token 保存的时间(单位秒) 默认两个小时 */
public long clientTokenTimeout = 60 * 60 * 2;
/** Past-Client-Token 保存的时间(单位秒) 默认為 null */
/** Past-Client-Token 保存的时间(单位秒) 默认為 null */
public Long pastClientTokenTimeout = null;

View File

@@ -256,9 +256,10 @@ public class SaOAuth2Handle {
String username = req.getParamNotNull(Param.username);
String password = req.getParamNotNull(Param.password);
String clientId = req.getParamNotNull(Param.client_id);
String scope = req.getParam(Param.scope, "");
// 2、校验client_id
SaOAuth2Util.checkClientModel(clientId);
// 2、校验 ClientScope
SaOAuth2Util.checkContract(clientId, scope);
// 3、防止因前端误传token造成逻辑干扰
SaHolder.getStorage().set(StpUtil.stpLogic.splicingKeyJustCreatedSave(), "no-token");
@@ -273,10 +274,7 @@ public class SaOAuth2Handle {
RequestAuthModel ra = new RequestAuthModel();
ra.clientId = clientId;
ra.loginId = StpUtil.getLoginId();
ra.scope = req.getParam(Param.scope, "");
// 6、校验 ClientScope
SaOAuth2Util.checkContract(clientId, ra.scope);
ra.scope = scope;
// 7、生成 Access-Token
AccessTokenModel at = SaOAuth2Util.generateAccessToken(ra, true);