feat: add unified authorization middleware
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
- 动态 HTTP:`POST /rpc/cms/{Service}/{Method}`
|
||||
- 原生 gRPC:`/cms.{Service}/{Method}`
|
||||
- grpc-gateway:`POST /cms.{Service}/{Method}`
|
||||
- 鉴权:需要登录的接口通过 `Authorization: Bearer <token>` 传递凭证。
|
||||
- 鉴权:需要登录的接口通过 `Authorization: <JWT>` 传递裸 JWT,不添加 `Bearer` 前缀。
|
||||
- 动态 HTTP 成功或失败均返回 HTTP 200,业务状态见 `code`、`message`、`details`。
|
||||
|
||||
## 服务概览
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Category/Fetch`
|
||||
- gRPC:`/cms.Category/Fetch`
|
||||
- 白名单键:`cms.Category.Fetch`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -49,7 +48,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Category/Create`
|
||||
- gRPC:`/cms.Category/Create`
|
||||
- 白名单键:`cms.Category.Create`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -74,7 +72,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Category/Modify`
|
||||
- gRPC:`/cms.Category/Modify`
|
||||
- 白名单键:`cms.Category.Modify`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -112,7 +109,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Category/Delete`
|
||||
- gRPC:`/cms.Category/Delete`
|
||||
- 白名单键:`cms.Category.Delete`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -136,7 +132,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Pages/Fetch`
|
||||
- gRPC:`/cms.Pages/Fetch`
|
||||
- 白名单键:`cms.Pages.Fetch`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -152,7 +147,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Pages/GetByIdentity`
|
||||
- gRPC:`/cms.Pages/GetByIdentity`
|
||||
- 白名单键:`cms.Pages.GetByIdentity`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -165,7 +159,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Pages/GetByKey`
|
||||
- gRPC:`/cms.Pages/GetByKey`
|
||||
- 白名单键:`cms.Pages.GetByKey`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -178,7 +171,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Pages/Create`
|
||||
- gRPC:`/cms.Pages/Create`
|
||||
- 白名单键:`cms.Pages.Create`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -227,7 +219,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Pages/Modify`
|
||||
- gRPC:`/cms.Pages/Modify`
|
||||
- 白名单键:`cms.Pages.Modify`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -276,7 +267,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Pages/Delete`
|
||||
- gRPC:`/cms.Pages/Delete`
|
||||
- 白名单键:`cms.Pages.Delete`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -314,7 +304,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/Fetch`
|
||||
- gRPC:`/cms.Post/Fetch`
|
||||
- 白名单键:`cms.Post.Fetch`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -332,7 +321,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/GetByIdentity`
|
||||
- gRPC:`/cms.Post/GetByIdentity`
|
||||
- 白名单键:`cms.Post.GetByIdentity`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -346,7 +334,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/GetByKey`
|
||||
- gRPC:`/cms.Post/GetByKey`
|
||||
- 白名单键:`cms.Post.GetByKey`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -359,7 +346,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/Search`
|
||||
- gRPC:`/cms.Post/Search`
|
||||
- 白名单键:`cms.Post.Search`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -374,7 +360,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/Create`
|
||||
- gRPC:`/cms.Post/Create`
|
||||
- 白名单键:`cms.Post.Create`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -460,7 +445,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/Modify`
|
||||
- gRPC:`/cms.Post/Modify`
|
||||
- 白名单键:`cms.Post.Modify`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -546,7 +530,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/Delete`
|
||||
- gRPC:`/cms.Post/Delete`
|
||||
- 白名单键:`cms.Post.Delete`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -560,7 +543,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/IncrPostLike`
|
||||
- gRPC:`/cms.Post/IncrPostLike`
|
||||
- 白名单键:`cms.Post.IncrPostLike`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -574,7 +556,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/DescPostLike`
|
||||
- gRPC:`/cms.Post/DescPostLike`
|
||||
- 白名单键:`cms.Post.DescPostLike`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -588,7 +569,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/IncrPostUnlike`
|
||||
- gRPC:`/cms.Post/IncrPostUnlike`
|
||||
- 白名单键:`cms.Post.IncrPostUnlike`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -602,7 +582,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/DescPostUnlike`
|
||||
- gRPC:`/cms.Post/DescPostUnlike`
|
||||
- 白名单键:`cms.Post.DescPostUnlike`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -616,7 +595,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/CommentList`
|
||||
- gRPC:`/cms.Post/CommentList`
|
||||
- 白名单键:`cms.Post.CommentList`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -631,7 +609,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/AddComment`
|
||||
- gRPC:`/cms.Post/AddComment`
|
||||
- 白名单键:`cms.Post.AddComment`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -659,7 +636,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/ModifyComment`
|
||||
- gRPC:`/cms.Post/ModifyComment`
|
||||
- 白名单键:`cms.Post.ModifyComment`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -687,7 +663,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/DeleteComment`
|
||||
- gRPC:`/cms.Post/DeleteComment`
|
||||
- 白名单键:`cms.Post.DeleteComment`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -701,7 +676,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/IncrCommentLike`
|
||||
- gRPC:`/cms.Post/IncrCommentLike`
|
||||
- 白名单键:`cms.Post.IncrCommentLike`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -715,7 +689,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/DescCommentLike`
|
||||
- gRPC:`/cms.Post/DescCommentLike`
|
||||
- 白名单键:`cms.Post.DescCommentLike`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -729,7 +702,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/IncrCommentUnlike`
|
||||
- gRPC:`/cms.Post/IncrCommentUnlike`
|
||||
- 白名单键:`cms.Post.IncrCommentUnlike`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -743,7 +715,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Post/DescCommentUnlike`
|
||||
- gRPC:`/cms.Post/DescCommentUnlike`
|
||||
- 白名单键:`cms.Post.DescCommentUnlike`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -767,7 +738,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Site/Fetch`
|
||||
- gRPC:`/cms.Site/Fetch`
|
||||
- 白名单键:`cms.Site.Fetch`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -778,7 +748,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Site/Get`
|
||||
- gRPC:`/cms.Site/Get`
|
||||
- 白名单键:`cms.Site.Get`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -792,7 +761,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Site/Create`
|
||||
- gRPC:`/cms.Site/Create`
|
||||
- 白名单键:`cms.Site.Create`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -814,7 +782,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Site/Modify`
|
||||
- gRPC:`/cms.Site/Modify`
|
||||
- 白名单键:`cms.Site.Modify`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -836,7 +803,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Site/Delete`
|
||||
- gRPC:`/cms.Site/Delete`
|
||||
- 白名单键:`cms.Site.Delete`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -859,7 +825,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Tags/Fetch`
|
||||
- gRPC:`/cms.Tags/Fetch`
|
||||
- 白名单键:`cms.Tags.Fetch`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -873,7 +838,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Tags/Create`
|
||||
- gRPC:`/cms.Tags/Create`
|
||||
- 白名单键:`cms.Tags.Create`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -891,7 +855,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Tags/Modify`
|
||||
- gRPC:`/cms.Tags/Modify`
|
||||
- 白名单键:`cms.Tags.Modify`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
@@ -909,7 +872,6 @@
|
||||
|
||||
- 动态 HTTP:`POST /rpc/cms/Tags/Delete`
|
||||
- gRPC:`/cms.Tags/Delete`
|
||||
- 白名单键:`cms.Tags.Delete`
|
||||
- 请求示例:
|
||||
|
||||
```json
|
||||
|
||||
Reference in New Issue
Block a user