--\x3e'),a="\n".concat(s,"\x3c!-- ").concat(u," --\x3e");for(var i=function(){var t=(f[2]||"[Tab]").trim(),a=(f[3]||"").trim();o=o.replace(f[0],function(){return["\n".concat(s,"\x3c!-- ").concat(u,' --\x3e"),"\n".concat(s,"\x3c!-- ").concat(u,' --\x3e'),"\n\n".concat(s).concat(a),"\n\n".concat(s,"\x3c!-- ").concat(u,"
--\x3e")].join("")})};null!==(f=(m.tabComments?p.tabCommentMarkup.exec(o):null)||(m.tabHeadings?p.tabHeadingMarkup.exec(o):null));)i()}o=(o=o.replace(r,function(){return t})).replace(n,function(){return a}),d=d.replace(b[0],function(){return o})};null!==(b=p.tabBlockMarkup.exec(d));)a();return t.forEach(function(t,a){d=d.replace(t,function(){return o[a]})}),d}(t)),t}),t.afterEach(function(t,a){o&&(t=function(o){for(var c,t=function(){var t=c[0],a=c[1]||"";o=o.replace(t,function(){return a})};null!==(c=p.commentReplaceMarkup.exec(o));)t();return o}(t)),a(t)}),t.doneEach(function(){var t,a,c,e;o&&(t=document.querySelector(".".concat(y.tabsContainer)),a=t?Array.apply(null,t.querySelectorAll(".".concat(y.tabBlock))):[],c=JSON.parse(sessionStorage.getItem(window.location.href))||{},e=JSON.parse(sessionStorage.getItem("*"))||[],s(),a.forEach(function(a,t){var o=a.querySelector(".".concat(y.tabButtonActive));o||(m.sync&&e.length&&(o=e.map(function(t){return a.querySelector(".".concat(y.tabButton,'[data-tab="').concat(t,'"]'))}).filter(function(t){return t})[0]),!o&&m.persist&&(o=a.querySelector(".".concat(y.tabButton,'[data-tab="').concat(c[t],'"]'))),(o=o||a.querySelector(".".concat(y.tabButton)))&&o.classList.add(y.tabButtonActive))}))}),t.mounted(function(){var t=document.querySelector(".".concat(y.tabsContainer));t&&t.addEventListener("click",function(t){g(t.target)}),window.addEventListener("hashchange",s,!1)})},window.$docsify.plugins||[])))}();
-//# sourceMappingURL=docsify-tabs.min.js.map
\ No newline at end of file
+//# sourceMappingURL2=docsify-tabs.min.js.map
\ No newline at end of file
diff --git a/sa-token-doc/doc/sso/sso-custom-api.md b/sa-token-doc/doc/sso/sso-custom-api.md
index 184f71bb..c5649fe6 100644
--- a/sa-token-doc/doc/sso/sso-custom-api.md
+++ b/sa-token-doc/doc/sso/sso-custom-api.md
@@ -32,13 +32,13 @@ public class SsoServerController {
``` java
// 配置SSO相关参数
@Autowired
-private void configSso(SaTokenConfig cfg) {
+private void configSso(SaSsoConfig sso) {
// 自定义API地址
SaSsoConsts.Api.ssoAuth = "/sso/auth2";
// ...
// SSO 相关配置
- cfg.sso.setXxx ... ;
+ sso.setXxx ... ;
}
```
diff --git a/sa-token-doc/doc/sso/sso-custom-login.md b/sa-token-doc/doc/sso/sso-custom-login.md
index 5905c488..5d103dd3 100644
--- a/sa-token-doc/doc/sso/sso-custom-login.md
+++ b/sa-token-doc/doc/sso/sso-custom-login.md
@@ -81,7 +81,7 @@ if(res.code == 401) {
``` java
// 配置:未登录时返回的View
-cfg.sso.setNotLoginView(() -> {
+sso.setNotLoginView(() -> {
return new ModelAndView("xxx.html");
})
```
diff --git a/sa-token-doc/doc/sso/sso-server.md b/sa-token-doc/doc/sso/sso-server.md
index c7cb77fe..b0a91c64 100644
--- a/sa-token-doc/doc/sso/sso-server.md
+++ b/sa-token-doc/doc/sso/sso-server.md
@@ -79,9 +79,9 @@ public class SsoServerController {
* 配置SSO相关参数
*/
@Autowired
- private void configSso(SaTokenConfig cfg) {
+ private void configSso(SaSsoConfig sso) {
// 配置:未登录时返回的View
- cfg.sso.setNotLoginView(() -> {
+ sso.setNotLoginView(() -> {
String msg = "当前会话在SSO-Server端尚未登录,请先访问"
+ " doLogin登录 "
+ "进行登录之后,刷新页面开始授权";
@@ -89,7 +89,7 @@ public class SsoServerController {
});
// 配置:登录处理函数
- cfg.sso.setDoLoginHandle((name, pwd) -> {
+ sso.setDoLoginHandle((name, pwd) -> {
// 此处仅做模拟登录,真实环境应该查询数据进行登录
if("sa".equals(name) && "123456".equals(pwd)) {
StpUtil.login(10001);
@@ -99,7 +99,7 @@ public class SsoServerController {
});
// 配置 Http 请求处理器 (在模式三的单点注销功能下用到,如不需要可以注释掉)
- cfg.sso.setSendHttp(url -> {
+ sso.setSendHttp(url -> {
try {
// 发起 http 请求
System.out.println("发起请求:" + url);
diff --git a/sa-token-doc/doc/sso/sso-type1.md b/sa-token-doc/doc/sso/sso-type1.md
index 5f860191..b70348d8 100644
--- a/sa-token-doc/doc/sso/sso-type1.md
+++ b/sa-token-doc/doc/sso/sso-type1.md
@@ -109,8 +109,8 @@ public class SsoClientController {
// SSO-Client端:首页
@RequestMapping("/")
public String index() {
- String authUrl = SaManager.getConfig().getSso().getAuthUrl();
- String solUrl = SaManager.getConfig().getSso().getSloUrl();
+ String authUrl = SaSsoManager.getConfig().getAuthUrl();
+ String solUrl = SaSsoManager.getConfig().getSloUrl();
String str = "Sa-Token SSO-Client 应用端
" +
"当前会话是否登录:" + StpUtil.isLogin() + "
" +
"登录 " +
diff --git a/sa-token-doc/doc/sso/sso-type3.md b/sa-token-doc/doc/sso/sso-type3.md
index 6fdf31ae..4ebf827b 100644
--- a/sa-token-doc/doc/sso/sso-type3.md
+++ b/sa-token-doc/doc/sso/sso-type3.md
@@ -36,11 +36,11 @@
``` java
// 配置SSO相关参数
@Autowired
-private void configSso(SaTokenConfig cfg) {
+private void configSso(SaSsoConfig sso) {
// ... 其他代码
// 配置 Http 请求处理器
- cfg.sso.setSendHttp(url -> {
+ sso.setSendHttp(url -> {
System.out.println("发起请求:" + url);
return OkHttps.sync(url).get().getBody().toString();
});
diff --git a/sa-token-doc/doc/up/global-filter.md b/sa-token-doc/doc/up/global-filter.md
index 1b5b6d6b..35da50bb 100644
--- a/sa-token-doc/doc/up/global-filter.md
+++ b/sa-token-doc/doc/up/global-filter.md
@@ -79,6 +79,17 @@ public class SaTokenConfigure {
- 由于过滤器中抛出的异常不进入全局异常处理,所以你必须提供`[异常处理函数]`来处理`[认证函数]`里抛出的异常
- 在`[异常处理函数]`里的返回值,将作为字符串输出到前端,如果需要定制化返回数据,请注意其中的格式转换
+改写 `setError` 函数的响应格式示例:
+``` java
+.setError(e -> {
+ // 设置响应头
+ SaHolder.getResponse().setHeader("Content-Type", "application/json;charset=UTF-8");
+ // 使用封装的 JSON 工具类转换数据格式
+ return JSONUtil.toJsonStr( SaResult.error(e.getMessage()) );
+})
+```
+JSON 工具类可参考:[Hutool-Json](https://hutool.cn/docs/#/json/JSONUtil)
+
### 在 WebFlux 中注册过滤器
`Spring WebFlux`中不提供拦截器机制,因此若你的项目需要路由鉴权功能,过滤器是你唯一的选择,在`Spring WebFlux`注册过滤器的流程与上述流程几乎完全一致,
diff --git a/sa-token-doc/index.html b/sa-token-doc/index.html
index 62caab5f..5ec5726a 100644
--- a/sa-token-doc/index.html
+++ b/sa-token-doc/index.html
@@ -87,8 +87,8 @@
-

-
QQ交流群: 614714762 点击加入
+

+
QQ交流群: 496757342 点击加入

@@ -318,7 +318,7 @@
联系我们