mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-19 18:22:15 +08:00
v1.14.0 更新
This commit is contained in:
@@ -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">
|
<img alt="logo" src="https://gitee.com/sz6/sa-token/raw/master/sa-token-doc/doc/logo.png" width="150" height="150">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.13.0</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.14.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.13.0-2B9939"></a>
|
<a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/sa--token-v1.14.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>
|
||||||
@@ -87,7 +87,8 @@ StpUtil.checkLogin();
|
|||||||
@SaCheckPermission("user:add")
|
@SaCheckPermission("user:add")
|
||||||
@RequestMapping("/user/insert")
|
@RequestMapping("/user/insert")
|
||||||
public String insert(SysUser user) {
|
public String insert(SysUser user) {
|
||||||
return "用户增加";
|
// ...
|
||||||
|
return "用户增加";
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
4
pom.xml
4
pom.xml
@@ -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.13.0</version>
|
<version>1.14.0</version>
|
||||||
|
|
||||||
<!-- 项目介绍 -->
|
<!-- 项目介绍 -->
|
||||||
<name>sa-token</name>
|
<name>sa-token</name>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<!-- 一些属性 -->
|
<!-- 一些属性 -->
|
||||||
<properties>
|
<properties>
|
||||||
<sa-token-version>1.13.0</sa-token-version>
|
<sa-token-version>1.14.0</sa-token-version>
|
||||||
<jdk.version>1.8</jdk.version>
|
<jdk.version>1.8</jdk.version>
|
||||||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
|
||||||
|
@@ -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.13.0</version>
|
<version>1.14.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ public class SaBase64Util {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Base64解码,String 转 String
|
* Base64解码,String 转 String
|
||||||
* @param text Base64格式字符串
|
* @param base64Text Base64格式字符串
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
*/
|
*/
|
||||||
public static String decode(String base64Text){
|
public static String decode(String base64Text){
|
||||||
|
@@ -13,7 +13,7 @@ public class SaTokenConsts {
|
|||||||
/**
|
/**
|
||||||
* sa-token 版本号
|
* sa-token 版本号
|
||||||
*/
|
*/
|
||||||
public static final String VERSION_NO = "v1.13.0";
|
public static final String VERSION_NO = "v1.14.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sa-token 开源地址
|
* sa-token 开源地址
|
||||||
|
@@ -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.13.0</version>
|
<version>1.14.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
@@ -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.13.0</version>
|
<version>1.14.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<!-- 定义sa-token版本号 -->
|
<!-- 定义sa-token版本号 -->
|
||||||
<properties>
|
<properties>
|
||||||
<sa-token-version>1.13.0</sa-token-version>
|
<sa-token-version>1.14.0</sa-token-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
|
<!-- 定义sa-token版本号 -->
|
||||||
|
<sa-token-version>1.14.0</sa-token-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -30,7 +32,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.13.0</version>
|
<version>${sa-token-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- OkHttps网络请求库: http://okhttps.ejlchina.com/ -->
|
<!-- OkHttps网络请求库: http://okhttps.ejlchina.com/ -->
|
||||||
|
@@ -16,6 +16,8 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
|
<!-- 定义sa-token版本号 -->
|
||||||
|
<sa-token-version>1.14.0</sa-token-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -30,21 +32,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.13.0</version>
|
<version>${sa-token-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- sa-token 实现 oauth2.0 -->
|
<!-- sa-token 实现 oauth2.0 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
<artifactId>sa-token-oauth2</artifactId>
|
<artifactId>sa-token-oauth2</artifactId>
|
||||||
<version>1.13.0-alpha</version>
|
<version>1.14.0-alpha</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.13.0</version>
|
<version>${sa-token-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<!-- 定义sa-token版本号 -->
|
<!-- 定义sa-token版本号 -->
|
||||||
<properties>
|
<properties>
|
||||||
<sa-token-version>1.13.0</sa-token-version>
|
<sa-token-version>1.14.0</sa-token-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -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">
|
<img alt="logo" src="https://gitee.com/sz6/sa-token/raw/master/sa-token-doc/doc/logo.png" width="150" height="150">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.13.0</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">sa-token v1.14.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.13.0-2B9939"></a>
|
<a href="https://github.com/click33/sa-token"><img src="https://img.shields.io/badge/sa--token-v1.14.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>
|
||||||
@@ -87,7 +87,8 @@ StpUtil.checkLogin();
|
|||||||
@SaCheckPermission("user:add")
|
@SaCheckPermission("user:add")
|
||||||
@RequestMapping("/user/insert")
|
@RequestMapping("/user/insert")
|
||||||
public String insert(SysUser user) {
|
public String insert(SysUser user) {
|
||||||
return "用户增加";
|
// ...
|
||||||
|
return "用户增加";
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -21,6 +21,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.13.0/doc/index.html">v1.13.0</option>
|
||||||
<option value="http://sa-token.dev33.cn/v/v1.12.1/doc/index.html">v1.12.1</option>
|
<option value="http://sa-token.dev33.cn/v/v1.12.1/doc/index.html">v1.12.1</option>
|
||||||
<option value="http://sa-token.dev33.cn/v/v1.12.0/doc/index.html">v1.12.0</option>
|
<option value="http://sa-token.dev33.cn/v/v1.12.0/doc/index.html">v1.12.0</option>
|
||||||
<option value="http://sa-token.dev33.cn/v/v1.11.0/doc/index.html">v1.11.0</option>
|
<option value="http://sa-token.dev33.cn/v/v1.11.0/doc/index.html">v1.11.0</option>
|
||||||
@@ -42,7 +43,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.13.0</sub>'
|
name += '<b style="font-size: 24px; vertical-align: middle;">sa-token</b> <sub>v1.14.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地址
|
||||||
|
@@ -1,5 +1,22 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
### 2021-3-12 @v1.14.0
|
||||||
|
- 新增:新增`SaLoginModel`登录参数Model,适配 [记住我] 模式 **[重要]**
|
||||||
|
- 新增:新增 `StpUtil.setLoginId()` 时指定token有效期,可灵活控制用户的一次登录免验证时长
|
||||||
|
- 新增:新增Cookie时间判断,在`timeout`设置为-1时,`Cookie`有效期将为`Integer.MAX_VALUE` **[重要]**
|
||||||
|
- 新增:新增密码加密工具类,可快速MD5、SHA1、SHA256、AES、RSA加密 **[重要]**
|
||||||
|
- 新增:新增 OAuth2.0 模块 **[重要]**
|
||||||
|
- 新增:`SaTokenConfig`配置类所有set方法支持链式调用
|
||||||
|
- 新增:`SaOAuth2Config` sa-token oauth2 配置类所有set方法新增支持链式调用
|
||||||
|
- 优化:`StpLogic`类所有`getKey`方法重名为`splicingKey`,更语义化的函数名称
|
||||||
|
- 新增:`IsRunFunction`新增`noExe`函数,用于指定当`isRun`值为`false`时执行的函数
|
||||||
|
- 新增:`SaSession`新增数据存取值操作API
|
||||||
|
- 优化:优化`SaTokenDao`接口,增加Object操作API
|
||||||
|
- 优化:jwt示例`createToken`方法去除默认秘钥判断,只在启动项目时打印警告
|
||||||
|
- 文档:常见问题新增示例(修改密码后如何立即掉线)
|
||||||
|
- 文档:权限认证文档新增[如何把权限精确搭到按钮级]示例说明
|
||||||
|
- 文档:优化文档,部分模块添加图片说明
|
||||||
|
|
||||||
|
|
||||||
### 2021-2-9 @v1.13.0
|
### 2021-2-9 @v1.13.0
|
||||||
- 优化:优化源码注释与文档
|
- 优化:优化源码注释与文档
|
||||||
|
@@ -9,14 +9,14 @@
|
|||||||
<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.13.0</version>
|
<version>1.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
## Gradle依赖
|
## Gradle依赖
|
||||||
Gradle用户引入依赖:
|
Gradle用户引入依赖:
|
||||||
```
|
```
|
||||||
implementation 'cn.dev33:sa-token-spring-boot-starter:1.13.0'
|
implementation 'cn.dev33:sa-token-spring-boot-starter:1.14.0'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -34,8 +34,12 @@ implementation 'cn.dev33:sa-token-spring-boot-starter:1.13.0'
|
|||||||
├── sa-token-dao-redis // sa-token整合redis (使用jdk默认序列化方式)
|
├── sa-token-dao-redis // sa-token整合redis (使用jdk默认序列化方式)
|
||||||
├── sa-token-dao-redis-jackson // sa-token整合redis (使用jackson序列化方式)
|
├── sa-token-dao-redis-jackson // sa-token整合redis (使用jackson序列化方式)
|
||||||
├── sa-token-spring-aop // sa-token整合SpringAOP 注解鉴权
|
├── sa-token-spring-aop // sa-token整合SpringAOP 注解鉴权
|
||||||
|
├── sa-token-oauth2 // sa-token实现 OAuth2.0 模块(内测暂未发布)
|
||||||
├── sa-token-demo-springboot // sa-token示例
|
├── sa-token-demo-springboot // sa-token示例
|
||||||
├── sa-token-demo-jwt // sa-token集成jwt示例
|
├── sa-token-demo-jwt // sa-token集成jwt示例
|
||||||
|
├── sa-token-demo-oauth2 // sa-token集成OAuth2.0模块示例
|
||||||
|
├── sa-token-demo-oauth2-client // OAuth2.0 客户端
|
||||||
|
├── sa-token-demo-oauth2-server // OAuth2.0 服务端
|
||||||
├── sa-token-doc // sa-token开发文档
|
├── sa-token-doc // sa-token开发文档
|
||||||
├──pom.xml
|
├──pom.xml
|
||||||
```
|
```
|
||||||
@@ -46,7 +50,7 @@ implementation 'cn.dev33:sa-token-spring-boot-starter:1.13.0'
|
|||||||
## jar包下载
|
## jar包下载
|
||||||
[点击下载:sa-token-1.6.0.jar](https://oss.dev33.cn/sa-token/sa-token-1.6.0.jar)
|
[点击下载:sa-token-1.6.0.jar](https://oss.dev33.cn/sa-token/sa-token-1.6.0.jar)
|
||||||
|
|
||||||
(注意:当前仅提供`v1.6.0`版本jar包下载,更多版本请前往maven中央仓库获取)
|
(注意:当前仅提供`v1.6.0`版本jar包下载,更多版本请前往maven中央仓库获取,[直达链接](https://search.maven.org/search?q=sa-token))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,7 +19,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.13.0</version>
|
<version>1.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ sa-token内置两种模式完成注解鉴权,分别是`AOP模式`和`拦截器
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
<artifactId>sa-token-spring-aop</artifactId>
|
<artifactId>sa-token-spring-aop</artifactId>
|
||||||
<version>1.13.0</version>
|
<version>1.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ Sa-token默认将会话数据保存在内存中,此模式读写速度最快,
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
<artifactId>sa-token-dao-redis</artifactId>
|
<artifactId>sa-token-dao-redis</artifactId>
|
||||||
<version>1.13.0</version>
|
<version>1.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
优点:兼容性好,缺点:Session序列化后基本不可读,对开发者来讲等同于乱码
|
优点:兼容性好,缺点:Session序列化后基本不可读,对开发者来讲等同于乱码
|
||||||
@@ -26,7 +26,7 @@ Sa-token默认将会话数据保存在内存中,此模式读写速度最快,
|
|||||||
<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.13.0</version>
|
<version>1.14.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
优点:Session序列化后可读性强,可灵活手动修改,缺点:兼容性稍差
|
优点:Session序列化后可读性强,可灵活手动修改,缺点:兼容性稍差
|
||||||
|
@@ -26,8 +26,8 @@ Cookie作为浏览器提供的默认会话跟踪机制,其生命周期有两
|
|||||||
- 永久Cookie:有效期为一个具体的时间,在时间未到期之前,即使用户关闭了浏览器Cookie也不会消失
|
- 永久Cookie:有效期为一个具体的时间,在时间未到期之前,即使用户关闭了浏览器Cookie也不会消失
|
||||||
|
|
||||||
利用Cookie的此特性,我们便可以轻松实现 [记住我] 模式:
|
利用Cookie的此特性,我们便可以轻松实现 [记住我] 模式:
|
||||||
- 勾选[记住我]按钮时:调用`StpUtil.setLoginId(10001, true)`,在浏览器写入一个`永久Cookie`保存token,此时用户即使重启浏览器token依然有效
|
- 勾选[记住我]按钮时:调用`StpUtil.setLoginId(10001, true)`,在浏览器写入一个`永久Cookie`储存token,此时用户即使重启浏览器token依然有效
|
||||||
- 不勾选[记住我]按钮时:调用`StpUtil.setLoginId(10001, false)`,在浏览器写入一个`临时Cookie`保存token,此时用户在重启浏览器后token便会消失,导致会话失效
|
- 不勾选[记住我]按钮时:调用`StpUtil.setLoginId(10001, false)`,在浏览器写入一个`临时Cookie`储存token,此时用户在重启浏览器后token便会消失,导致会话失效
|
||||||
|
|
||||||
|
|
||||||
### 前后台分离模式下如何实现[记住我]?
|
### 前后台分离模式下如何实现[记住我]?
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
<!-- 内容部分 -->
|
<!-- 内容部分 -->
|
||||||
<div class="main-box">
|
<div class="main-box">
|
||||||
<div class="content-box">
|
<div class="content-box">
|
||||||
<h1>sa-token<small>v1.13.0</small></h1>
|
<h1>sa-token<small>v1.14.0</small></h1>
|
||||||
<div class="sub-title">这可能是史上功能最全的java权限认证框架!</div>
|
<div class="sub-title">这可能是史上功能最全的java权限认证框架!</div>
|
||||||
<!-- <p>0配置开箱即用,低学习成本</p> -->
|
<!-- <p>0配置开箱即用,低学习成本</p> -->
|
||||||
<p>登录验证、权限验证、Session会话、踢人下线、集成Redis、分布式会话、单点登录、前后台分离、模拟他人账号、临时身份切换、多账号体系、注解式鉴权、路由拦截式鉴权、花式token、自动续签、同端互斥登录、会话治理、Spring集成...</p>
|
<p>登录验证、权限验证、Session会话、踢人下线、集成Redis、分布式会话、单点登录、前后台分离、模拟他人账号、临时身份切换、多账号体系、注解式鉴权、路由拦截式鉴权、花式token、自动续签、同端互斥登录、会话治理、Spring集成...</p>
|
||||||
|
@@ -9,3 +9,4 @@ sa-token-oauth2 模块是 sa-token 实现 oauth2.0 的部分,目前该模块
|
|||||||
3. 根据控制台打印,访问测试地址即可:[http://localhost:8002/login.html](http://localhost:8002/login.html)
|
3. 根据控制台打印,访问测试地址即可:[http://localhost:8002/login.html](http://localhost:8002/login.html)
|
||||||
|
|
||||||
可结合代码注释学习查看
|
可结合代码注释学习查看
|
||||||
|
|
||||||
|
@@ -7,13 +7,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>cn.dev33</groupId>
|
<groupId>cn.dev33</groupId>
|
||||||
<artifactId>sa-token-parent</artifactId>
|
<artifactId>sa-token-parent</artifactId>
|
||||||
<version>1.13.0</version>
|
<version>1.14.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>sa-token-dao-redis</name>
|
<name>sa-token-dao-redis</name>
|
||||||
<artifactId>sa-token-oauth2</artifactId>
|
<artifactId>sa-token-oauth2</artifactId>
|
||||||
<version>1.13.0-alpha</version>
|
<version>1.14.0-alpha</version>
|
||||||
<description>sa-token realization oauth2.0</description>
|
<description>sa-token realization oauth2.0</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -523,7 +523,7 @@ public interface SaOAuth2Interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取key:[Client&账号]最新授权码记录, 持久化使用的key
|
* 获取key:[Client and 账号]最新授权码记录, 持久化使用的key
|
||||||
* @param loginId 账号id
|
* @param loginId 账号id
|
||||||
* @param clientId 应用id
|
* @param clientId 应用id
|
||||||
* @return key
|
* @return key
|
||||||
|
@@ -51,6 +51,7 @@ public class SaOAuth2Util {
|
|||||||
* @param clientId 应用id
|
* @param clientId 应用id
|
||||||
* @param scope 权限
|
* @param scope 权限
|
||||||
* @param loginId 账号id
|
* @param loginId 账号id
|
||||||
|
* @return 是否已经授权
|
||||||
*/
|
*/
|
||||||
public static boolean isGrant(Object loginId, String clientId, String scope) {
|
public static boolean isGrant(Object loginId, String clientId, String scope) {
|
||||||
return SaOAuth2Manager.getInterface().isGrant(loginId, clientId, scope);
|
return SaOAuth2Manager.getInterface().isGrant(loginId, clientId, scope);
|
||||||
|
@@ -50,6 +50,7 @@ public class RequestAuthModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clientId 要设置的 clientId
|
* @param clientId 要设置的 clientId
|
||||||
|
* @return 对象自身
|
||||||
*/
|
*/
|
||||||
public RequestAuthModel setClientId(String clientId) {
|
public RequestAuthModel setClientId(String clientId) {
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
@@ -65,6 +66,7 @@ public class RequestAuthModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param scope 要设置的 scope
|
* @param scope 要设置的 scope
|
||||||
|
* @return 对象自身
|
||||||
*/
|
*/
|
||||||
public RequestAuthModel setScope(String scope) {
|
public RequestAuthModel setScope(String scope) {
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
@@ -80,6 +82,7 @@ public class RequestAuthModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param loginId 要设置的 loginId
|
* @param loginId 要设置的 loginId
|
||||||
|
* @return 对象自身
|
||||||
*/
|
*/
|
||||||
public RequestAuthModel setLoginId(Object loginId) {
|
public RequestAuthModel setLoginId(Object loginId) {
|
||||||
this.loginId = loginId;
|
this.loginId = loginId;
|
||||||
@@ -95,6 +98,7 @@ public class RequestAuthModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param redirectUri 要设置的 redirectUri
|
* @param redirectUri 要设置的 redirectUri
|
||||||
|
* @return 对象自身
|
||||||
*/
|
*/
|
||||||
public RequestAuthModel setRedirectUri(String redirectUri) {
|
public RequestAuthModel setRedirectUri(String redirectUri) {
|
||||||
this.redirectUri = redirectUri;
|
this.redirectUri = redirectUri;
|
||||||
@@ -110,6 +114,7 @@ public class RequestAuthModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param responseType 要设置的 responseType
|
* @param responseType 要设置的 responseType
|
||||||
|
* @return 对象自身
|
||||||
*/
|
*/
|
||||||
public RequestAuthModel setResponseType(String responseType) {
|
public RequestAuthModel setResponseType(String responseType) {
|
||||||
this.responseType = responseType;
|
this.responseType = responseType;
|
||||||
@@ -125,6 +130,7 @@ public class RequestAuthModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state 要设置的 state
|
* @param state 要设置的 state
|
||||||
|
* @return 对象自身
|
||||||
*/
|
*/
|
||||||
public RequestAuthModel setState(String state) {
|
public RequestAuthModel setState(String state) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
@@ -133,6 +139,7 @@ public class RequestAuthModel {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查此Model参数是否有效
|
* 检查此Model参数是否有效
|
||||||
|
* @return 对象自身
|
||||||
*/
|
*/
|
||||||
public RequestAuthModel checkModel() {
|
public RequestAuthModel checkModel() {
|
||||||
if(SaTokenInsideUtil.isEmpty(clientId)) {
|
if(SaTokenInsideUtil.isEmpty(clientId)) {
|
||||||
|
@@ -26,7 +26,7 @@ public class ScopeModel {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 构造一个
|
* 构造一个
|
||||||
* @param id 权限id
|
* @param name 权限名称
|
||||||
* @param introduce 权限详细介绍
|
* @param introduce 权限详细介绍
|
||||||
*/
|
*/
|
||||||
public ScopeModel(String name, String introduce) {
|
public ScopeModel(String name, String introduce) {
|
||||||
|
@@ -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.13.0</version>
|
<version>1.14.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
@@ -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.13.0</version>
|
<version>1.14.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user