v1.11.0更新

This commit is contained in:
shengzhang
2021-01-10 00:15:23 +08:00
parent 2d3a262e2f
commit 600cc98e20
20 changed files with 84 additions and 33 deletions

View File

@@ -1,11 +1,11 @@
<p align="center"> <p align="center">
<img alt="logo" src="https://gitee.com/sz6/sa-token/raw/master/sa-token-doc/doc/logo.png" width="150" height="150" style="margin-bottom: 10px;"> <img alt="logo" src="https://gitee.com/sz6/sa-token/raw/master/sa-token-doc/doc/logo.png" width="150" height="150" style="margin-bottom: 10px;">
</p> </p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.10.0</h1> <h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.11.0</h1>
<h4 align="center">这可能是史上功能最全的Java权限认证框架</h4> <h4 align="center">这可能是史上功能最全的Java权限认证框架</h4>
<h4 align="center"> <h4 align="center">
<a href="https://gitee.com/sz6/sa-token/stargazers"><img src="https://gitee.com/sz6/sa-token/badge/star.svg"></a> <a href="https://gitee.com/sz6/sa-token/stargazers"><img src="https://gitee.com/sz6/sa-token/badge/star.svg"></a>
<a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/sa--token-v1.10.0-2B9939"></a> <a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/sa--token-v1.11.0-2B9939"></a>
<a href="https://github.com/click33/sa-token/stargazers"><img src="https://img.shields.io/github/stars/click33/sa-token"></a> <a href="https://github.com/click33/sa-token/stargazers"><img src="https://img.shields.io/github/stars/click33/sa-token"></a>
<a href="https://github.com/click33/sa-token/watchers"><img src="https://img.shields.io/github/watchers/click33/sa-token"></a> <a href="https://github.com/click33/sa-token/watchers"><img src="https://img.shields.io/github/watchers/click33/sa-token"></a>
<a href="https://github.com/click33/sa-token/network/members"><img src="https://img.shields.io/github/forks/click33/sa-token"></a> <a href="https://github.com/click33/sa-token/network/members"><img src="https://img.shields.io/github/forks/click33/sa-token"></a>

View File

@@ -8,7 +8,7 @@
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId> <artifactId>sa-token-parent</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.10.0</version> <version>1.11.0</version>
<!-- 项目介绍 --> <!-- 项目介绍 -->
<name>sa-token</name> <name>sa-token</name>

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId> <artifactId>sa-token-parent</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</parent> </parent>
<packaging>jar</packaging> <packaging>jar</packaging>

View File

