Skip to content

Commit

Permalink
v1.25.0 更新
Browse files Browse the repository at this point in the history
  • Loading branch information
click33 committed Aug 16, 2021
1 parent 798a554 commit 66639ed
Show file tree
Hide file tree
Showing 40 changed files with 76 additions and 52 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center">
<img alt="logo" src="https://gitee.com/dromara/sa-token/raw/master/sa-token-doc/doc/logo.png" width="150" height="150">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">Sa-Token v1.24.0</h1>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">Sa-Token v1.25.0</h1>
<h4 align="center">这可能是史上功能最全的 Java 权限认证框架!</h4>
<p align="center">
<a href="https://gitee.com/dromara/sa-token/stargazers"><img src="https://gitee.com/dromara/sa-token/badge/star.svg"></a>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId>
<packaging>pom</packaging>
<version>1.24.0</version>
<version>1.25.0</version>

<!-- 项目介绍 -->
<name>sa-token</name>
Expand Down Expand Up @@ -36,7 +36,7 @@

<!-- 一些属性 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
<jdk.version>1.8</jdk.version>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId>
<version>1.24.0</version>
<version>1.25.0</version>
</parent>
<packaging>jar</packaging>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public String getCheckTicketUrl() {

/**
* @param checkTicketUrl SSO-Server端Ticket校验地址
* @return 对象自身
*/
public SaSsoConfig setCheckTicketUrl(String checkTicketUrl) {
this.checkTicketUrl = checkTicketUrl;
Expand Down Expand Up @@ -294,7 +295,7 @@ public SaSsoConfig setDoLoginHandle(BiFunction<String, String, Object> doLoginHa
}

/**
* @param SSO-Client端:自定义校验Ticket返回值的处理逻辑 (每次从认证中心获取校验Ticket的结果后调用)
* @param ticketResultHandle SSO-Client端:自定义校验Ticket返回值的处理逻辑 (每次从认证中心获取校验Ticket的结果后调用)
* @return 对象自身
*/
public SaSsoConfig setTicketResultHandle(BiFunction<Object, String, Object> ticketResultHandle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public default boolean isAjax() {

/**
* 转发请求
* @param url 转发地址
* @param path 转发地址
* @return 任意值
*/
public default Object forward(String path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class IdTokenInvalidException extends SaTokenException {

/**
* 一个异常:代表提供的 Id-Token 无效
* @param message 异常描述
*/
public IdTokenInvalidException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public String refreshToken() {

/**
* 保存Id-Token
* @param token
* @param token token
*/
public void saveToken(String token) {
if(SaFoxUtil.isEmpty(token)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SaTokenConsts {
/**
* Sa-Token 当前版本号
*/
public static final String VERSION_NO = "v1.24.1";
public static final String VERSION_NO = "v1.25.0";

/**
* Sa-Token 开源地址
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-alone-redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-jwt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-oauth2-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<!-- 定义sa-token版本号 -->
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-oauth2-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<!-- 定义sa-token版本号 -->
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-quick-login/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-solon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-springboot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-sso1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-sso2-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-sso2-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-sso3-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-sso3-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-demo/sa-token-demo-webflux/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<!-- 定义sa-token版本号 -->
<properties>
<sa-token-version>1.24.0</sa-token-version>
<sa-token-version>1.25.0</sa-token-version>
</properties>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-doc/doc/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p align="center">
<img alt="logo" src="https://gitee.com/dromara/sa-token/raw/master/sa-token-doc/doc/logo.png" width="150" height="150">
</p>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">Sa-Token v1.24.0</h1>
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">Sa-Token v1.25.0</h1>
<h4 align="center">这可能是史上功能最全的 Java 权限认证框架!</h4>
<p align="center">
<a href="https://gitee.com/dromara/sa-token/stargazers"><img src="https://gitee.com/dromara/sa-token/badge/star.svg"></a>
Expand Down
3 changes: 2 additions & 1 deletion sa-token-doc/doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ <h1 class="logo-text">Sa-Token</h1>
<nav>
<select onchange="location.href=this.value">
<option value="http://sa-token.dev33.cn/doc/index.html">最新版</option>
<option value="http://sa-token.dev33.cn/v/v1.24.0/doc/index.html">v1.24.0</option>
<option value="http://sa-token.dev33.cn/v/v1.23.0/doc/index.html">v1.23.0</option>
<option value="http://sa-token.dev33.cn/v/v1.22.0/doc/index.html">v1.22.0</option>
<option value="http://sa-token.dev33.cn/v/v1.21.0/doc/index.html">v1.21.0</option>
Expand Down Expand Up @@ -59,7 +60,7 @@ <h1 class="logo-text">Sa-Token</h1>
</div>

<script>
var saTokenTopVersion = '1.24.0'; // Sa-Token最新版本
var saTokenTopVersion = '1.25.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 = {
Expand Down
20 changes: 20 additions & 0 deletions sa-token-doc/doc/more/update-log.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# 更新日志


### 2021-8-16 @v1.25.0
- 新增:`SaRequest`新增`getHeader(name, defaultValue)`方法,用于获取header默认值
- 新增:`SaRequest` 添加 `forward` 转发方法
- 新增:Readme新增源码模块介绍、友情链接、正在使用Sa-Token的项目
- 重构:重构SSO单点登录模块源码,增加可读性
- 新增:SSO配置表新增所属端说明
- 新增:SSO模式三新增账号资料同步示例 **[重要]**
- 新增:前后端分离模式下接入SSO的示例 **[重要]**
- 优化:优化SSO单点注销重定向逻辑
- 重构:重构SSO单点登录模块部分API
- 优化:优化SaQuickBean中过滤器处理逻辑
- 文档:优化文档样式,增加示例
- 文档:代码鉴权、注解鉴权、路由拦截鉴权,选择指南
- 文档:文档新增 SSO旧有系统改造指南
- 文档:SSO集成文档里添加API列表
- 文档:新增 `Sa-Token-Study` 链接,讲解 Sa-Token 源码涉及到的技术点
- 不兼容更新重构:
- 重构:修复 `SaReactorHolder.getContent()` 拼写错误:`content` -> `context`


### 2021-7-24 @v1.24.0
- 修复:修复部分场景下Alone-Redis插件导致项目无法启动的问题
- 优化:增加对SpringBoot1.x版本的兼容性
Expand Down
30 changes: 15 additions & 15 deletions sa-token-doc/doc/sso/sso-cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

### 一、何时引导用户去登录?

以下解决方案三选一
以下方案三选一

##### 1.1、前端按钮跳转
前端页面准备一个**`[登录]`**按钮,当用户点击按钮时,跳转到登录接口
Expand Down Expand Up @@ -76,9 +76,8 @@ if(res.code == 401) {



### 二、定制化开发
### 二、如何自定义登录视图?

##### 2.1、如何自定义登录视图?
- 方式一:在demo示例中直接更改页面代码
- 方式二:在配置中配置登录视图地址

Expand All @@ -90,16 +89,17 @@ cfg.sso
})
```

##### 2.2、如何自定义登录API的接口?

### 三、如何自定义登录API的接口?
根据需求点选择解决方案:

**2.2.1、如果只是想在 setDoLoginHandle 函数里获取除 name、pwd 以外的参数?**
##### 3.1、如果只是想在 setDoLoginHandle 函数里获取除 name、pwd 以外的参数?
``` java
// 在任意代码处获取前端提交的参数
String xxx = SaHolder.getRequest().getParam("xxx");
```

**2.2.2、想完全自定义一个接口来接受前端登录请求?**
##### 3.2、想完全自定义一个接口来接受前端登录请求?
``` java
// 直接定义一个拦截路由为 `/sso/doLogin` 的接口即可
@RequestMapping("/sso/doLogin")
Expand All @@ -113,18 +113,18 @@ public SaResult ss(String name, String pwd) {
}
```

**2.2.3、不想使用`/sso/doLogin`这个接口,想自定义一个API地址?**
##### 3.3、不想使用`/sso/doLogin`这个接口,想自定义一个API地址?

答:直接在前端更改点击按钮时 Ajax 的请求地址即可


### 、前后端分离架构下的整合方案
### 、前后端分离架构下的整合方案

如果我们已有的系统是前后端分离模式,我们显然不能为了接入SSO而改造系统的基础架构,官方仓库的示例采用的是前后端一体方案,要将其改造为前后台分离架构模式非常简单

`sa-token-demo-sso2-client`为例:

##### 3.1、新建`H5Controller`开放接口
##### 4.1、新建`H5Controller`开放接口
``` java
/**
* 前后台分离架构下集成SSO所需的代码
Expand Down Expand Up @@ -166,13 +166,13 @@ public class H5Controller {
}
```

##### 3.2、增加跨域过滤器`CorsFilter.java`
##### 4.2、增加跨域过滤器`CorsFilter.java`
源码详见:[CorsFilter.java](https://gitee.com/dromara/sa-token/tree/master/sa-token-demo/sa-token-demo-sso2-client/src/main/java/com/pj/h5/CorsFilter.java)
将其复制到项目中即可

##### 3.3、新建前端项目
##### 4.3、新建前端项目
任意文件夹新建前端项目:`sa-token-demo-sso2-client-h5`,在根目录添加测试文件:`index.html`
``` xml
``` js
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -214,16 +214,16 @@ public class H5Controller {
</html>
```

##### 3.4、添加登录处理文件`sso-login.html`
##### 4.4、添加登录处理文件`sso-login.html`
源码详见:[sso-login.html](https://gitee.com/dromara/sa-token/tree/master/sa-token-demo/sa-token-demo-sso2-client-h5/sso-login.html)
将其复制到项目中即可,与`index.html`一样放在根目录下


##### 3.5、测试
##### 4.5、测试
先启动Server服务端与Client服务端,再随便找个能预览html的工具打开前端项目(比如[HBuilderX](https://www.dcloud.io/hbuilderx.html)),测试流程与一体版一致


### 、常见疑问
### 、常见疑问

##### 问:在模式一与模式二中,Client端 必须通过 Alone-Redis 插件来访问Redis吗?

Expand Down
2 changes: 1 addition & 1 deletion sa-token-doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div class="content-box">
<div class="fenge"></div>
<!-- <img class="title-logo" src="./doc/logo.png" onclick="alert('别点我, 快去点star!')"> -->
<h1>Sa-Token<small>v1.24.0</small></h1>
<h1>Sa-Token<small>v1.25.0</small></h1>
<div class="sub-title"> 这可能是史上功能最全的java权限认证框架!</div>
<div class="btn-box">
<a href="https://github.com/dromara/sa-token" target="_blank">GitHub</a>
Expand Down
2 changes: 1 addition & 1 deletion sa-token-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-parent</artifactId>
<version>1.24.0</version>
<version>1.25.0</version>
</parent>
<packaging>pom</packaging>

Expand Down
2 changes: 1 addition & 1 deletion sa-token-plugin/sa-token-alone-redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-plugin</artifactId>
<version>1.24.0</version>
<version>1.25.0</version>
</parent>
<packaging>jar</packaging>

Expand Down
2 changes: 1 addition & 1 deletion sa-token-plugin/sa-token-dao-redis-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-plugin</artifactId>
<version>1.24.0</version>
<version>1.25.0</version>
</parent>
<packaging>jar</packaging>

Expand Down
Loading

0 comments on commit 66639ed

Please sign in to comment.