feat(sso): sso-server 新增 jumpToRedirectUrlNotice 策略,用于授权重定向跳转之前的通知

This commit is contained in:
click33 2025-05-03 13:14:18 +08:00
parent 6f845fb6b8
commit f150209a4f
3 changed files with 14 additions and 3 deletions

View File

@ -44,12 +44,12 @@ public class SaCheckTicketResult implements Serializable {
/** 此账号会话剩余有效期 */ /** 此账号会话剩余有效期 */
public Long remainSessionTimeout; public Long remainSessionTimeout;
/** 从 sso-server 返回的所有参数 */
public SaResult result;
/** 此账号在认证中心的 loginId */ /** 此账号在认证中心的 loginId */
public Object centerId; public Object centerId;
/** 从 sso-server 返回的所有参数 */
public SaResult result;
public SaCheckTicketResult() { public SaCheckTicketResult() {
} }
@ -61,6 +61,7 @@ public class SaCheckTicketResult implements Serializable {
", deviceId='" + deviceId + '\'' + ", deviceId='" + deviceId + '\'' +
", remainTokenTimeout=" + remainTokenTimeout + ", remainTokenTimeout=" + remainTokenTimeout +
", remainSessionTimeout=" + remainSessionTimeout + ", remainSessionTimeout=" + remainSessionTimeout +
", centerId=" + centerId +
", result=" + result + ", result=" + result +
'}'; '}';
} }

View File

@ -119,6 +119,7 @@ public class SaSsoServerProcessor {
if(SaFoxUtil.isEmpty(cfg.getHomeRoute())) { if(SaFoxUtil.isEmpty(cfg.getHomeRoute())) {
throw new SaSsoException("未指定 redirect 参数,也未配置 homeRoute 路由,无法完成重定向操作").setCode(SaSsoErrorCode.CODE_30014); throw new SaSsoException("未指定 redirect 参数,也未配置 homeRoute 路由,无法完成重定向操作").setCode(SaSsoErrorCode.CODE_30014);
} }
ssoServerTemplate.strategy.jumpToRedirectUrlNotice.run(cfg.getHomeRoute());
return res.redirect(cfg.getHomeRoute()); return res.redirect(cfg.getHomeRoute());
} }
@ -141,6 +142,7 @@ public class SaSsoServerProcessor {
}); });
// 跳转 // 跳转
ssoServerTemplate.strategy.jumpToRedirectUrlNotice.run(redirectUrl);
return res.redirect(redirectUrl); return res.redirect(redirectUrl);
} }

View File

@ -16,6 +16,7 @@
package cn.dev33.satoken.sso.strategy; package cn.dev33.satoken.sso.strategy;
import cn.dev33.satoken.SaManager; import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.fun.SaParamFunction;
import cn.dev33.satoken.sso.function.CheckTicketAppendDataFunction; import cn.dev33.satoken.sso.function.CheckTicketAppendDataFunction;
import cn.dev33.satoken.sso.function.DoLoginHandleFunction; import cn.dev33.satoken.sso.function.DoLoginHandleFunction;
import cn.dev33.satoken.sso.function.NotLoginViewFunction; import cn.dev33.satoken.sso.function.NotLoginViewFunction;
@ -51,6 +52,13 @@ public class SaSsoServerStrategy {
return SaResult.error(); return SaResult.error();
}; };
/**
* SSO-Server端在授权重定向之前的通知
*/
public SaParamFunction<String> jumpToRedirectUrlNotice = (redirectUrl) -> {
};
/** /**
* SSO-Server端在校验 ticket sso-client 端追加返回信息的函数 * SSO-Server端在校验 ticket sso-client 端追加返回信息的函数
*/ */