@@ -10,7 +10,7 @@ public class SaTokenConsts {
/** /**
* sa-token 版本号 * sa-token 版本号
*/ */
public static final String VERSION_NO = "v1.10.0"; public static final String VERSION_NO = "v1.11.0";
/** /**
* sa-token 开源地址 * sa-token 开源地址

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId> <artifactId>sa-token-parent</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</parent> </parent>
<packaging>jar</packaging> <packaging>jar</packaging>
@@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
<!-- RedisTemplate 相关操作API --> <!-- RedisTemplate 相关操作API -->
<dependency> <dependency>

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId> <artifactId>sa-token-parent</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</parent> </parent>
<packaging>jar</packaging> <packaging>jar</packaging>
@@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
<!-- RedisTemplate 相关操作API --> <!-- RedisTemplate 相关操作API -->
<dependency> <dependency>

View File

@@ -29,21 +29,21 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
<!-- sa-token整合redis (使用jdk默认序列化方式) --> <!-- sa-token整合redis (使用jdk默认序列化方式) -->
<!-- <dependency> <!-- <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-dao-redis</artifactId> <artifactId>sa-token-dao-redis</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> --> </dependency> -->
<!-- sa-token整合redis (使用jackson序列化方式) --> <!-- sa-token整合redis (使用jackson序列化方式) -->
<!-- <dependency> <!-- <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-dao-redis-jackson</artifactId> <artifactId>sa-token-dao-redis-jackson</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> --> </dependency> -->
<!-- 提供redis连接池 --> <!-- 提供redis连接池 -->
@@ -52,11 +52,11 @@
<artifactId>commons-pool2</artifactId> <artifactId>commons-pool2</artifactId>
</dependency> --> </dependency> -->
<!-- sa-token整合SpringAop实现注解鉴权 --> <!-- sa-token整合SpringAOP实现注解鉴权 -->
<!-- <dependency> <!-- <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-aop</artifactId> <artifactId>sa-token-spring-aop</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> --> </dependency> -->
<!-- @ConfigurationProperties --> <!-- @ConfigurationProperties -->

View File

@@ -14,7 +14,6 @@ import cn.dev33.satoken.annotation.SaCheckLogin;
* *
*/ */
@Service @Service
//@SaCheckLogin
public class TestService { public class TestService {
@SaCheckLogin @SaCheckLogin

View File

@@ -1,11 +1,11 @@
<p align="center"> <p align="center">
<img alt="logo" src="https://gitee.com/sz6/sa-token/raw/master/sa-token-doc/doc/logo.png" width="150" height="150" style="margin-bottom: 10px;"> <img alt="logo" src="https://gitee.com/sz6/sa-token/raw/master/sa-token-doc/doc/logo.png" width="150" height="150" style="margin-bottom: 10px;">
</p> </p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.10.0</h1> <h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.11.0</h1>
<h4 align="center">这可能是史上功能最全的Java权限认证框架</h4> <h4 align="center">这可能是史上功能最全的Java权限认证框架</h4>
<h4 align="center"> <h4 align="center">
<a href="https://gitee.com/sz6/sa-token/stargazers"><img src="https://gitee.com/sz6/sa-token/badge/star.svg"></a> <a href="https://gitee.com/sz6/sa-token/stargazers"><img src="https://gitee.com/sz6/sa-token/badge/star.svg"></a>
<a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/sa--token-v1.10.0-2B9939"></a> <a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/sa--token-v1.11.0-2B9939"></a>
<a href="https://github.com/click33/sa-token/stargazers"><img src="https://img.shields.io/github/stars/click33/sa-token"></a> <a href="https://github.com/click33/sa-token/stargazers"><img src="https://img.shields.io/github/stars/click33/sa-token"></a>
<a href="https://github.com/click33/sa-token/watchers"><img src="https://img.shields.io/github/watchers/click33/sa-token"></a> <a href="https://github.com/click33/sa-token/watchers"><img src="https://img.shields.io/github/watchers/click33/sa-token"></a>
<a href="https://github.com/click33/sa-token/network/members"><img src="https://img.shields.io/github/forks/click33/sa-token"></a> <a href="https://github.com/click33/sa-token/network/members"><img src="https://img.shields.io/github/forks/click33/sa-token"></a>

View File

@@ -22,6 +22,7 @@
<nav> <nav>
<select onchange="location.href=this.value"> <select onchange="location.href=this.value">
<option value="http://sa-token.dev33.cn/doc/index.html">最新版</option> <option value="http://sa-token.dev33.cn/doc/index.html">最新版</option>
<option value="http://sa-token.dev33.cn/v/v1.10.0/doc/index.html">v1.10.0</option>
<option value="http://sa-token.dev33.cn/v/v1.9.0/doc/index.html">v1.9.0</option> <option value="http://sa-token.dev33.cn/v/v1.9.0/doc/index.html">v1.9.0</option>
<option value="http://sa-token.dev33.cn/v/v1.8.0/doc/index.html">v1.8.0</option> <option value="http://sa-token.dev33.cn/v/v1.8.0/doc/index.html">v1.8.0</option>
<option value="http://sa-token.dev33.cn/v/v1.7.0/doc/index.html">v1.7.0</option> <option value="http://sa-token.dev33.cn/v/v1.7.0/doc/index.html">v1.7.0</option>
@@ -39,7 +40,7 @@
</div> </div>
<script> <script>
var name = '<img style="width: 50px; height: 50px; vertical-align: middle;" src="logo.png" alt="logo" /> '; var name = '<img style="width: 50px; height: 50px; vertical-align: middle;" src="logo.png" alt="logo" /> ';
name += '<b style="font-size: 24px; vertical-align: middle;">sa-token</b> <sub>v1.10.0</sub>' name += '<b style="font-size: 24px; vertical-align: middle;">sa-token</b> <sub>v1.11.0</sub>'
window.$docsify = { window.$docsify = {
name: name, // 名字 name: name, // 名字
repo: 'https://github.com/click33/sa-token', // github地址 repo: 'https://github.com/click33/sa-token', // github地址

View File

@@ -1,6 +1,11 @@
# 更新日志 # 更新日志
### 2021-1-9 @v1.11.0
- 新增提供AOP注解鉴权方案 **[重要]**
- 优化自动生成token的算法
### 2021-1-9 @v1.10.0 ### 2021-1-9 @v1.10.0
- 新增:提供查询所有会话方案 **[重要]** - 新增:提供查询所有会话方案 **[重要]**
- 修复修复token设置为永不过期时无法正常被顶下线的bug感谢github用户 @zjh599245299 提出的bug - 修复修复token设置为永不过期时无法正常被顶下线的bug感谢github用户 @zjh599245299 提出的bug

View File

@@ -9,7 +9,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
``` ```

View File

@@ -18,7 +18,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
``` ```

View File

@@ -73,9 +73,51 @@
``` ```
- mode有两种取值 mode有两种取值
- `SaMode.AND`, 标注一组权限,会话必须全部具有才可通过校验 - `SaMode.AND`, 标注一组权限,会话必须全部具有才可通过校验
- `SaMode.OR`, 标注一组权限,会话只要具有其一即可通过校验 - `SaMode.OR`, 标注一组权限,会话只要具有其一即可通过校验
## 4、AOP模式使用注解
使用拦截器方式,只能把注解加到`Controller层`上,那么如果我想把注解写到项目的任意位置,比如`Service层`,应该怎么办? <br>
很简单,你只需要将拦截器模式更换为`SpringAOP模式`即可, 在`pom.xml`里添加
``` xml
<!-- sa-token整合SpringAOP实现注解鉴权 -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-aop</artifactId>
<version>1.11.0</version>
</dependency>
```
然后你就可以在任意地方使用注解鉴权,例如:
``` java
@Service
public class UserService {
@SaCheckLogin
public List<String> getList() {
System.out.println("getList");
return new ArrayList<String>();
}
}
```
**注意拦截器模式和AOP模式不可同时集成否则会在Controller层发生一个注解校验两次的bug**

View File

@@ -11,7 +11,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-dao-redis</artifactId> <artifactId>sa-token-dao-redis</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
``` ```
优点兼容性好缺点session序列化后基本不可读对开发者来讲等同于乱码 优点兼容性好缺点session序列化后基本不可读对开发者来讲等同于乱码
@@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-dao-redis-jackson</artifactId> <artifactId>sa-token-dao-redis-jackson</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
``` ```
优点session序列化后可读性强可灵活手动修改缺点兼容性稍差 优点session序列化后可读性强可灵活手动修改缺点兼容性稍差

View File

@@ -32,7 +32,11 @@ StpUtil.searchTokenSessionId(String keyword, int start, int size);
使用示例: 使用示例:
``` java ``` java
StpUtil.searchTokenValue("1000", 0, 10); // 查询value包括1000的所有token结果集从第0条开始返回10条 // 查询value包括1000的所有token结果集从第0条开始返回10条
List<String> tokenList = StpUtil.searchTokenValue("1000", 0, 10);
for (String token : tokenList) {
System.out.println(token);
}
``` ```

View File

@@ -43,7 +43,7 @@
<!-- 内容部分 --> <!-- 内容部分 -->
<div class="main-box"> <div class="main-box">
<div class="content-box"> <div class="content-box">
<h1>sa-token<small>v1.10.0</small></h1> <h1>sa-token<small>v1.11.0</small></h1>
<div class="sub-title">一个JavaWeb轻量级权限认证框架功能全面上手简单</div> <div class="sub-title">一个JavaWeb轻量级权限认证框架功能全面上手简单</div>
<!-- <p>0配置开箱即用低学习成本</p> --> <!-- <p>0配置开箱即用低学习成本</p> -->
<p>登录验证、权限验证、Session会话、踢人下线、集成Redis、前后台分离、模拟他人账号、多账号体系、注解式鉴权、花式token、自动续签、同端互斥登录、会话治理、Spring集成...</p> <p>登录验证、权限验证、Session会话、踢人下线、集成Redis、前后台分离、模拟他人账号、多账号体系、注解式鉴权、花式token、自动续签、同端互斥登录、会话治理、Spring集成...</p>

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId> <artifactId>sa-token-parent</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</parent> </parent>
<packaging>jar</packaging> <packaging>jar</packaging>
@@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId> <artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
<!-- spring-boot-starter-aop --> <!-- spring-boot-starter-aop -->
<dependency> <dependency>

View File

@@ -31,7 +31,7 @@ public class SaCheckAspect {
} }
/** /**
* 定义AOP签名 --> (切入所有使用sa-token鉴权注解的方法) * 定义AOP签名 (切入所有使用sa-token鉴权注解的方法)
*/ */
public static final String POINTCUT_SIGN = "@within(cn.dev33.satoken.annotation.SaCheckLogin) || @annotation(cn.dev33.satoken.annotation.SaCheckLogin) || " public static final String POINTCUT_SIGN = "@within(cn.dev33.satoken.annotation.SaCheckLogin) || @annotation(cn.dev33.satoken.annotation.SaCheckLogin) || "
+ "@within(cn.dev33.satoken.annotation.SaCheckRole) || @annotation(cn.dev33.satoken.annotation.SaCheckRole) || " + "@within(cn.dev33.satoken.annotation.SaCheckRole) || @annotation(cn.dev33.satoken.annotation.SaCheckRole) || "
@@ -48,7 +48,7 @@ public class SaCheckAspect {
* 环绕切入 * 环绕切入
* @param joinPoint 切面对象 * @param joinPoint 切面对象
* @return 底层方法执行后的返回值 * @return 底层方法执行后的返回值
* @throws Throwable * @throws Throwable 底层方法抛出的异常
*/ */
@Around("pointcut()") @Around("pointcut()")
public Object around(ProceedingJoinPoint joinPoint) throws Throwable { public Object around(ProceedingJoinPoint joinPoint) throws Throwable {

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId> <artifactId>sa-token-parent</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</parent> </parent>
<packaging>jar</packaging> <packaging>jar</packaging>
@@ -19,7 +19,7 @@
<dependency> <dependency>
<groupId>cn.dev33</groupId> <groupId>cn.dev33</groupId>
<artifactId>sa-token-core</artifactId> <artifactId>sa-token-core</artifactId>
<version>1.10.0</version> <version>1.11.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>