mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-10-22 03:27:23 +08:00
新增 StpLogic#getOrCreateLoginSession 方法,获取指定账号 id 的登录会话数据,如果获取不到则创建并返回
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.oauth2.SaOAuth2Manager;
|
||||
import cn.dev33.satoken.oauth2.config.SaOAuth2ServerConfig;
|
||||
import cn.dev33.satoken.oauth2.processor.SaOAuth2ServerProcessor;
|
||||
import cn.dev33.satoken.oauth2.strategy.SaOAuth2Strategy;
|
||||
import cn.dev33.satoken.oauth2.template.SaOAuth2Util;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.dev33.satoken.util.SaResult;
|
||||
@@ -56,6 +57,12 @@ public class SaOAuth2ServerController {
|
||||
return new ModelAndView("confirm.html", map);
|
||||
};
|
||||
|
||||
// 重写 AccessToken 创建策略,返回会话令牌
|
||||
SaOAuth2Strategy.instance.createAccessToken = (clientId, loginId, scopes) -> {
|
||||
System.out.println("----返回会话令牌");
|
||||
return StpUtil.getOrCreateLoginSession(loginId);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user