sa-token/sa-token-doc/doc.html
2024-05-16 01:54:37 +08:00

447 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>Sa-Token</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Sa-Token是一个java权限认证框架功能全面上手简单登录认证、权限认证、Session会话、踢人下线、账号封禁、集成Redis、前后端分离、分布式会话、微服务网关鉴权、单点登录、OAuth2.0、临时Token验证、记住我模式、模拟他人账号、临时身份切换、多账号体系、注解式鉴权、路由拦截式鉴权、花式token、自动续签、同端互斥登录、会话治理、密码加密、jwt集成、Spring集成、WebFlux集成...有了sa-token你所有的权限认证问题都不再是问题">
<meta name="keywords" content="sa-token,sa-token框架,sa-token文档,java权限认证">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="logo.png">
<link rel="stylesheet" href="./static/doc.css">
<link rel="stylesheet" href="./static/vue.css">
</head>
<body>
<div class="doc-header">
<div class="nav-left">
<a href="doc.html">
<div class="logo-box">
<img src="logo.png" title="logo" />
<h1 class="logo-text">Sa-Token</h1>
<sub>v1.38.0</sub>
</div>
</a>
</div>
<nav class="nav-right">
<div class="sear-box p-none" tabindex="-1" >
<!-- 加载中…… -->
</div>
<select class="select-version p-none" onchange="location.href=this.value">
<option value="doc.html">最新版</option>
<option value="v/v1.37.0/doc.html">v1.37.0</option>
<option value="v/v1.36.0/doc.html">v1.36.0</option>
<option value="v/v1.35.0/doc.html">v1.35.0</option>
<option value="v/v1.34.0/doc.html">v1.34.0</option>
<option value="v/v1.33.0/doc.html">v1.33.0</option>
<option value="v/v1.32.0/doc.html">v1.32.0</option>
<option value="v/v1.31.0/doc.html">v1.31.0</option>
<option value="v/v1.30.0/doc/index.html">v1.30.0</option>
<option value="v/v1.29.0/doc/index.html">v1.29.0</option>
<option value="v/v1.28.0/doc/index.html">v1.28.0</option>
<option value="v/v1.27.0/doc/index.html">v1.27.0</option>
<option value="v/v1.26.0/doc/index.html">v1.26.0</option>
<option value="v/v1.25.0/doc/index.html">v1.25.0</option>
<option value="v/v1.24.0/doc/index.html">v1.24.0</option>
<option value="v/v1.23.0/doc/index.html">v1.23.0</option>
<option value="v/v1.22.0/doc/index.html">v1.22.0</option>
<option value="v/v1.21.0/doc/index.html">v1.21.0</option>
<option value="v/v1.20.0/doc/index.html">v1.20.0</option>
<option value="v/v1.19.0/doc/index.html">v1.19.0</option>
<option value="v/v1.18.0/doc/index.html">v1.18.0</option>
<option value="v/v1.17.0/doc/index.html">v1.17.0</option>
<option value="v/v1.16.0/doc/index.html">v1.16.0</option>
<option value="v/v1.15.0/doc/index.html">v1.15.0</option>
<option value="v/v1.14.0/doc/index.html">v1.14.0</option>
<option value="v/v1.13.0/doc/index.html">v1.13.0</option>
<option value="v/v1.12.1/doc/index.html">v1.12.1</option>
<option value="v/v1.12.0/doc/index.html">v1.12.0</option>
<option value="v/v1.11.0/doc/index.html">v1.11.0</option>
<option value="v/v1.10.0/doc/index.html">v1.10.0</option>
<option value="v/v1.9.0/doc/index.html">v1.9.0</option>
<option value="v/v1.8.0/doc/index.html">v1.8.0</option>
<option value="v/v1.7.0/doc/index.html">v1.7.0</option>
<option value="v/v1.6.0/doc/index.html">v1.6.0</option>
<option value="v/v1.5.1/doc/index.html">v1.5.1</option>
<option value="v/v1.4.0/doc/index.html">v1.4.0</option>
<option value="v/v1.3.0/doc/index.html">v1.3.0</option>
<option value="v/v1.2.0/doc/index.html">v1.2.0</option>
<option value="v/v1.1.0/doc/index.html">v1.1.0</option>
<option value="v/v1.0.0/doc/index.html">v1.0.0</option>
<option value="/">首页</option>
</select>
<div class="zk-box p-none">
<a class="wzi" href="javascript:;">
<!-- <span>背景 </span> -->
<img class="theme-btn" src="static/icon/theme.svg">
<!-- <span class="zk-icon"></span> -->
</a>
<div class="zk-context theme-box">
<div>
<div style="height: 5px;"></div>
<span style="background-color: #FFFFFF;"></span>
<span style="background-color: #f5f5f5;"></span>
<span style="background-color: #F1FAFA;"></span>
<span style="background-color: #f5f5d5;"></span>
<span style="background-color: #d5f5f5;"></span>
<span style="background-color: #f5e5f5;"></span>
<span style="background-color: #E8E8FF;"></span>
<span style="background-color: #f0f9eb;"></span>
<span style="background-color: #ebe5dd;"></span>
<span style="background-color: #e8f4ff;"></span>
<!-- <span style="background-color: #F0DAD2;"></span> -->
<!-- <span style="background-color: #f5d5d5;"></span> -->
<!-- <span style="background-color: #FFFFE0;"></span> -->
<!-- <span style="background-color: #eeeeee;"></span> -->
<!-- <span style="background-color: #f5fafe;"></span> -->
</div>
</div>
</div>
<a class="wzi" href="index.html">首页</a>
<a class="wzi" href="doc.html">文档</a>
<a class="p-none wzi" href="#/more/link">案例</a>
<div class="zk-box">
<a class="wzi" href="javascript:;">
<span>视频 </span>
<span class="zk-icon"></span>
</a>
<div class="zk-context">
<div>
<a href="https://www.bilibili.com/video/BV1Zt421u7gk/" target="_blank">王清江唷99集</a>
<a href="https://www.bilibili.com/video/BV1kG411o7Ms/" target="_blank">筑梦信仰-joy20集</a>
<a href="https://www.bilibili.com/video/BV11u4y197JL/" target="_blank">达达-Java26集</a>
<a href="https://space.bilibili.com/473679148/video" target="_blank">晒太阳的盐22集</a>
</div>
</div>
</div>
<a class="p-none wzi" href="#/more/demand-commit">需求提交</a>
<!-- <a class="p-none wzi" href="#/more/blog">博客</a> -->
<a class="p-none wzi" href="#/more/join-group">加入讨论群</a>
<a class="p-none wzi" href="#/more/sa-token-donate">赞助</a>
<a class="p-none wzi" href="#/sso/sso-pro">🔥 SSO商业版</a>
<div class="zk-box">
<a class="wzi" href="javascript:;">
<span>相关资源 </span>
<span class="zk-icon"></span>
</a>
<div class="zk-context">
<div>
<!-- <a href="#/more/sa-token-donate">❤️ &nbsp;赞助</a> -->
<a href="#/more/update-log">更新日志</a>
<a href="#/more/common-questions">常见报错</a>
<a href="#/more/tj-gzh">推荐公众号</a>
<a href="#/more/blog">相关博客</a>
<div class="zk-fengexian"></div>
<!-- <a href="http://sa-app.dev33.cn/wall.html?name=sa-token" target="_blank">需求墙</a> -->
<a href="#/fun/sa-token-test">在线考试</a>
<a href="#/fun/issue-template">在线提问</a>
<!-- <a href="https://wj.qq.com/s2/10852322/0d8b/" target="_blank">需求提交</a> -->
<a href="#/more/wenjuan">问卷调查</a>
</div>
</div>
</div>
</nav>
</div>
<!-- <a href="/">
<div class="logo-box">
<img src="logo.png" title="logo" />
<h1 class="logo-text">Sa-Token</h1>
</div>
</a> -->
<div class="main-box">
<div id="app">加载中...</div>
</div>
<!-- 万维广告div -->
<div style="position: fixed; right: 0; bottom: 0; z-index: 10000; border: 0px #aaa solid;">
<div class="wwads-cn wwads-vertical" data-id="88" style="max-width:150px"></div>
</div>
<!-- 小助手div -->
<div class="p-none help-btn-box" style="position: fixed; right: 40px; bottom: 330px; z-index: 10000; border: 0px #aaa solid;">
<div class="help-tips" style="position: relative; left: -30px; top: -10px;"></div>
<div class="help-btn" style="width: 60px; height: 60px; text-align: center; border-radius: 50%; background-color: #42b983; cursor: pointer;">
<span style="font-size: 18px; color: #FFF; line-height: 60px;">Help</span>
</div>
</div>
<!-- UI逐渐显现 -->
<style type="text/css">
body{opacity: 0.01; transition: opacity 0.5s; background-color: #FFF;}
</style>
<script type="text/javascript">
setTimeout(function() {
document.body.style.opacity = 1;
}, 1);
</script>
<!-- -->
<script src="./static/docsify-plugin.js?v=7"></script>
<script src="./static/is-star-plugin.js?v=7"></script>
<script src="./static/is-fill-in-wj-plugin.js?v=7"></script>
<script>
var saTokenTopVersion = '1.38.0'; // Sa-Token最新版本
var name = '<img style="width: 60px; height: 60px; vertical-align: middle;" src="logo.png" alt="logo" /> ';
name += '<b style="font-size: 28px; vertical-align: middle;">Sa-Token</b> <sub>v' + saTokenTopVersion + '</sub>';
window.$docsify = {
// name: name, // 名字
repo: 'https://github.com/dromara/sa-token', // github地址
// themeColor: '#06A3D7', // 主题颜色
basePath: location.pathname.substr(0, location.pathname.lastIndexOf('/') + 1), // 自动计算项目名字
// basePath: '/sa-token-doc/', // 设置文件加载的父路径, 这在一些带项目名部署的文件中非常有效
auto2top: true, // 是否在切换页面后回到顶部
// coverpage: true, // 开启封面
subMaxLevel: 4, // 标题解析层级, 写几就在目录树中解析到几级标题 ,一般写2吧也就
loadSidebar: true, // 加载自定义侧边栏 , 目录定制在: _sidebar.md 文件 (需要创建 .nojekyll 的空文件,阻止 GitHub Pages 忽略命名是下划线开头的文件)
copyCode: { // 复制插件
buttonText: '复制到剪贴板',
errorText: '错误',
successText: '复制成功'
},
topMargin: 90, // 锚点距离顶部的距离
// sidebarDisplayLevel : 1 , // 设置侧边栏显示级别
// search: 'auto', // 搜索功能
alias: {
// '/sso/_sidebar.md': '/sso/_sidebar.md',
'/.*/_sidebar.md': '/_sidebar.md'
},
// tab选项卡
tabs: {
persist : true, // 是否在刷新页面时重置选项卡
sync : true, // 页面上的多个tab是否同步切换
theme : 'classic', // 主题:'classic', 'material', false
tabComments: true, // 用注释来标注选项卡标题,例如:<!-- tab:SpringBoot -->
tabHeadings: true // 用标题+粗体来定制选项卡
},
// 自定义插件
plugins: [myDocsifyPlugin, window.isStarPlugin, window.isFillInWjPlugin],
}
</script>
<script src="static/docsify.min.js"></script>
<script src="static/docsify-copy-code.min.js"></script>
<!-- 语言合集https://cdn.jsdelivr.net/npm/prismjs@1/components/ -->
<script src="static/prism/prism-java.min.js"></script>
<script src="static/prism/prism-gradle.min.js"></script>
<script src="static/prism/prism-yaml.min.js"></script>
<script src="static/prism/prism-properties.min.js"></script>
<!-- 搜索框 -->
<script src="static/search.min.js"></script>
<!-- 多 tab 切换 -->
<script src="static/docsify-tabs.min.js"></script>
<!-- img点击放大 -->
<script src="static/zoom-image.min.js"></script>
<!-- sidebar折叠 -->
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/sidebar.min.css" />
<script src="//cdn.jsdelivr.net/npm/docsify-sidebar-collapse/dist/docsify-sidebar-collapse.min.js"></script> -->
<!-- jqeury -->
<script src="static/jquery.min.js"></script>
<script src="static/layer-v3.1.1/layer.js"></script>
<!-- 渲染赞助数据 -->
<script src="static/donate/donate-list.js"></script>
<script src="static/donate/donate-fun.js"></script>
<script>
if(window.jQuery === undefined || window.Docsify === undefined) {
var str = 'CDN 加载失败,请打开备用地址:<a href="index-backup.html' + location.hash + '" target="_blank">index-backup.html</a>';
document.querySelector('#app').innerHTML = str;
}
</script>
<!-- 搜索引擎自动提交 -->
<script>
(function() {
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
} else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
<!-- 万维广告 -->
<script data-mode="hash" type="text/javascript" src="https://cdn.wwads.cn/js/makemoney.js" async></script>
<!-- 百度统计 -->
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?35ad501304eae758ac6139a22a9830f5";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script type="text/javascript">
// 预览版提示
if(location.host === 'rc.sa-token.cc') {
const newTips = '<b>当前文档为RC预览版文档仅做学习测试使用正式项目请使用正式版<a href="https://sa-token.cc/" target="_blank">https://sa-token.cc/</a></b>';
layer.alert(newTips);
}
</script>
<!-- 小助手提示 -->
<script>
$('.help-btn').click(function(){
var str = `
<div class="xiaozhushou-intro">
<p>1、你在使用 Sa-Token 时遇到任何技术难题,可以向 < sa-token 小助手 > 求助咨询。</p>
<p>2、该小助手不属于商业运营求助咨询完全免费。</p>
<p>3、目前该小助手属于试运营阶段每天只能提供大约 1 小时的求助时间。</p>
<p>4、根据运营效果反馈我们日后可能会提高求助时间但也可能关闭此功能。</p>
<p>5、该小助手由企业微信提供平台支持感谢企业微信。</p>
<p>6、不是 AI 是真人,不是 AI 是真人,不是 AI 是真人,重说三!</p>
<p style="margin-top: 30px;">打开方式:</p>
<p>1、如果你是使用 PC 端微信,请点此链接:<a href="https://work.weixin.qq.com/kfid/kfcdd45c432fee9655f" target="_blank">https://work.weixin.qq.com/kfid/kfcdd45c432fee9655f</a></p>
<p>2、如果你是使用手机端微信请扫码</p>
<p><img src="https://oss.dev33.cn/sa-token/sa-token-xiaozhushou.jpg" width="200px"></p>
<p>如果您的问题已解决,我们希望您能够花费一点时间将解决方案发布在:<a href="https://gitee.com/dromara/sa-token/issues/I9I9CY" target="_blank">踩坑记录征集</a>,帮助以后遇到同样问题的开发者快速排查,感激不尽!</p>
</div>
`;
layer.alert(str, {
title: '技术求助',
area: '650px',
offset: '10%',
})
})
try{
// 给个小提示
const index = layer.tips('框架技术支持,点此求助', '.help-tips', {
tips: [1, '#000'] ,//还可配置颜色
// time: 5000,
});
// 改为 fixed 定位,否则它会随着滚动条移动,样式就跑偏了
$('#layui-layer' + index).css('position', 'fixed');
}catch(e){
console.error(e);
}
</script>
<!-- 修改背景颜色 -->
<script>
// 绑定修改背景色的按钮事件
$('.theme-box span').click(function() {
let bgColor = this.style.backgroundColor;
setBg(bgColor);
localStorage.setItem('bg-color-value', bgColor)
})
// 读取上次记录
let bgColor = localStorage.getItem('bg-color-value');
if(bgColor) {
setBg(bgColor);
}
// 设置背景颜色
function setBg(bgColor) {
console.log('---- 背景颜色设定为:', bgColor);
// -------- 设置 body 背景
document.body.style.backgroundColor = bgColor;
// -------- 设置 header 头背景
// 如果是 16 进制,转 rgba
if(bgColor.indexOf('#') == 0) {
bgColor = hexToRgba(bgColor, 0.97);
}
// 如果是 rgb转 rgba
else if(bgColor.match(/\,/g).length == 2) {
bgColor = bgColor.replace(')', ' ,0.97)');
}
document.querySelector('.doc-header').style.backgroundColor = bgColor;
}
// 16进制 转 rgba
function hexToRgba(str, a){
a = a || 1;
var reg = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/
if(!reg.test(str)){return;}
let newStr = (str.toLowerCase()).replace(/\#/g,'')
let len = newStr.length;
if(len == 3){
let t = ''
for(var i=0;i<len;i++){
t += newStr.slice(i,i+1).concat(newStr.slice(i,i+1))
}
newStr = t
}
let arr = []; //将字符串分隔,两个两个的分隔
for(var i =0;i<6;i=i+2){
let s = newStr.slice(i,i+2)
arr.push(parseInt("0x" + s))
}
return 'rgb(' + arr.join(",") + ', ' + a + ')';
}
</script>
<!-- 赞助页的展开和收缩 -->
<script>
// 展开
function expandZanZhu(){
$('.zk-btn--1').hide();
$('.zk-btn--2').show();
$('.zanzhu-box').height($('.zanzhu-box table').height());
}
// 折叠
function foldZanZhu(){
$('.zanzhu-box').height(500);
$('.zk-btn--2').hide();
$('.zk-btn--1').show();
}
</script>
<!-- 赞助效果图展示 -->
<script>
function showSyzz(){
layer.photos({
photos: {
title: '',
id: new Date().getTime(),
start: 0,
data: [
{
pid: 1,
alt: 'gitee 开源项目推广,日增 star 74',
src: 'https://oss.dev33.cn/sa-token/more/syzz-xg-1.png',
},
{
pid: 2,
alt: 'gitee 开源项目推广,日增 star 247',
src: 'https://oss.dev33.cn/sa-token/more/syzz-xg-2.png',
},
{
pid: 3,
alt: '某互联网公司线下活动,报名邀请',
src: 'https://oss.dev33.cn/sa-token/more/syzz-xg-3.png',
},
{
pid: 4,
alt: 'gitee 开源项目推广,日增 star 70',
src: 'https://oss.dev33.cn/sa-token/more/syzz-xg-4.png',
}
]
}
,anim: 5 //0-6的选择指定弹出图片动画类型默认随机请注意3.0之前的版本用shift参数
});
}
</script>
</body>
</html>