2.1.2. 流程图

客户端获取资源

flowchart LR R1["客户端"] R2["资源所有者"] R3["授权服务器"] R4["资源服务器"] R1 -- "1-申请授权" --> R2 R1 -- "5-授权码" --> R3 R1 -. "7-携带访问令牌获取资源" .-> R4 R2 -. "2-认证并授权" .-> R3 -. "3-授权码" .-> R2 R4 -- "8-访问令牌" --> R3 -- "9-资源所有者与权限" --> R4 R4 -. "10-资源所有者授权的资源" .-> R1 R3 -- "6-访问令牌" --> R1 R2 -- "4-授权码" --> R1 linkStyle 0,1,3,5 stroke:#004898,color:#004898 linkStyle 4,6,8,9 stroke:green,color:green linkStyle 2,3,4,7 stroke:#C9CACA,color:#3E3A39 classDef primary fill:#004898,color:white,stroke:#3E3A39 classDef secondary fill:white,color:#3E3A39,stroke:#C9CACA,stroke-width:2,stroke-dasharray:3,3 classDef action fill:#DE6A25,color:white,stroke:#3E3A39 class R3 action class R1 primary class R2,R4 secondary

令牌生命周期

flowchart LR START(("开始")) END((("结束"))) E1((("错误"))) A1{{"获取<br>访问令牌"}} A2{{"刷新<br>访问令牌"}} A3{{"访问<br>资源"}} A4{{"注销<br>令牌"}} C1{" "} C2{" "} START -- "1-持有访问令牌" --> C1 C1 -. "2-访问令牌<br>在有效期内" .-> A3 START -- "1'-没有访问令牌" --> C2 C1 -- "2'-访问令牌<br>不在有效期内" --> C2 C2 -- "3-刷新令牌<br>在有效期内" --> A2 C2 -- "3'-刷新令牌不存在<br>或不在有效期内" --> A1 A2 -- "4-刷新访问令牌<br>成功" --> C1 A2 -- "4'-刷新访问令牌<br>失败" --> A1 A1 -- "5-获取访问令牌<br>成功" --> C1 A1 -- "5'-获取访问令牌<br>失败" --> E1 A3 -- "6'-不继续持有<br>访问令牌" --> A4 -- "7-注销结果" --> END A3 -- "6-继续持有<br>访问令牌" --> END A3 -. "6''-访问资源<br>失败" .-> E1 linkStyle 2,4,5,10,11,12 stroke:#004898,color:#004898 linkStyle 0,6,8 stroke:green,color:green linkStyle 3,7,9 stroke:red,color:red linkStyle 1,13 stroke:#C9CACA,color:#3E3A39 classDef primary fill:#004898,color:white,stroke:#3E3A39 classDef secondary fill:white,color:#3E3A39,stroke:#C9CACA,stroke-width:2,stroke-dasharray:3,3 classDef action fill:#DE6A25,color:white,stroke:#3E3A39 classDef endpoint fill:white,color:#004898,stroke:#004898 classDef error fill:white,color:red,stroke:red class A1,A4 action class A2,C0,C1,C2 primary class A3 secondary class START,END endpoint class E1 error