Merge branch 'dev' of github.com:dromara/sa-token into dev

This commit is contained in:
click33 2022-01-12 11:42:22 +08:00
commit 7f33d6114a
2 changed files with 26 additions and 2 deletions

View File

@ -42,6 +42,9 @@ public class SaOAuth2Config implements Serializable {
/** Client-Token 保存的时间(单位秒) 默认两个小时 */
public long clientTokenTimeout = 60 * 60 * 2;
/** Past-Client-Token 保存的时间(单位秒) 默认為 null */
public Long pastClientTokenTimeout = null;
/**
* @return isCode
@ -177,6 +180,22 @@ public class SaOAuth2Config implements Serializable {
return this;
}
/**
* @return pastClientTokenTimeout
*/
public Long getPastClientTokenTimeout() {
return pastClientTokenTimeout;
}
/**
* @param pastClientTokenTimeout 要设置的 pastClientTokenTimeout
* @return 对象自身
*/
public SaOAuth2Config setPastClientTokenTimeout(long pastClientTokenTimeout) {
this.pastClientTokenTimeout = pastClientTokenTimeout;
return this;
}
// -------------------- SaOAuth2Handle 所有回调函数 --------------------
@ -228,7 +247,8 @@ public class SaOAuth2Config implements Serializable {
return "SaOAuth2Config [isCode=" + isCode + ", isImplicit=" + isImplicit + ", isPassword=" + isPassword
+ ", isClient=" + isClient + ", isNewRefresh=" + isNewRefresh + ", codeTimeout=" + codeTimeout
+ ", accessTokenTimeout=" + accessTokenTimeout + ", refreshTokenTimeout=" + refreshTokenTimeout
+ ", clientTokenTimeout=" + clientTokenTimeout + "]";
+ ", clientTokenTimeout=" + clientTokenTimeout + ", pastClientTokenTimeout=" + pastClientTokenTimeout
+"]";
}
}

View File

@ -598,7 +598,11 @@ public class SaOAuth2Template {
if(ct == null) {
return;
}
SaManager.getSaTokenDao().set(splicingPastTokenIndexKey(ct.clientId), ct.clientToken, ct.getExpiresIn());
Long ttl = ct.getExpiresIn();
if (null != SaOAuth2Manager.getConfig().getPastClientTokenTimeout()) {
ttl = SaOAuth2Manager.getConfig().getPastClientTokenTimeout();
}
SaManager.getSaTokenDao().set(splicingPastTokenIndexKey(ct.clientId), ct.clientToken, ttl);
}
/**
* 持久化用户授权记录