feat: sso 模块新增 allowAnonClient 决定是否启用匿名 client & 新增 clients 配置项,用于单独配置每个 client 的授权信息

This commit is contained in:
click33
2025-04-25 15:39:11 +08:00
parent 2d777fbd22
commit 79113c5848
10 changed files with 407 additions and 46 deletions

View File

@@ -21,7 +21,7 @@ public class H5Controller {
* 获取 redirectUrl
*/
@RequestMapping("/sso/getRedirectUrl")
public SaResult getRedirectUrl(String redirect, String mode, String client) {
public SaResult getRedirectUrl(String client, String redirect, String mode) {
// 未登录情况下,返回 code=401
if(StpUtil.isLogin() == false) {
return SaResult.code(401);
@@ -30,7 +30,7 @@ public class H5Controller {
redirect = SaFoxUtil.decoderUrl(redirect);
if(SaSsoConsts.MODE_SIMPLE.equals(mode)) {
// 模式一
SaSsoUtil.checkRedirectUrl(redirect);
SaSsoUtil.checkRedirectUrl(client, redirect);
return SaResult.data(redirect);
} else {
// 模式二或模式三

View File

@@ -19,6 +19,14 @@ sa-token:
# ------- SSO-模式三相关配置 下面的配置在使用SSO模式三时打开
# 是否打开模式三
is-http: true
allow-anon-client: false
clients:
sso-client2:
client: sso-client2
allow-url: http://sa-sso-client1.com:9002/sso/login
sign:
# API 接口调用秘钥
secret-key: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor

View File

@@ -10,6 +10,9 @@ sa-token:
server-url: http://sa-sso-server.com:9000
# 在 sso-server 端前后端分离时打开这个上面的不要注释auth-url 配置项和 server-url 要同时存在)
# auth-url: http://127.0.0.1:8848/sa-token-demo-sso-server-h5/sso-auth.html
client: sso-client2
sign:
# API 接口调用秘钥
secret-key: kQwIOrYvnXmSDkwEiFngrKidMcdrgKor