diff --git a/sa-token-demo/sa-token-demo-solon-redisson/pom.xml b/sa-token-demo/sa-token-demo-solon-redisson/pom.xml index 30a65725..35740552 100644 --- a/sa-token-demo/sa-token-demo-solon-redisson/pom.xml +++ b/sa-token-demo/sa-token-demo-solon-redisson/pom.xml @@ -10,7 +10,7 @@ org.noear solon-parent - 2.9.2 + 3.0.1 diff --git a/sa-token-demo/sa-token-demo-solon/pom.xml b/sa-token-demo/sa-token-demo-solon/pom.xml index 92e8167c..dc3a24a8 100644 --- a/sa-token-demo/sa-token-demo-solon/pom.xml +++ b/sa-token-demo/sa-token-demo-solon/pom.xml @@ -10,7 +10,7 @@ org.noear solon-parent - 2.9.2 + 3.0.1 diff --git a/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso-server-solon/pom.xml b/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso-server-solon/pom.xml index 2ef0181c..c8f5579d 100644 --- a/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso-server-solon/pom.xml +++ b/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso-server-solon/pom.xml @@ -10,14 +10,13 @@ org.noear solon-parent - 2.9.2 + 3.0.1 1.39.0 - 2.9.2 diff --git a/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso1-client-solon/pom.xml b/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso1-client-solon/pom.xml index 1b9cf1a1..28c2a930 100644 --- a/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso1-client-solon/pom.xml +++ b/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso1-client-solon/pom.xml @@ -10,7 +10,7 @@ org.noear solon-parent - 2.9.2 + 3.0.1 diff --git a/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso2-client-solon/pom.xml b/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso2-client-solon/pom.xml index 29d0908c..ea8d41e8 100644 --- a/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso2-client-solon/pom.xml +++ b/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso2-client-solon/pom.xml @@ -10,7 +10,7 @@ org.noear solon-parent - 2.9.2 + 3.0.1 diff --git a/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso3-client-solon/pom.xml b/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso3-client-solon/pom.xml index 0ccf9071..0a478820 100644 --- a/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso3-client-solon/pom.xml +++ b/sa-token-demo/sa-token-demo-sso-for-solon/sa-token-demo-sso3-client-solon/pom.xml @@ -10,7 +10,7 @@ org.noear solon-parent - 2.9.2 + 3.0.1 diff --git a/sa-token-dependencies/pom.xml b/sa-token-dependencies/pom.xml index 5a32a571..500d1f64 100644 --- a/sa-token-dependencies/pom.xml +++ b/sa-token-dependencies/pom.xml @@ -23,7 +23,7 @@ 3.1.0 6.0.0 3.0.9.RELEASE - 2.9.2 + 3.0.1 1.6.2 3.2.88 4.9.17 diff --git a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/XPluginImp.java b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/XPluginImp.java index a6bb293e..51f869ac 100644 --- a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/XPluginImp.java +++ b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/XPluginImp.java @@ -51,21 +51,9 @@ public class XPluginImp implements Plugin { @Override public void start(AppContext context) { - // Sa-Token 日志输出 Bean - context.getBeanAsync(SaLog.class, bean -> { - SaManager.setLog(bean); - }); + context.beanMake(SaSsoAutoConfigure.class); + context.beanMake(SaOAuth2AutoConfigure.class); - - //注入其它 Bean - context.lifecycle(-99, () -> { - beanInitDo(context); - context.beanMake(SaSsoAutoConfigure.class); - context.beanMake(SaOAuth2AutoConfigure.class); - }); - } - - private void beanInitDo(AppContext context) { // 注入上下文Bean SaManager.setSaTokenContext(new SaContextForSolon()); @@ -78,6 +66,12 @@ public class XPluginImp implements Plugin { SaManager.setConfig(saTokenConfig); } + // Sa-Token 日志输出 Bean + context.getBeanAsync(SaLog.class, bean -> { + SaManager.setLog(bean); + }); + + //注入 SaTokenConfig context.getBeanAsync(SaTokenConfig.class, bean -> { SaManager.setConfig(bean); }); @@ -146,6 +140,5 @@ public class XPluginImp implements Plugin { context.getBeanAsync(StpLogic.class, bean -> { StpUtil.setStpLogic(bean); }); - } } \ No newline at end of file diff --git a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/dao/SaSessionForJson.java b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/dao/SaSessionForJson.java deleted file mode 100644 index 98150c58..00000000 --- a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/dao/SaSessionForJson.java +++ /dev/null @@ -1,90 +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.dao; - -import cn.dev33.satoken.session.SaSession; -import cn.dev33.satoken.util.SaFoxUtil; -import org.noear.snack.ONode; - -// 不能删;为保持与旧的序列化兼容 -/** - * Snack3 定制版 SaSession,重写类型转换API - * - * @author noear - * @since 1.12 - */ -@Deprecated -public class SaSessionForJson extends SaSession { - - private static final long serialVersionUID = -7600983549653130681L; - - public SaSessionForJson() { - super(); - } - - /** - * 构建一个 SaSession 对象 - * @param id Session 的 id - */ - public SaSessionForJson(String id) { - super(id); - } - - /** - * 取值 (指定转换类型) - * @param 泛型 - * @param key key - * @param cs 指定转换类型 - * @return 值 - */ - @Override - public T getModel(String key, Class cs) { - if(SaFoxUtil.isBasicType(cs)) { - return SaFoxUtil.getValueByType(get(key), cs); - } - return ONode.deserialize(getString(key), cs); - } - - /** - * 取值 (指定转换类型, 并指定值为Null时返回的默认值) - * @param 泛型 - * @param key key - * @param cs 指定转换类型 - * @param defaultValue 值为Null时返回的默认值 - * @return 值 - */ - @Override - @SuppressWarnings("unchecked") - public T getModel(String key, Class cs, Object defaultValue) { - Object value = get(key); - if(valueIsNull(value)) { - return (T)defaultValue; - } - if(SaFoxUtil.isBasicType(cs)) { - return SaFoxUtil.getValueByType(get(key), cs); - } - return ONode.deserialize(getString(key), cs); - } - - /** - * 忽略 timeout 字段的序列化 - */ - @Override - public long getTimeout() { - return super.getTimeout(); - } - -} diff --git a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/integration/SaTokenFilter.java b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/integration/SaTokenFilter.java index b833788d..f8658586 100644 --- a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/integration/SaTokenFilter.java +++ b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/integration/SaTokenFilter.java @@ -15,7 +15,6 @@ */ package cn.dev33.satoken.solon.integration; -import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.exception.BackResultException; import cn.dev33.satoken.exception.SaTokenException; import cn.dev33.satoken.exception.StopMatchException; @@ -24,7 +23,6 @@ import cn.dev33.satoken.filter.SaFilterErrorStrategy; import cn.dev33.satoken.filter.SaFilter; import cn.dev33.satoken.router.SaRouter; import cn.dev33.satoken.strategy.SaAnnotationStrategy; -import cn.dev33.satoken.strategy.SaStrategy; import org.noear.solon.Solon; import org.noear.solon.core.handle.*; import org.noear.solon.core.route.RoutingTable; diff --git a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/model/SaRequestForSolon.java b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/model/SaRequestForSolon.java index 2b820bff..92355153 100644 --- a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/model/SaRequestForSolon.java +++ b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/model/SaRequestForSolon.java @@ -33,7 +33,7 @@ public class SaRequestForSolon implements SaRequest { protected Context ctx; - public SaRequestForSolon(){ + public SaRequestForSolon() { ctx = Context.current(); } @@ -48,18 +48,18 @@ public class SaRequestForSolon implements SaRequest { } @Override - public List getParamNames(){ - Set names = ctx.paramMap().keySet(); - return new ArrayList<>(names); + public List getParamNames() { + return new ArrayList<>(ctx.paramNames()); } /** * 获取 [请求体] 里提交的所有参数 + * * @return 参数列表 */ @Override - public Map getParamMap(){ - return ctx.paramMap(); + public Map getParamMap() { + return ctx.paramMap().toValueMap(); } @Override @@ -76,31 +76,19 @@ public class SaRequestForSolon implements SaRequest { * 在 [ Cookie作用域 ] 里获取一个值 (第一个此名称的) */ @Override - public String getCookieFirstValue(String name){ + public String getCookieFirstValue(String name) { return ctx.cookie(name); } /** * 在 [ Cookie作用域 ] 里获取一个值 (最后一个此名称的) + * * @param name 键 * @return 值 */ @Override - public String getCookieLastValue(String name){ - String value = null; - String cookieStr = ctx.header("Cookie"); - if(SaFoxUtil.isNotEmpty(cookieStr)) { - String[] cookieItems = cookieStr.split(";"); - for (String item : cookieItems) { - String[] kv = item.split("="); - if (kv.length == 2) { - if (kv[0].trim().equals(name)) { - value = kv[1].trim(); - } - } - } - } - return value; + public String getCookieLastValue(String name) { + return ctx.cookieMap().holder(name).getLastValue(); } @Override @@ -111,7 +99,7 @@ public class SaRequestForSolon implements SaRequest { @Override public String getUrl() { String currDomain = SaManager.getConfig().getCurrDomain(); - if( ! SaFoxUtil.isEmpty(currDomain)) { + if (!SaFoxUtil.isEmpty(currDomain)) { return currDomain + this.getRequestPath(); } return ctx.url(); @@ -127,5 +115,4 @@ public class SaRequestForSolon implements SaRequest { ctx.forward(path); return null; } - } diff --git a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/model/SaResponseForSolon.java b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/model/SaResponseForSolon.java index b214d07b..a591b1d3 100644 --- a/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/model/SaResponseForSolon.java +++ b/sa-token-starter/sa-token-solon-plugin/src/main/java/cn/dev33/satoken/solon/model/SaResponseForSolon.java @@ -48,9 +48,10 @@ public class SaResponseForSolon implements SaResponse { } /** - * 在响应头里添加一个值 - * @param name 名字 - * @param value 值 + * 在响应头里添加一个值 + * + * @param name 名字 + * @param value 值 * @return 对象自身 */ public SaResponse addHeader(String name, String value) {