Skip to content

Commit dbfc876

Browse files
committed
update docs
1 parent 543a7d4 commit dbfc876

File tree

6 files changed

+52
-52
lines changed

6 files changed

+52
-52
lines changed

docs/.vuepress/sidebar.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export const mySidebar: ThemeSidebarMulti = {
4040
{ text: '切换数据库', link: 'db' },
4141
{ text: 'JWT', link: 'jwt' },
4242
{ text: 'RBAC', link: 'RBAC' },
43+
{ text: 'OAuth 2.0', link: 'oauth2' },
44+
{ text: 'SSO', link: 'sso' },
4345
{ text: '数据规则', link: '/planet', icon: 'fluent-color:video-16' },
4446
{ text: '代码生成', link: 'code-generation' },
4547
{ text: '跨域', link: 'CORS' },

docs/backend/reference/jwt.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
title: JWT
33
---
44

5-
我们编写了自定义的 JWT 授权中间件,使其可以在每次请求发起时,自动调用此中间件实现自动授权,并且,通过 Redis 和 Rust
5+
我们编写了 JWT 授权中间件,使其可以在每次请求发起时,能够实现自动授权,并且还使用 Redis 和 Rust
66
库对用户信息进行缓存和解析,使其性能影响尽可能降到最低
77

8-
@[code python](../../code/jwt.py)
9-
108
## 接口鉴权
119

1210
在文件 `backend/common/security/jwt.py` 中,包含以下代码
@@ -26,8 +24,14 @@ async def hello():
2624

2725
## Token
2826

29-
内置 token 授权方式遵循 [rfc6750](https://datatracker.ietf.org/doc/html/rfc6750),如果您想通过自定义请求头添加 token
30-
进行授权,可以查看文章 [Header Token](../../planet.md#fastapi)
27+
内置 token 授权方式遵循 [rfc6750](https://datatracker.ietf.org/doc/html/rfc6750)
28+
29+
如果您想通过自定义请求头添加 token 进行授权,可查看文章:
30+
[<Icon name="fluent-color:receipt-16" />Header Token](../../planet.md)
31+
32+
## Swagger 登录
33+
34+
这是一种快捷的授权方式,仅用于调试目的,在服务启动后,进入 Swagger 文档,可通过此调试接口快速获取 token(无需验证码)
3135

3236
## 验证码登录
3337

@@ -53,16 +57,3 @@ fast_captcha ->> Redis: 缓存验证码
5357
路由 ->> Token: 生成 Token
5458
Token -->> 客户端: 成功
5559
```
56-
57-
## Swagger 登录
58-
59-
这是一种快捷的授权方式,仅用于调试目的,在服务启动后,进入 Swagger 文档,可通过此调试接口快速获取 token(无需验证码)
60-
61-
## OAuth 2.0
62-
63-
这种授权方式通常适用于第三方平台认证登录,第三方授权成功后,将依据第三方平台信息自动创建本地用户并自动授权登录,这一切都是用户无感知的
64-
65-
但是,想要使用此方式进行授权,你需要先了解 OAuth 2.0 相关知识,并遵循第三方平台认证要求,获取平台应用相关密钥,最终,手动编码完成集成
66-
67-
我们在 fba 中使用 [fastapi-oauth20](https://github.com/fastapi-practices/fastapi-oauth20) 集成 OAuth 2.0,您可以在代码路径
68-
`backend/app/admin/api/v1/oauth2` 中查看我们的官方实现示例

docs/backend/reference/oauth2.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: OAuth 2.0
3+
---
4+
5+
此授权方式适用于第三方平台认证登录,第三方授权成功后,将依据第三方平台信息自动创建本地用户并自动授权登录,用户只需同意第三方授权即可
6+
7+
但是,想要使用此方式进行授权,你需要先了解 OAuth 2.0 相关知识,并遵循第三方平台认证要求,获取第三方平台授权密钥,最终,手动编码完成集成
8+
9+
我们在 fba 中使用 [fastapi-oauth20](https://github.com/fastapi-practices/fastapi-oauth20) 集成 OAuth 2.0,您可以在
10+
`backend/app/admin/api/v1/oauth2` 目录中查看我们的官方实现示例

docs/backend/reference/sso.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: SSO
3+
---
4+
5+
SSO(单点登录,Single Sign-On)是一种身份验证机制,允许用户只需登录一次即可访问多个相关系统或应用,无需重复输入凭据
6+
7+
**优点:**
8+
9+
- 提升用户体验,减少登录次数
10+
- 简化企业身份管理,统一权限控制
11+
- 增强安全性,支持多因素认证,降低密码泄露风险
12+
13+
**适用场景**:企业内部系统、云服务、跨平台应用等
14+
15+
## 集成
16+
17+
我们将通过 [casdoor](https://casdoor.org/) 实现 SSO 集成,并将其作为 [SSO 插件](../../planet.md#插件) 发布
18+
19+
有关 SSO 的实现细节和更多用法请访问 casdoor 官方文档

docs/code/jwt.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

docs/planet.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,32 @@ title: 知识星球
33
---
44

55
<div align="center">
6+
67
星球内容为非公开内容,扫码加入知识星球,即可获取独家内容
78

89
附:星球用于 [有偿赞助](../../sponsors.md#有偿赞助),加入 Discord
910
社区,即可 [领取免费体验资格](https://discord.gg/Sdg6dT5kjz)
11+
1012
</div>
1113

1214
::: details 如果您觉得还不错,欢迎正式加入订阅
15+
1316
<div align="center">
1417
<p style="color: #fd7600">我们在节假日会在 Discord 社区统一发送大额优惠券,敬请关注</p>
1518
<img height="349" width="415" src="https://wu-clan.github.io/picx-images-hosting/知识星球.png" alt="知识星球">
1619
</div>
20+
1721
:::
1822

1923
## 文章
2024

2125
- <Icon name="fluent-color:receipt-16" /> 纯文字文章
2226
- <Icon name="fluent-color:video-16" /> 带有视频讲解的文章
2327

24-
### fba 专属
28+
### fba
2529

2630
::: note
27-
此分类下的文章主要应用于 fba 架构,可能无法应用于其他三方架构方案
31+
此分类下的文章可用于 fba 架构,可能无法应用于其他三方架构方案
2832
:::
2933

3034
<CardGrid>
@@ -66,10 +70,10 @@ title: 知识星球
6670
/>
6771
</CardGrid>
6872

69-
### FastAPI 通用
73+
### FastAPI
7074

7175
::: note
72-
此分类下的文章可应用于任何基于 FastAPI 框架开发的架构
76+
此分类下的文章可用于任何基于 FastAPI 框架开发的架构
7377
:::
7478

7579
<CardGrid>
@@ -90,12 +94,13 @@ title: 知识星球
9094
## 插件
9195

9296
::: note
93-
此分类下的插件仅可应用于 fba 架构的 [插件系统](./plugin/market.md)
97+
此分类下的文章可用于 fba 架构的 [插件系统](./plugin/market.md)
9498
:::
9599

96100
<CardGrid>
97101
<LinkCard
98-
title="空"
99-
description="..."
102+
title="SSO(制作中...)"
103+
icon="fluent-color:receipt-16"
104+
description="通过 casdoor 实现 SSO 集成"
100105
/>
101106
</CardGrid>

0 commit comments

Comments
 (0)