/sso/logout 接口 self 格式设置响应头,以适配 solon 下集成 sso 插件可以正常跳转路径

This commit is contained in:
click33 2024-05-11 15:56:56 +08:00
parent 54114ebac6
commit dd533fba8e
3 changed files with 2 additions and 51 deletions

View File

@ -11,7 +11,7 @@ public class SaSso3ClientApp {
Solon.start(SaSso3ClientApp.class, args); Solon.start(SaSso3ClientApp.class, args);
System.out.println(); System.out.println();
System.out.println("---------------------- Sa-Token SSO 模式三 Client 端启动成功 ----------------------"); System.out.println("---------------------- Solon Sa-Token SSO 模式三 Client 端启动成功 ----------------------");
System.out.println("配置信息:" + SaSsoManager.getClientConfig()); System.out.println("配置信息:" + SaSsoManager.getClientConfig());
System.out.println("测试访问应用端一: http://sa-sso-client1.com:9003"); System.out.println("测试访问应用端一: http://sa-sso-client1.com:9003");
System.out.println("测试访问应用端二: http://sa-sso-client2.com:9003"); System.out.println("测试访问应用端二: http://sa-sso-client2.com:9003");

View File

@ -1,50 +0,0 @@
//package com.pj.sso;
//
//import cn.dev33.satoken.sso.SaSsoManager;
//import cn.dev33.satoken.sso.config.SaSsoClientConfig;
//import cn.dev33.satoken.sso.processor.SaSsoClientProcessor;
//import cn.dev33.satoken.sso.template.SaSsoClientTemplate;
//import org.noear.solon.annotation.Bean;
//import org.noear.solon.annotation.Condition;
//import org.noear.solon.annotation.Configuration;
//import org.noear.solon.annotation.Inject;
//
///**
// * solon sso 适配 cn.dev33:sa-token-solon-plugin:1.34.0 里还没有临时加这个类
// *
// * //todo: 如果使用 org.noear:sa-token-solon-plugin:xxx 则需要删掉这个类
// *
// * @author noear
// * @since 2.0
// */
//@Condition(onClass = SaSsoManager.class)
//@Configuration
//public class SaSsoAutoConfigure {
// /**
// * 获取 SSO 配置Bean
// * */
// @Bean
// public SaSsoClientConfig getConfig(@Inject(value = "${sa-token.sso-client}",required = false) SaSsoClientConfig ssoConfig) {
// return ssoConfig;
// }
//
// /**
// * 注入 Sa-Token-SSO 配置Bean
// *
// * @param saSsoConfig 配置对象
// */
// @Bean
// public void setSaSsoConfig(@Inject(required = false) SaSsoClientConfig saSsoConfig) {
// SaSsoManager.setClientConfig(saSsoConfig);
// }
//
// /**
// * 注入 Sa-Token-SSO 单点登录模块 Bean
// *
// * @param ssoClientTemplate ssoClientTemplate对象
// */
// @Bean
// public void setSaSsoClientTemplate(@Inject(required = false) SaSsoClientTemplate ssoClientTemplate) {
// SaSsoClientProcessor.instance.ssoClientTemplate = ssoClientTemplate;
// }
//}

View File

@ -47,6 +47,7 @@ public class SaSsoProcessorHelper {
String back = req.getParam(paramName.back); String back = req.getParam(paramName.back);
if(SaFoxUtil.isNotEmpty(back)) { if(SaFoxUtil.isNotEmpty(back)) {
if(back.equals(SaSsoConsts.SELF)) { if(back.equals(SaSsoConsts.SELF)) {
res.setHeader("Content-Type", "text/html; charset=utf-8");
return "<script>if(document.referrer != location.href){ location.replace(document.referrer || '/'); }</script>"; return "<script>if(document.referrer != location.href){ location.replace(document.referrer || '/'); }</script>";
} }
return res.redirect(back); return res.redirect(back);