-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUntitled Diagram.drawio
107 lines (107 loc) · 10.6 KB
/
Untitled Diagram.drawio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<mxfile host="app.diagrams.net" modified="2021-04-08T10:13:23.295Z" agent="5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36" etag="RM8aB1-0cuZhvmtGxA0Y" version="14.5.8" type="github">
<diagram id="kgpKYQtTHZ0yAKxKKP6v" name="Page-1">
<mxGraphModel dx="1796" dy="646" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="3nuBFxr9cyL0pnOWT2aG-1" value="客户端" style="shape=umlLifeline;perimeter=lifelinePerimeter;container=1;collapsible=0;recursiveResize=0;rounded=0;shadow=0;strokeWidth=1;" parent="1" vertex="1">
<mxGeometry x="20" width="100" height="300" as="geometry" />
</mxCell>
<mxCell id="3nuBFxr9cyL0pnOWT2aG-2" value="" style="points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;strokeWidth=1;" parent="3nuBFxr9cyL0pnOWT2aG-1" vertex="1">
<mxGeometry x="45" y="70" width="10" height="190" as="geometry" />
</mxCell>
<mxCell id="3nuBFxr9cyL0pnOWT2aG-5" value="服务器" style="shape=umlLifeline;perimeter=lifelinePerimeter;container=1;collapsible=0;recursiveResize=0;rounded=0;shadow=0;strokeWidth=1;" parent="1" vertex="1">
<mxGeometry x="330" width="100" height="300" as="geometry" />
</mxCell>
<mxCell id="3nuBFxr9cyL0pnOWT2aG-6" value="" style="points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;strokeWidth=1;" parent="3nuBFxr9cyL0pnOWT2aG-5" vertex="1">
<mxGeometry x="45" y="80" width="10" height="160" as="geometry" />
</mxCell>
<mxCell id="3nuBFxr9cyL0pnOWT2aG-8" value="账户密码登录" style="verticalAlign=bottom;endArrow=block;entryX=0;entryY=0;shadow=0;strokeWidth=1;" parent="1" source="3nuBFxr9cyL0pnOWT2aG-2" target="3nuBFxr9cyL0pnOWT2aG-6" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="245" y="80" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="3nuBFxr9cyL0pnOWT2aG-9" value="返回session_id,写入用户cookie" style="verticalAlign=bottom;endArrow=block;entryX=1;entryY=0;shadow=0;strokeWidth=1;" parent="1" source="3nuBFxr9cyL0pnOWT2aG-6" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="210" y="120" as="sourcePoint" />
<mxPoint x="79.99999999999989" y="120" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-4" value="<font style="font-size: 10px">验证账户,创建session_id<br><br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry x="395" y="70" width="190" height="20" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-5" value="第一次" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry x="10" y="70" width="40" height="20" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-6" value="第二次" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry x="10" y="170" width="40" height="20" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-8" value="访问服务,携带包含session_id的cookie" style="verticalAlign=bottom;endArrow=block;entryX=0;entryY=0;shadow=0;strokeWidth=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="79.99999999999989" y="179.65999999999997" as="sourcePoint" />
<mxPoint x="380" y="179.65999999999997" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-9" value="<font style="font-size: 10px">通过session_id 查找前期保存的用户信息<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry x="395" y="170" width="190" height="20" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-10" value="<h1><span style="font-size: 9px ; font-weight: normal">session&nbsp; + cookie的鉴权方式的问题:服务端存储了信息,一般来说是持久层,也就是数据库,这样数据量会很大,并且一旦持久层初选问题,鉴权就会失败。那么有没有方法让数据不在服务器端保存,只在客户端存储</span><br></h1>" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;fontSize=9;align=left;" vertex="1" parent="1">
<mxGeometry y="310" width="500" height="80" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-20" value="客户端" style="shape=umlLifeline;perimeter=lifelinePerimeter;container=1;collapsible=0;recursiveResize=0;rounded=0;shadow=0;strokeWidth=1;" vertex="1" parent="1">
<mxGeometry x="10" y="450" width="100" height="300" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-21" value="" style="points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;strokeWidth=1;" vertex="1" parent="wiRxUV85cb1wB_uIMG7X-20">
<mxGeometry x="45" y="70" width="10" height="190" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-22" value="服务器" style="shape=umlLifeline;perimeter=lifelinePerimeter;container=1;collapsible=0;recursiveResize=0;rounded=0;shadow=0;strokeWidth=1;" vertex="1" parent="1">
<mxGeometry x="320" y="450" width="100" height="300" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-23" value="" style="points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;strokeWidth=1;" vertex="1" parent="wiRxUV85cb1wB_uIMG7X-22">
<mxGeometry x="45" y="80" width="10" height="160" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-24" value="账户密码登录" style="verticalAlign=bottom;endArrow=block;entryX=0;entryY=0;shadow=0;strokeWidth=1;" edge="1" parent="1" source="wiRxUV85cb1wB_uIMG7X-21" target="wiRxUV85cb1wB_uIMG7X-23">
<mxGeometry relative="1" as="geometry">
<mxPoint x="235" y="530" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-25" value="jwt" style="verticalAlign=bottom;endArrow=block;entryX=1;entryY=0;shadow=0;strokeWidth=1;" edge="1" parent="1" source="wiRxUV85cb1wB_uIMG7X-23">
<mxGeometry relative="1" as="geometry">
<mxPoint x="200" y="570" as="sourcePoint" />
<mxPoint x="69.99999999999989" y="570" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-26" value="<font style="font-size: 10px">验证账户,创建json对象,并且为了防止篡改,对该对象进行签名处理<br>{<br>&nbsp; &nbsp; name: 'xxx',<br>&nbsp; &nbsp; role: ''<br>}<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry x="380" y="500" width="205" height="80" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-27" value="第一次" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry y="520" width="40" height="20" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-28" value="第二次" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry y="620" width="40" height="20" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-29" value="一般是放在header中携带jwt信息,
因为在cookie中不能跨域" style="verticalAlign=bottom;endArrow=block;entryX=0;entryY=0;shadow=0;strokeWidth=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="69.99999999999989" y="629.66" as="sourcePoint" />
<mxPoint x="370" y="629.66" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-30" value="<font style="font-size: 10px">解析token信息进行校验<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry x="385" y="620" width="190" height="20" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-31" value="存储在cookie或者localstorage" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=9;" vertex="1" parent="1">
<mxGeometry y="560" width="40" height="20" as="geometry" />
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-32" value="返回信息" style="verticalAlign=bottom;endArrow=block;entryX=1;entryY=0;shadow=0;strokeWidth=1;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="365" y="670" as="sourcePoint" />
<mxPoint x="70" y="670" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="wiRxUV85cb1wB_uIMG7X-33" value="<h1><span style="font-size: 9px ; font-weight: normal">jwt的优点是:减少服务器的压力,实现服务器无状态</span></h1><div><span style="font-size: 9px ; font-weight: normal">jwt的缺点是:一旦签发了,在到期时间就一定有效,不能中途废弃</span></div><h1><span style="font-weight: normal"><font style="font-size: 12px" color="#ff3333">jwt除了认证之外,还可以用于交换信息</font></span></h1>" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;fontSize=9;align=left;" vertex="1" parent="1">
<mxGeometry y="760" width="500" height="80" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>