重构SSO模块,抽离三种模式的统一认证中心

This commit is contained in:
click33
2021-10-09 05:43:31 +08:00
parent 643118177a
commit d491f4083f
85 changed files with 727 additions and 1364 deletions

View File

@@ -13,7 +13,7 @@ public class SaSsoClientApplication {
public static void main(String[] args) {
SpringApplication.run(SaSsoClientApplication.class, args);
System.out.println("\nSa-Token-SSO Client端启动成功");
System.out.println("\nSa-Token SSO模式一 Client端启动成功");
}
}

View File

@@ -15,16 +15,14 @@ import cn.dev33.satoken.util.SaResult;
@RestController
public class SsoClientController {
/*
* SSO-Client端首页
*/
// SSO-Client端首页
@RequestMapping("/")
public String index() {
String authUrl = SaManager.getConfig().getSso().getAuthUrl();
String solUrl = SaManager.getConfig().getSso().getSloUrl();
String str = "<h2>Sa-Token SSO-Client 应用端</h2>" +
"<p>当前会话是否登录:" + StpUtil.isLogin() + "</p>" +
"<p><a href=\"javascript:location.href='" + authUrl + "?redirect=' + encodeURIComponent(location.href);\">登录</a> " +
"<p><a href=\"javascript:location.href='" + authUrl + "?mode=simple&redirect=' + encodeURIComponent(location.href);\">登录</a> " +
"<a href=\"javascript:location.href='" + solUrl + "?back=' + encodeURIComponent(location.href);\">注销</a> </p>";
return str;
}

View File

@@ -6,9 +6,9 @@ server:
sa-token:
# SSO-相关配置
sso:
# SSO-Server端 单点登录地址
# SSO-Server端-单点登录授权地址
auth-url: http://sso.stp.com:9000/sso/auth
# SSO-Server端 单点注销地址
# SSO-Server端-单点注销地址
slo-url: http://sso.stp.com:9000/sso/logout
# 配置Sa-Token单独使用的Redis连接 此处需要和SSO-Server端连接同一个Redis