mirror of
https://gitee.com/dromara/sa-token.git
synced 2026-02-27 16:50:24 +08:00
!338 修复 sa-token-demo-sso-server-solon 不能正常获取 SaSsoClientInfo 的问题
Merge pull request !338 from 西东/dev
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.2.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-parent</artifactId>
|
||||
<version>3.0.4</version>
|
||||
<version>3.2.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.2.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
@@ -42,13 +42,27 @@
|
||||
<version>${sa-token.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Sa-Token 插件:整合redis (使用jackson序列化方式) -->
|
||||
<!-- Sa-Token 插件:整合redis -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-redisx</artifactId>
|
||||
<version>${sa-token.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Sa-Token 插件:整合snack3 (json) -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-snack3</artifactId>
|
||||
<version>${sa-token.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- snack3 版号要 >= 3.2.133 -->
|
||||
<dependency>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>snack3</artifactId>
|
||||
<version>3.2.133</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 视图引擎(在前后端不分离模式下提供视图支持) -->
|
||||
<dependency>
|
||||
<groupId>org.noear</groupId>
|
||||
|
||||
@@ -23,18 +23,18 @@ public class SaSsoServerApp {
|
||||
System.out.println("测试前需要根据官网文档修改 hosts 文件,测试账号密码:sa / 123456");
|
||||
System.out.println();
|
||||
|
||||
// SaSsoClientInfo sci = new SaSsoClientInfo();
|
||||
// sci.setClient("client1");
|
||||
//
|
||||
// List<SaSsoClientInfo> list = new ArrayList<>();
|
||||
// list.add(sci);
|
||||
//
|
||||
// StpUtil.getSessionByLoginId(10001).set("list", list);
|
||||
//
|
||||
// List<SaSsoClientInfo> list2 = (List)StpUtil.getSessionByLoginId(10001).get("list");
|
||||
// for (SaSsoClientInfo info : list2) {
|
||||
// System.out.println(info);
|
||||
// }
|
||||
SaSsoClientInfo sci = new SaSsoClientInfo();
|
||||
sci.setClient("client1");
|
||||
|
||||
List<SaSsoClientInfo> list = new ArrayList<>();
|
||||
list.add(sci);
|
||||
|
||||
StpUtil.getSessionByLoginId(10001).set("list", list);
|
||||
|
||||
List<SaSsoClientInfo> list2 = (List)StpUtil.getSessionByLoginId(10001).get("list");
|
||||
for (SaSsoClientInfo info : list2) {
|
||||
System.out.println(info);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.2.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.2.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<parent>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-parent</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<version>3.2.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
<jakarta-servlet-api.version>6.0.0</jakarta-servlet-api.version>
|
||||
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
|
||||
<freemarker.version>2.3.34</freemarker.version>
|
||||
<solon.version>3.0.1</solon.version>
|
||||
<solon.version>3.2.1</solon.version>
|
||||
<noear-redisx.version>1.6.9</noear-redisx.version>
|
||||
<noear-snack3.version>3.2.127</noear-snack3.version>
|
||||
<noear-snack3.version>3.2.133</noear-snack3.version>
|
||||
<jfinal.version>4.9.17</jfinal.version>
|
||||
<jboot.version>3.14.4</jboot.version>
|
||||
<commons-pool2.version>2.5.0</commons-pool2.version>
|
||||
|
||||
@@ -17,10 +17,11 @@ package cn.dev33.satoken.json;
|
||||
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
import org.noear.snack.ONode;
|
||||
import org.noear.snack.core.Feature;
|
||||
|
||||
/**
|
||||
* JSON 转换器, Snack3 版实现
|
||||
*
|
||||
*
|
||||
* @author click33
|
||||
* @author noear
|
||||
* @since 1.41.0
|
||||
@@ -32,10 +33,10 @@ public class SaJsonTemplateForSnack3 implements SaJsonTemplate {
|
||||
*/
|
||||
@Override
|
||||
public String objectToJson(Object obj) {
|
||||
if(SaFoxUtil.isEmpty(obj)) {
|
||||
if (SaFoxUtil.isEmpty(obj)) {
|
||||
return null;
|
||||
}
|
||||
return ONode.stringify(obj);
|
||||
return ONode.loadObj(obj, Feature.WriteClassName, Feature.NotWriteRootClassName).toJson();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,7 +44,7 @@ public class SaJsonTemplateForSnack3 implements SaJsonTemplate {
|
||||
*/
|
||||
@Override
|
||||
public <T> T jsonToObject(String jsonStr, Class<T> type) {
|
||||
if(SaFoxUtil.isEmpty(jsonStr)) {
|
||||
if (SaFoxUtil.isEmpty(jsonStr)) {
|
||||
return null;
|
||||
}
|
||||
return ONode.deserialize(jsonStr, type);
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package cn.dev33.satoken.solon;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import cn.dev33.satoken.solon.json.SaJsonTemplateForSnack3;
|
||||
import cn.dev33.satoken.solon.oauth2.SaOAuth2BeanInject;
|
||||
import cn.dev33.satoken.solon.oauth2.SaOAuth2BeanRegister;
|
||||
import cn.dev33.satoken.solon.sso.SaSsoBeanInject;
|
||||
@@ -32,10 +30,6 @@ public class SaSolonPlugin implements Plugin {
|
||||
|
||||
@Override
|
||||
public void start(AppContext context) {
|
||||
|
||||
// 注入JSON解析器Bean
|
||||
SaManager.setSaJsonTemplate(new SaJsonTemplateForSnack3());
|
||||
|
||||
//sa-token
|
||||
context.beanMake(SaBeanRegister.class);
|
||||
context.beanMake(SaBeanInject.class);
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020-2099 sa-token.cc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.dev33.satoken.solon.json;
|
||||
|
||||
import cn.dev33.satoken.json.SaJsonTemplate;
|
||||
import org.noear.snack.ONode;
|
||||
|
||||
/**
|
||||
* @author noear
|
||||
* @since 2.0
|
||||
*/
|
||||
public class SaJsonTemplateForSnack3 implements SaJsonTemplate {
|
||||
|
||||
/**
|
||||
* 序列化:对象 -> json 字符串
|
||||
*
|
||||
* @param obj /
|
||||
* @return /
|
||||
*/
|
||||
@Override
|
||||
public String objectToJson(Object obj) {
|
||||
return ONode.stringify(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反序列化:json 字符串 → 对象
|
||||
*/
|
||||
@Override
|
||||
public <T> T jsonToObject(String jsonStr, Class<T> type) {
|
||||
return ONode.deserialize(jsonStr, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反序列化:json 字符串 → 对象
|
||||
*
|
||||
* @param jsonStr /
|
||||
* @return /
|
||||
*/
|
||||
@Override
|
||||
public Object jsonToObject(String jsonStr) {
|
||||
return ONode.deserialize(jsonStr);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user