mirror of
https://gitee.com/dromara/sa-token.git
synced 2024-11-29 18:37:49 +08:00
新增 autoRenewTimeout 配置项:是否在每次下发 ticket 时,自动续期 token 的有效期(根据全局 timeout 值)
This commit is contained in:
parent
5a7463dc91
commit
64abd69715
@ -69,6 +69,11 @@ public class SaSsoServerConfig implements Serializable {
|
||||
*/
|
||||
public Boolean isHttp = false;
|
||||
|
||||
/**
|
||||
* 是否在每次下发 ticket 时,自动续期 token 的有效期(根据全局 timeout 值)
|
||||
*/
|
||||
public Boolean autoRenewTimeout = false;
|
||||
|
||||
/**
|
||||
* 在 Access-Session 上记录 Client 信息的最高数量(-1=无限),超过此值将进行自动清退处理,先进先出
|
||||
*/
|
||||
@ -180,6 +185,22 @@ public class SaSsoServerConfig implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 是否在每次下发 ticket 时,自动续期 token 的有效期(根据全局 timeout 值)
|
||||
*/
|
||||
public Boolean getAutoRenewTimeout() {
|
||||
return autoRenewTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param autoRenewTimeout 是否在每次下发 ticket 时,自动续期 token 的有效期(根据全局 timeout 值)
|
||||
* @return 对象自身
|
||||
*/
|
||||
public SaSsoServerConfig setAutoRenewTimeout(Boolean autoRenewTimeout) {
|
||||
this.autoRenewTimeout = autoRenewTimeout;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return maxLoginClient 在 Access-Session 上记录 Client 信息的最高数量(-1=无限),超过此值将进行自动清退处理,先进先出
|
||||
*/
|
||||
@ -234,6 +255,7 @@ public class SaSsoServerConfig implements Serializable {
|
||||
+ ", homeRoute=" + homeRoute
|
||||
+ ", isSlo=" + isSlo
|
||||
+ ", isHttp=" + isHttp
|
||||
+ ", autoRenewTimeout=" + autoRenewTimeout
|
||||
+ ", maxRegClient=" + maxRegClient
|
||||
+ ", isCheckSign=" + isCheckSign
|
||||
+ "]";
|
||||
|
@ -285,7 +285,7 @@ public class SaSsoClientProcessor {
|
||||
// 取出 Session 剩余有效期
|
||||
Long remainSessionTimeout = result.get(paramName.remainSessionTimeout, Long.class);
|
||||
if(remainSessionTimeout == null) {
|
||||
remainSessionTimeout = ssoClientTemplate.getStpLogic().getConfig().getTimeout();
|
||||
remainSessionTimeout = ssoClientTemplate.getStpLogic().getConfigOrGlobal().getTimeout();
|
||||
}
|
||||
// 构建返回
|
||||
return new CheckTicketResult(loginId, remainSessionTimeout);
|
||||
|
@ -139,6 +139,11 @@ public class SaSsoServerProcessor {
|
||||
|
||||
// 构建并跳转
|
||||
String redirectUrl = ssoServerTemplate.buildRedirectUrl(stpLogic.getLoginId(), client, redirect);
|
||||
// 构建成功,说明 redirect 地址合法,此时需要更新一下该账号的Session有效期
|
||||
if(cfg.getAutoRenewTimeout()) {
|
||||
stpLogic.renewTimeout(stpLogic.getConfigOrGlobal().getTimeout());
|
||||
}
|
||||
// 跳转
|
||||
return res.redirect(redirectUrl);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user