-
Notifications
You must be signed in to change notification settings - Fork 1
/
spring-security-oauth2.drawio
1863 lines (1863 loc) · 282 KB
/
spring-security-oauth2.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<mxfile host="Electron" modified="2024-03-12T11:10:42.762Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.5 Chrome/114.0.5735.243 Electron/25.3.1 Safari/537.36" etag="sYFcdBBhWUiiIPbv4uyT" version="21.6.5" type="device" pages="2">
<diagram name="SpringSecurityOAuth2工作流程" id="BB3JgpRIZgwQwiqXOJlF">
<mxGraphModel dx="4274" dy="1099" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="dtGfbLZROhE4GbIlcdWK-29" style="rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=1;entryDx=0;entryDy=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-44" target="dtGfbLZROhE4GbIlcdWK-26" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-83" style="rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-70" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="880" y="1120" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-76" style="rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0;exitDx=0;exitDy=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-54" target="Jysl4UP8jRCQiMBeIVnq-72" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-75" style="rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-33" target="Jysl4UP8jRCQiMBeIVnq-72" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-1" value="<h1 style="font-size: 16px;"><font style="font-size: 16px;">Spring Security OAuth2 工作流程&nbsp;</font></h1><div style=""><font style="font-size: 12px;">版本:spring-security-oauth2-autoconfigure:2.1.10.RELEASE (spring-security-oauth现在已经废弃,功能迁移到了spring-security和spring-authorization-server两个项目)</font></div><div style="font-size: 11px"><span style="background-color: initial; font-size: 12px;">这里只分析两种常用的模式:密码模式(通常用于统一的认证授权中心)、认证码模式(通常用于第三方授权)</span></div><div style="font-size: 11px"><span style="background-color: initial; font-size: 12px;"><br></span></div><div style="font-size: 11px"><span style="background-color: initial; font-size: 12px;"><b>密码模式</b>:</span></div><div style="font-size: 11px"><span style="background-color: initial; font-size: 12px;">生产场景的密码模式交互流程举例:(详细参考第2页的涌道图)</span></div><div style="font-size: 11px"><span style="background-color: initial; font-size: 12px;">用户输入用户名密码请求网关服务的/login; 网关额外添加自己的client-id、client-secret(如果认证服务器不开放到外网不需要) 然后转发给认证服务器/oauth/token;&nbsp;</span></div><div style="">认证服务器对client-secret以及用户密码与传参进行比对,校验成功后返回访问令牌、令牌类型、过期时间、客户端应用授权范围等信息;</div><div style="">后续的业务请求先由网关将AccessToken转发给认证服务进行校验,校验成功后获取用户信息再转发给后台业务服务。</div><div style="font-size: 11px"><br></div><div style="font-size: 11px"><span style="background-color: initial; font-size: 12px;"><b>认证码模式</b>:</span></div><div style="font-size: 11px"><span style="background-color: initial; font-size: 12px;"><br></span></div><div style="font-size: 11px"><span style="background-color: initial; font-size: 12px;"><br></span></div>" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
<mxGeometry x="40" y="20" width="960" height="180" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-5" value="" style="edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;rounded=1;" parent="1" source="bewY3FNtBYAkQc0WHg5f-2" target="bewY3FNtBYAkQc0WHg5f-4" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-12" style="edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;rounded=1;" parent="1" source="bewY3FNtBYAkQc0WHg5f-2" target="bewY3FNtBYAkQc0WHg5f-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="gpTnpa3g8ZrnLY71u2b0-3" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="bewY3FNtBYAkQc0WHg5f-2" target="gpTnpa3g8ZrnLY71u2b0-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-2" value="OAuth2初始化" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" parent="1" vertex="1">
<mxGeometry x="40" y="240" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-7" style="edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fontSize=10;rounded=1;" parent="1" source="bewY3FNtBYAkQc0WHg5f-3" target="bewY3FNtBYAkQc0WHg5f-6" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-3" value="认证码模式" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" parent="1" vertex="1">
<mxGeometry x="40" y="3173" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="ekV5xUxB1UH4FCtE4HuT-2" value="" style="edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;jettySize=auto;html=1;rounded=1;" parent="1" source="bewY3FNtBYAkQc0WHg5f-4" target="ekV5xUxB1UH4FCtE4HuT-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-53" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="bewY3FNtBYAkQc0WHg5f-4" target="Jysl4UP8jRCQiMBeIVnq-52" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-4" value="OAuth2自动配置" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="240" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-6" value="" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="240" y="3173" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-14" value="" style="edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;jettySize=auto;html=1;rounded=1;" parent="1" source="bewY3FNtBYAkQc0WHg5f-8" target="bewY3FNtBYAkQc0WHg5f-13" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-8" value="客户端应用请求<br>认证服务器获取授权<br><b>/oauth/token</b><br><font color="#007fff">此接口是Spring Security源码中注册的</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="240" y="2880" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-39" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="bewY3FNtBYAkQc0WHg5f-11" target="Jysl4UP8jRCQiMBeIVnq-38" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-42" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="bewY3FNtBYAkQc0WHg5f-11" target="Jysl4UP8jRCQiMBeIVnq-40" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-46" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="bewY3FNtBYAkQc0WHg5f-11" target="Jysl4UP8jRCQiMBeIVnq-44" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-74" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="bewY3FNtBYAkQc0WHg5f-11" target="Jysl4UP8jRCQiMBeIVnq-72" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-11" value="自定义 OAuth2 配置" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="240" y="960" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-26" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="bewY3FNtBYAkQc0WHg5f-13" target="Jysl4UP8jRCQiMBeIVnq-25" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-62" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="Jysl4UP8jRCQiMBeIVnq-26" vertex="1" connectable="0">
<mxGeometry x="-0.25" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-13" value="FilterChainProxy#doFilter(...)<br><font color="#007fff">springSecurityFilterChain<br>仍然会经过安全过滤器链</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="480" y="2880" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-22" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="bewY3FNtBYAkQc0WHg5f-15" target="bewY3FNtBYAkQc0WHg5f-13" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="bewY3FNtBYAkQc0WHg5f-15" value="AccessToken校验<br><b>/oauth/check_token</b><br><font style="" color="#007fff">此接口是Spring Security源码中注册的</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="240" y="2980" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-2" value="" style="edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;jettySize=auto;html=1;rounded=1;" parent="1" source="ekV5xUxB1UH4FCtE4HuT-1" target="Jysl4UP8jRCQiMBeIVnq-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-4" style="edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;rounded=1;" parent="1" source="ekV5xUxB1UH4FCtE4HuT-1" target="Jysl4UP8jRCQiMBeIVnq-3" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-6" style="edgeStyle=orthogonalEdgeStyle;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;rounded=1;" parent="1" source="ekV5xUxB1UH4FCtE4HuT-1" target="Jysl4UP8jRCQiMBeIVnq-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="ekV5xUxB1UH4FCtE4HuT-1" value="OAuth2AutoConfiguration" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="480" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-1" target="Jysl4UP8jRCQiMBeIVnq-7" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-11" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-1" target="Jysl4UP8jRCQiMBeIVnq-9" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-16" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-1" target="Jysl4UP8jRCQiMBeIVnq-12" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-17" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-1" target="Jysl4UP8jRCQiMBeIVnq-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-1" value="@Import" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="720" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-21" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-3" target="Jysl4UP8jRCQiMBeIVnq-20" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-3" value="@Bean" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="720" y="640" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-19" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-5" target="Jysl4UP8jRCQiMBeIVnq-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-5" value="@EnableConfigurationProperties" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="720" y="560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-34" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-7" target="Jysl4UP8jRCQiMBeIVnq-33" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-37" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-7" target="Jysl4UP8jRCQiMBeIVnq-35" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1180" y="270" />
<mxPoint x="1180" y="350" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-7" value="OAuth2AuthorizationServerConfiguration" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="960" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-9" value="OAuth2MethodSecurityConfiguration" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="960" y="320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-12" value="OAuth2ResourceServerConfiguration" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="960" y="400" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-14" value="OAuth2RestOperationsConfiguration" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="960" y="480" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-18" value="OAuth2ClientProperties" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="960" y="560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-20" value="new ResourceServerProperties(<br>this.credentials.getClientId(), this.credentials.getClientSecret());" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="960" y="640" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-23" value="<font color="#007fff">调试发现安全过滤器链中有两个过滤器链<br>/oauth/token、 /oauth/token_key、<br>/oauth/check_token 走一条<br>其他请求走另外一条</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="480" y="2940" width="240" height="70" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-28" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-25" target="Jysl4UP8jRCQiMBeIVnq-27" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-25" value="<div>WebAsyncManagerIntegrationFilter</div><div>SecurityContextPersistenceFilter</div><div>HeaderWriterFilter</div><div>LogoutFilter</div><div><b>BasicAuthenticationFilter</b></div><div>RequestCacheAwareFilter</div><div>SecurityContextHolderAwareRequestFilter</div><div>AnonymousAuthenticationFilter</div><div>SessionManagementFilter</div><div>ExceptionTranslationFilter</div><div><b>FilterSecurityInterceptor</b></div><div><div><font color="#007fff">/oauth/token、 /oauth/token_key、</font></div><div><font color="#007fff">/oauth/check_token 走的过滤器链</font></div></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;arcSize=4;" parent="1" vertex="1">
<mxGeometry x="720" y="2830" width="200" height="160" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-30" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-27" target="Jysl4UP8jRCQiMBeIVnq-29" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-24" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="Jysl4UP8jRCQiMBeIVnq-30" vertex="1" connectable="0">
<mxGeometry x="-0.2247" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-16" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-27" target="BTdmhbfbiTqf7HtIRt79-4" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-27" value="<b>BasicAuthenticationFilter</b><br><font color="#007fff">对于AuthorizationServer这里认证的是客户端应用而不是用户</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="960" y="2880" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="gpTnpa3g8ZrnLY71u2b0-26" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-29" target="gpTnpa3g8ZrnLY71u2b0-25" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-131" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="gpTnpa3g8ZrnLY71u2b0-26" vertex="1" connectable="0">
<mxGeometry x="-0.016" y="2" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-100" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-29" target="BTdmhbfbiTqf7HtIRt79-99" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-29" value="<b>FilterSecurityInterceptor</b>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="960" y="3840" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="yOIgcuZ7kVqAaMvxTEpn-2" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-31" target="yOIgcuZ7kVqAaMvxTEpn-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-31" value="String clientId = getClientId(principal);<br>ClientDetails <b>authenticatedClient</b> = <b>getClientDetailsService</b>()<br>.<b>loadClientByClientId</b>(clientId);<br><font color="#007fff">principal是经过认证的客户端应用信息</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1440" y="5280" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-47" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.25;entryDx=0;entryDy=0;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-50" target="Jysl4UP8jRCQiMBeIVnq-38" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1650" y="270" />
<mxPoint x="1650" y="940" />
<mxPoint x="460" y="940" />
<mxPoint x="460" y="975" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-51" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-33" target="Jysl4UP8jRCQiMBeIVnq-50" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-86" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-33" target="Jysl4UP8jRCQiMBeIVnq-85" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1420" y="270" />
<mxPoint x="1420" y="350" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-88" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-33" target="Jysl4UP8jRCQiMBeIVnq-87" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-97" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-33" target="Jysl4UP8jRCQiMBeIVnq-93" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-100" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-33" target="Jysl4UP8jRCQiMBeIVnq-98" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-33" value="AuthorizationServerEndpointsConfiguration<br><font color="#007fff">端点配置,注册了几个断点,<br>比如 /oauth/token</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1200" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-35" value="<font style="font-size: 10px;">AuthorizationServerTokenServicesConfiguration</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1190" y="320" width="220" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-38" value="<div>void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {</div><div>&nbsp; &nbsp; endpoints.<b>authenticationManager</b>(authenticationManager);</div><div>}</div><div><br></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="480" y="960" width="400" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-40" value="<div>void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {</div><div>&nbsp; &nbsp; oauthServer.<b>checkTokenAccess</b>("isAuthenticated()");</div><div>}</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="480" y="1040" width="400" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-43" value="<font style="font-size: 10px;">OAuth2AuthorizationServerConfig extends<br>&nbsp;&nbsp;<b>AuthorizationServerConfigurerAdapter</b></font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="240" y="920" width="210" height="40" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-2" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-44" target="dtGfbLZROhE4GbIlcdWK-1" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-3" value="<font color="#007fff" style="font-size: 10px;">如果选择<br style="">基于内存配置</font>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];fontSize=10;" parent="dtGfbLZROhE4GbIlcdWK-2" vertex="1" connectable="0">
<mxGeometry x="-0.223" y="1" relative="1" as="geometry">
<mxPoint x="9" y="1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-44" value="<div>void configure(<b>ClientDetailsServiceConfigurer</b> clients) throws Exception {</div><div>&nbsp; &nbsp; clients.<b>withClientDetails</b>(clientDetailsService);</div><div>}</div><div><font color="#007fff">这里的clients&nbsp;ClientDetailsServiceConfiguration 中创建的&nbsp;ClientDetailsServiceConfigurer&nbsp;</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="480" y="1121" width="400" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-50" value="<div>@PostConstruct</div><div>void init()</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1440" y="240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-55" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-60" target="Jysl4UP8jRCQiMBeIVnq-54" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-52" value="@EnableAuthorizationServer" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="480" y="720" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-64" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-54" target="Jysl4UP8jRCQiMBeIVnq-63" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-68" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-54" target="Jysl4UP8jRCQiMBeIVnq-67" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-54" value="<b>AuthorizationServerSecurityConfiguration</b><br>extends&nbsp;<b>WebSecurityConfigurerAdapter</b><br><font style="" color="#007fff">用于配置认证服务器的过滤器链</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="960" y="720" width="199" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-71" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-58" target="Jysl4UP8jRCQiMBeIVnq-70" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-28" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-58" target="dtGfbLZROhE4GbIlcdWK-26" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-58" value="ClientDetailsServiceConfiguration" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1440" y="720" width="199" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-61" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-52" target="Jysl4UP8jRCQiMBeIVnq-60" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="680" y="750" as="sourcePoint" />
<mxPoint x="960" y="750" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-62" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-60" target="Jysl4UP8jRCQiMBeIVnq-33" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="930" y="750" />
<mxPoint x="930" y="310" />
<mxPoint x="1170" y="310" />
<mxPoint x="1170" y="285" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-60" value="@Import" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="720" y="720" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-65" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-63" target="Jysl4UP8jRCQiMBeIVnq-58" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-66" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-63" target="Jysl4UP8jRCQiMBeIVnq-33" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1419" y="735" />
<mxPoint x="1419" y="710" />
<mxPoint x="1170" y="710" />
<mxPoint x="1170" y="285" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-63" value="@Import" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1200" y="720" width="199" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-69" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=#dae8fc;strokeColor=#6c8ebf;entryX=0;entryY=0.25;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-67" target="Jysl4UP8jRCQiMBeIVnq-44" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="470" y="1140" as="targetPoint" />
<Array as="points">
<mxPoint x="1670" y="840" />
<mxPoint x="1670" y="1110" />
<mxPoint x="470" y="1110" />
<mxPoint x="470" y="1136" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-67" value="<div><b>@Autowired</b></div><div>public void configure(<b>ClientDetailsServiceConfigurer</b> clientDetails) throws Exception {</div><div>&nbsp; &nbsp; for (<b>AuthorizationServerConfigurer</b> configurer : configurers) {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; configurer.configure(clientDetails);</div><div>&nbsp; &nbsp; }</div><div>}</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="1200" y="800" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-70" value="<div>@Bean</div>ClientDetailsServiceConfigurer configurer = new <b>ClientDetailsServiceConfigurer</b>(new ClientDetailsServiceBuilder());" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1680" y="720" width="199" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-72" value="<font color="#007fff" style="font-size: 10px;"><b>AuthorizationServerConfigurerAdapter<br>就是自定义OAuth2配置的窗口<br>很多配置类会注入此类,通过它可以修改各个<br>自动配置配置类的配置,然后自动配置使用<br>修改后的配置创建Bean<br>然后再看配置类代码就会感觉很清晰了</b><br></font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="230" y="525" width="220" height="100" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-78" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-77" target="bewY3FNtBYAkQc0WHg5f-8" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-79" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-77" target="bewY3FNtBYAkQc0WHg5f-15" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-77" value="密码模式" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=12;" parent="1" vertex="1">
<mxGeometry x="40" y="2880" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-90" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-85" target="Jysl4UP8jRCQiMBeIVnq-89" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-85" value="@Bean<br><b>AuthorizationEndpoint</b> authorizationEndpoint()" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1440" y="320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-92" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-87" target="Jysl4UP8jRCQiMBeIVnq-91" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-87" value="@Bean<br><b>TokenEndpoint </b>tokenEndpoint()" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1440" y="400" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-89" value="任意RequestMethod /oauth/authorize<br>POST&nbsp;/oauth/authorize" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;" parent="1" vertex="1">
<mxGeometry x="1680" y="320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-91" value="GET /oauth/token<br>POST /oauth/token" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;" parent="1" vertex="1">
<mxGeometry x="1680" y="400" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-96" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-93" target="Jysl4UP8jRCQiMBeIVnq-95" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-93" value="@Bean<br><b>CheckTokenEndpoint </b>checkTokenEndpoint()" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1440" y="480" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-95" value="任意RequestMethod /oauth/check_token" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;" parent="1" vertex="1">
<mxGeometry x="1680" y="480" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-102" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="Jysl4UP8jRCQiMBeIVnq-98" target="Jysl4UP8jRCQiMBeIVnq-101" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-98" value="@Bean<br><b>WhitelabelApprovalEndpoint </b>whitelabelApprovalEndpoint()" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1440" y="560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="Jysl4UP8jRCQiMBeIVnq-101" value="任意RequestMethod /oauth/confirm_access" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1680" y="560" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dtGfbLZROhE4GbIlcdWK-1" target="dtGfbLZROhE4GbIlcdWK-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-1" value="<div>clients.<b>inMemory</b>()</div><div>.withClient("client-gateway")</div><div>.secret("secret-123")</div><div>.authorizedGrantTypes("password")&nbsp;&nbsp;</div><div>.scopes("read_userinfo", "read_contacts");</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="959" y="1121" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dtGfbLZROhE4GbIlcdWK-5" target="dtGfbLZROhE4GbIlcdWK-7" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dtGfbLZROhE4GbIlcdWK-5" target="dtGfbLZROhE4GbIlcdWK-9" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-5" value="<b>InMemoryClientDetailsServiceBuilder</b> next = getBuilder().inMemory();" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="1200" y="1121" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dtGfbLZROhE4GbIlcdWK-7" target="dtGfbLZROhE4GbIlcdWK-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-14" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dtGfbLZROhE4GbIlcdWK-7" target="dtGfbLZROhE4GbIlcdWK-13" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-7" value="<div>.withClient("client-gateway")</div><div>.secret("secret-123")<br></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="1200" y="1200" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-9" value="return new InMemoryClientDetailsServiceBuilder();" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="1440" y="1121" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-11" value="<div>ClientBuilder clientBuilder = new ClientBuilder(clientId);</div><div>this.clientBuilders.add(clientBuilder);<br></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="1440" y="1200" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-16" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="dtGfbLZROhE4GbIlcdWK-13" target="dtGfbLZROhE4GbIlcdWK-15" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-18" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dtGfbLZROhE4GbIlcdWK-13" target="dtGfbLZROhE4GbIlcdWK-17" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-13" value="<div>.authorizedGrantTypes("password")&nbsp;&nbsp;</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="1200" y="1280" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-15" value="<div><div>for (String grant : authorizedGrantTypes) {</div><div>&nbsp; this.authorizedGrantTypes.add(grant);<span style=""></span></div><div><span style="">}</span></div></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="1440" y="1280" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-20" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="dtGfbLZROhE4GbIlcdWK-17" target="dtGfbLZROhE4GbIlcdWK-19" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-17" value="<div>.scopes("read_userinfo", "read_contacts")</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="1200" y="1360" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-19" value="<div>for (String authority : authorities) {</div><div>&nbsp; this.authorities.add(authority);<span style=""></span></div><div><span style="">}</span></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="1440" y="1360" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-24" style="rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;endArrow=diamondThin;endFill=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="dtGfbLZROhE4GbIlcdWK-21" target="dtGfbLZROhE4GbIlcdWK-23" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-21" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>ClientDetailsServiceBuilder</b><br style="font-size: 10px;"></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//注册的客户端应用Builder</font></p><p style="margin: 0px 0px 0px 4px;">private List&lt;ClientBuilder&gt; clientBuilders = new ArrayList&lt;ClientBuilder&gt;();<br></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-520" y="240" width="480" height="80" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-25" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;" parent="1" source="dtGfbLZROhE4GbIlcdWK-22" target="dtGfbLZROhE4GbIlcdWK-21" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-22" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>InMemoryClientDetailsServiceBuilder</b><br style="font-size: 10px;"></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">//客户端应用详情信息Map, key为clientId</font></p><p style="margin: 0px 0px 0px 4px;">private Map&lt;String, ClientDetails&gt; clientDetails = new HashMap&lt;String, ClientDetails&gt;();<br></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-520" y="360" width="480" height="80" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-23" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>ClientBuilder </b>构建客户端应用<br style="font-size: 10px;"></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px;">private final String clientId;</p><p style="margin: 0px 0px 0px 4px;">private Collection&lt;String&gt; authorizedGrantTypes = new LinkedHashSet&lt;String&gt;();</p><p style="margin: 0px 0px 0px 4px;">private Collection&lt;String&gt; authorities = new LinkedHashSet&lt;String&gt;();</p><p style="margin: 0px 0px 0px 4px;">private Integer accessTokenValiditySeconds;</p><p style="margin: 0px 0px 0px 4px;">private Integer refreshTokenValiditySeconds;</p><p style="margin: 0px 0px 0px 4px;">private Collection&lt;String&gt; scopes = new LinkedHashSet&lt;String&gt;();</p><p style="margin: 0px 0px 0px 4px;">private Collection&lt;String&gt; autoApproveScopes = new HashSet&lt;String&gt;();</p><p style="margin: 0px 0px 0px 4px;">private String secret;</p><p style="margin: 0px 0px 0px 4px;">private Set&lt;String&gt; registeredRedirectUris = new HashSet&lt;String&gt;();</p><p style="margin: 0px 0px 0px 4px;">private Set&lt;String&gt; resourceIds = new HashSet&lt;String&gt;();</p><p style="margin: 0px 0px 0px 4px;">private boolean autoApprove;</p><p style="margin: 0px 0px 0px 4px;">private Map&lt;String, Object&gt; additionalInformation = new LinkedHashMap&lt;String, Object&gt;();</p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-1040" y="240" width="480" height="200" as="geometry" />
</mxCell>
<mxCell id="dtGfbLZROhE4GbIlcdWK-26" value="<div>@Bean&nbsp;<span style="background-color: initial;">@Lazy</span></div><div>@Scope(proxyMode=ScopedProxyMode.INTERFACES)</div><div>public <b>ClientDetailsService</b> clientDetailsService() throws Exception {</div><div>&nbsp; &nbsp; return configurer.and().<b>build</b>();</div><div>}</div><div></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;align=left;arcSize=6;" parent="1" vertex="1">
<mxGeometry x="1680" y="800" width="260" height="100" as="geometry" />
</mxCell>
<mxCell id="gpTnpa3g8ZrnLY71u2b0-5" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="gpTnpa3g8ZrnLY71u2b0-1" target="gpTnpa3g8ZrnLY71u2b0-6" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="480" y="1490" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="gpTnpa3g8ZrnLY71u2b0-1" value="过滤器链的创建<br><font color="#007fff">这部分是Spring Security的源码</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="240" y="1460" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-28" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="gpTnpa3g8ZrnLY71u2b0-6" target="DjIQ4SRXJKjCJ7x8OOmH-7" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="gpTnpa3g8ZrnLY71u2b0-6" value="<font><span style="font-size: 10px"><b>@Bean <br></b>Filter <b>springSecurityFilterChain</b>()<br></span><font color="#007fff">详细流程参考spring security 流程图</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="480" y="1460" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="gpTnpa3g8ZrnLY71u2b0-10" value="WebSecurityConfiguration" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="500" y="1430" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="C9ku3EbWxnKkE-glZPp3-17" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="gpTnpa3g8ZrnLY71u2b0-25" target="C9ku3EbWxnKkE-glZPp3-16" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="C9ku3EbWxnKkE-glZPp3-20" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="gpTnpa3g8ZrnLY71u2b0-25" target="C9ku3EbWxnKkE-glZPp3-19" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="gpTnpa3g8ZrnLY71u2b0-25" value="端点请求处理<br><font color="#007fff">入参、返回值、异常处理器都是写死的</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="960" y="5280" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-1" value="<font style="font-size: 10px;" color="#007fff">看实际的过滤器链可能会产生疑问:<br>AuthorizationServerSecurityConfiguration配置的<br>那条过滤器链中 BasicAuthenticationFilter 是怎么来的?<br>这里反过来溯源这个过滤器的注册流程<br></font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="719" y="2760" width="270" height="70" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-6" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-7" target="DjIQ4SRXJKjCJ7x8OOmH-15" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-7" value="<font><span style="font-size: 10px"><b>webSecurity</b>.<b>build</b>()<br></span><font color="#007fff" style="font-size: 10px">构造安全过滤器链,<b>WebSecurity 中可能有多个HttpSecurity</b></font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="720" y="1460" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-9" target="DjIQ4SRXJKjCJ7x8OOmH-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-29" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-9" target="uCyp3sCYdSISI6nv47Nj-28" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-9" value="<font style="font-size: 10px"><div>beforeInit();</div><div><b>init</b>();</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1320" y="2160" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-11" target="DjIQ4SRXJKjCJ7x8OOmH-12" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1397.57" y="2480" as="sourcePoint" />
<mxPoint x="1397.57" y="2660" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-31" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-11" target="uCyp3sCYdSISI6nv47Nj-30" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-11" value="<font style="font-size: 10px"><div>beforeConfigure();</div><div><b>configure</b>();</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1320" y="2420" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-33" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-12" target="uCyp3sCYdSISI6nv47Nj-32" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-12" value="<font style="font-size: 10px">O result = <b>performBuild</b>();<br>return result;<br><font color="#007fff">创建过滤器链</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1320" y="2520" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-13" value="<font style="font-size: 10px;">AbstractConfiguredSecurityBuilder<br>执行的是HttpSecurity覆盖的方法<br></font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1320" y="2120" width="180" height="40" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-14" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-15" target="DjIQ4SRXJKjCJ7x8OOmH-17" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-30" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-15" target="DjIQ4SRXJKjCJ7x8OOmH-29" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-15" value="<font style="font-size: 10px"><div>beforeInit();</div><div><b>init</b>();</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="920" y="1460" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-16" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-17" target="DjIQ4SRXJKjCJ7x8OOmH-19" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1000" y="2120" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-17" value="<font style="font-size: 10px"><div>beforeConfigure();</div><div>configure();</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="920" y="1560" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-18" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-19" target="DjIQ4SRXJKjCJ7x8OOmH-23" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-19" value="<font style="font-size: 10px">O result = <b>performBuild</b>();<br>return result;<br><font color="#007fff">创建过滤器链</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="920" y="2160" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-20" value="<font style="font-size: 10px;">AbstractConfiguredSecurityBuilder<br>执行的是WebSecurity覆盖的方法<br></font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="910" y="1425" width="180" height="40" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-21" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-25" target="DjIQ4SRXJKjCJ7x8OOmH-9" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-22" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-23" target="DjIQ4SRXJKjCJ7x8OOmH-25" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-23" value="<font style="font-size: 10px;"><div style="">List&lt;SecurityFilterChain&gt; securityFilterChains = new ArrayList&lt;&gt;(<span style="background-color: initial;">chainSize);</span></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1120" y="2160" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-24" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-25" target="DjIQ4SRXJKjCJ7x8OOmH-27" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-25" value="<font style=""><div style="font-size: 10px;"><font style="font-size: 10px;">for <b>securityFilterChainBuilders</b>:&nbsp;<br></font>securityFilterChains.add(<br>securityFilterChainBuilder.<b>build</b>());<br></div><div style=""><font color="#007fff" style="font-size: 10px;">securityFilterChainBuilder 即 <b>HttpSecurity</b></font><br></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1120" y="2240" width="160" height="80" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-26" value="<font style="font-size: 10px;"><font color="#007fff"><b>这个方法主要的作用就是WebSecurity中<br>配置了几个HttpSecurity 就创建几个过滤器链<br>然后创建过滤器链代理</b></font><br></font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="890" y="2220" width="230" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-27" value="<font style=""><div style=""><font style="font-size: 10px;">FilterChainProxy filterChainProxy = new <b>FilterChainProxy</b>(</font></div><div style=""><font style="font-size: 10px;">securityFilterChains)</font><br></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1120" y="2340" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-36" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-29" target="DjIQ4SRXJKjCJ7x8OOmH-35" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-29" value="<font style="font-size: 10px;">for configurers:<br>configurer.init((B) this);<br><font color="#007fff">此DEMO有两个配置类,这里只分析AuthorizationServerSecurityConfiguration</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1120" y="1460" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-39" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-35" target="DjIQ4SRXJKjCJ7x8OOmH-38" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-35" value="<font style=""><font style="font-size: 10px;">HttpSecurity http = getHttp();</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1360" y="1460" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-41" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-38" target="DjIQ4SRXJKjCJ7x8OOmH-40" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-27" style="rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=1;exitDx=0;exitDy=0;entryX=1.005;entryY=0.3;entryDx=0;entryDy=0;entryPerimeter=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-38" target="uCyp3sCYdSISI6nv47Nj-24" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-38" value="<font style="font-size: 10px;"><div>同样创建 AuthenticationManager、HttpSecurity</div><div>并往HttpSecurity 中注册一些默认的过滤器配置类</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1600" y="1460" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-44" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-40" target="DjIQ4SRXJKjCJ7x8OOmH-43" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-40" value="<font style="">configure(http);<br><font color="#007fff" style="font-size: 10px;">执行认证服务器安全配置拓展</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1600" y="1540" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-42" value="WebSecurityConfigurerAdapter" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1610" y="1430" width="190" height="30" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="DjIQ4SRXJKjCJ7x8OOmH-43" target="uCyp3sCYdSISI6nv47Nj-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-43" value="<font style=""><font style="font-size: 10px;">AuthorizationServerSecurityConfigurer <b>configurer</b> = new AuthorizationServerSecurityConfigurer();</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1840" y="1540" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="DjIQ4SRXJKjCJ7x8OOmH-45" value="<div style="font-size: 10px;"><font color="#007fff">默认配置类有10个</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">CsrfConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">ExceptionHandlingConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">HeadersConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">SessionManagementConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">SecurityContextConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">RequestCacheConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">AnonymousConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">ServletApiConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">DefaultLoginPageConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">LogoutConfigurer</font></div>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1810" y="1370" width="160" height="150" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-1" value="AuthorizationServerSecurityConfiguration" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1820" y="1510" width="240" height="30" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-4" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;" parent="1" source="uCyp3sCYdSISI6nv47Nj-2" target="uCyp3sCYdSISI6nv47Nj-3" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-2" value="<div style="text-align: center;"><b>AuthorizationServerSecurityConfiguration&nbsp;</b><span style="background-color: initial;">构建客户端应用</span></div><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px;"></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff">// 认证服务器拓展配置</font></p><p style="margin: 0px 0px 0px 4px;">private List&lt;AuthorizationServerConfigurer&gt; <b>configurers</b> = Collections.emptyList();</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">// 客户端应用详情信息服务</font></p><p style="margin: 0px 0px 0px 4px;">private ClientDetailsService <b>clientDetailsService</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">// 认证服务请求端点配置</font></p><p style="margin: 0px 0px 0px 4px;">private <b>AuthorizationServerEndpointsConfiguration</b> <b>endpoints</b>;</p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="-560" y="760" width="520" height="120" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-3" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 10px;"><font style="font-size: 10px;"><b>WebSecurityConfigurerAdapter</b><i style="">&nbsp;修改</i><i style="background-color: initial;">配置</i><i style="background-color: initial;">的窗口类,新版本已经废弃</i></font></p><hr style="font-size: 10px;" size="1"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private ApplicationContext context;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private ContentNegotiationStrategy <b>contentNegotiationStrategy</b> = new HeaderContentNegotiationStrategy();</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private ObjectPostProcessor&lt;Object&gt; <b>objectPostProcessor</b> = new ObjectPostProcessor&lt;Object&gt;() {...};</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private AuthenticationConfiguration <b>authenticationConfiguration</b>;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;" color="#007fff">//DefaultPasswordEncoderAuthenticationManagerBuilder 用于构造密码编码器和认证管理器</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private AuthenticationManagerBuilder <b>authenticationBuilder</b>;</font></p><font style="font-size: 10px;"><span style="color: rgb(0 , 127 , 255)">&nbsp; //DefaultPasswordEncoderAuthenticationManagerBuilder</span><span>&nbsp;</span><span style="color: rgb(0 , 127 , 255)"><br></span></font><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private AuthenticationManagerBuilder <b>localConfigureAuthenticationBldr</b>;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private boolean disableLocalConfigureAuthenticationBldr;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private boolean authenticationManagerInitialized;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;" color="#007fff">//构造的认证管理器</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private AuthenticationManager <b>authenticationManager</b>;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">//用于对用户信息鉴权,详细参考后面</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private AuthenticationTrustResolver <b>trustResolver</b> = new AuthenticationTrustResolverImpl();</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private <b>HttpSecurity</b> <b>http</b>;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private boolean disableDefaults;</font></p><hr style="font-size: 10px;" size="1"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-560" y="480" width="520" height="240" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-5" target="uCyp3sCYdSISI6nv47Nj-7" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-5" value="<font style=""><font style="font-size: 10px;">FrameworkEndpointHandlerMapping handlerMapping = endpoints.oauth2EndpointHandlerMapping();</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1840" y="1620" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-7" target="uCyp3sCYdSISI6nv47Nj-9" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-12" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-7" target="uCyp3sCYdSISI6nv47Nj-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-7" value="<font style=""><font style="font-size: 10px;">configure(<b>configurer</b>);<br></font><font color="#007fff" style="font-size: 10px;">给configurer添加自定义配置&nbsp;</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1840" y="1700" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-20" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.942;entryY=-0.013;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="uCyp3sCYdSISI6nv47Nj-9" target="uCyp3sCYdSISI6nv47Nj-16" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-21" value="<font color="#007fff">修改访问条件</font>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="uCyp3sCYdSISI6nv47Nj-20" vertex="1" connectable="0">
<mxGeometry x="-0.6592" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-9" value="<font style=""><font style="font-size: 10px;">oauthServerConfigurer<br>.<b>checkTokenAccess</b>("isAuthenticated()");<br></font><font color="#007fff" style="font-size: 10px;">为了修改 /oauth/check_token访问条件:<br></font><font style="font-size: 10px;" color="#007fff">非匿名认证用户可访问</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="2080" y="1700" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-11" target="uCyp3sCYdSISI6nv47Nj-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-25" style="rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;fillColor=#d5e8d4;strokeColor=#82b366;entryX=0.992;entryY=0.374;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="uCyp3sCYdSISI6nv47Nj-11" target="uCyp3sCYdSISI6nv47Nj-24" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1710" y="1790" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-11" value="<font style="font-size: 10px;"><font style="font-size: 10px;">http.apply(<b>configurer</b>);<br></font><font style="font-size: 10px;" color="#007fff">将<font style="font-size: 10px;"><b>AuthorizationServerSecurityConfigurer</b><br></font>注册到 HttpSecurity 过滤器配置类列表</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1840" y="1780" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-13" value="<font style="font-size: 10px;">OAuth2AuthorizationServerConfig<br>自定义配置类</font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="2095" y="1665" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-17" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-14" target="uCyp3sCYdSISI6nv47Nj-16" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1940" y="1930" />
<mxPoint x="2020" y="1930" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-14" value="<font style="font-size: 10px;"><font style="font-size: 10px;">AuthorizationServerEndpointsConfiguration<br></font>相关配置<br style="font-size: 10px;"></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1840" y="1860" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-26" style="rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="uCyp3sCYdSISI6nv47Nj-16" target="uCyp3sCYdSISI6nv47Nj-24" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="J0giTLENruao22hqI6kO-21" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="uCyp3sCYdSISI6nv47Nj-16" target="J0giTLENruao22hqI6kO-20" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-16" value="<font style=""><div style=""><div>http</div><div><font color="#007fff">//此方法会注册&nbsp;<b>ExpressionUrlAuthorizationConfigurer</b></font></div><div>.<b>authorizeRequests</b>()&nbsp;</div><div>&nbsp; &nbsp; <font color="#007fff">//非匿名和记住我的认证用户可以访问(这里的用户应该指的是客户端应用)</font></div><div>&nbsp; &nbsp; .antMatchers(tokenEndpointPath).<b>fullyAuthenticated</b>()&nbsp;</div><div>&nbsp; &nbsp; .antMatchers(tokenKeyPath).access(configurer.getTokenKeyAccess())</div><div><font color="#007fff">&nbsp; &nbsp; //默认是denyAll(),要想访问此端点必须修改,上面自定义配置中改成了</font></div><div><font color="#007fff">&nbsp; &nbsp; // isAuthenticated()</font></div><div>&nbsp; &nbsp; .antMatchers(checkTokenPath).access(configurer.getCheckTokenAccess())</div><div>.and()</div><div>.requestMatchers()</div><div>&nbsp; &nbsp; .antMatchers(tokenEndpointPath, tokenKeyPath, checkTokenPath)</div><div>.and()</div><div>.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER);</div><div><span style="background-color: initial;">http.setSharedObject(ClientDetailsService.class, clientDetailsService);</span><br></div></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;arcSize=4;" parent="1" vertex="1">
<mxGeometry x="1840" y="1940" width="360" height="180" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-18" value="<font style="font-size: 10px;" color="#007fff">端点安全配置<br>/oauth/token<br>/oauth/token_key<br>/oauth/check_token</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1730" y="1960" width="110" height="70" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-24" value="<div style="font-size: 10px;"><font color="#007fff">配置类共有12个</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">CsrfConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">ExceptionHandlingConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">HeadersConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">SessionManagementConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">SecurityContextConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">RequestCacheConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">AnonymousConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">ServletApiConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">DefaultLoginPageConfigurer</font></div><div style=""><font color="#007fff" style="">LogoutConfigurer<br><b>AuthorizationServerSecurityConfigurer</b><br></font></div><div style=""><font color="#007fff" style="">ExpressionUrlAuthorizationConfigurer<br></font></div>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1500" y="1720" width="210" height="170" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-35" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-28" target="uCyp3sCYdSISI6nv47Nj-34" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-28" value="<font style="font-size: 10px;"><div style="">for configurers:&nbsp;<br><span style="">configurer.init((B) this);</span><br></div><div style="font-size: 10px;"><font color="#007fff">遍历过滤器配置类( 测试中有12个)执行初始化</font></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1520" y="2160" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-44" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="uCyp3sCYdSISI6nv47Nj-30" target="uCyp3sCYdSISI6nv47Nj-45" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1720" y="2440" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-52" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="uCyp3sCYdSISI6nv47Nj-30" target="uCyp3sCYdSISI6nv47Nj-50" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-30" value="<font style="font-size: 10px;"><div style="">for configurers:&nbsp;<br><span style="">configurer.configure((B) this);</span><br></div><div style="font-size: 10px;"><font color="#007fff">遍历过滤器配置类执行配置</font></div><div style="font-size: 10px;"><font color="#007fff">只关注其中两个过滤器配置类</font></div></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1520" y="2420" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-32" value="<font style="font-size: 10px;"><div style="">Collections.sort(filters, comparator);</div><div style="">return new <b>DefaultSecurityFilterChain</b>(</div><div style="">requestMatcher, filters);</div></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1520" y="2520" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-37" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-34" target="uCyp3sCYdSISI6nv47Nj-36" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-34" value="<font style=""><div style=""><font style="font-size: 10px;"><b>AuthorizationServerSecurityConfigurer</b></font><br></div><div style=""><font style="font-size: 10px;"><b>#init(HttpSecurity http)</b></font></div><div style=""><font color="#007fff" style="font-size: 10px;">主要关注这个</font></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1720" y="2160" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-39" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-36" target="uCyp3sCYdSISI6nv47Nj-38" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-36" value="<font style=""><div style=""><font style="font-size: 10px;">registerDefaultAuthenticationEntryPoint(http);</font><br></div></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1960" y="2160" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-41" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-38" target="uCyp3sCYdSISI6nv47Nj-40" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2060" y="2310" />
<mxPoint x="2120" y="2310" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-38" value="<font style=""><div style=""><font style="font-size: 10px;">http.userDetailsService(new ClientDetailsUserDetailsService(<br>clientDetailsService()));</font><br></div></font>" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="1960" y="2240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-40" value="<font style="font-size: 10px;"><div style=""><div>http</div><div>&nbsp; .securityContext()</div><div>&nbsp; &nbsp; .securityContextRepository(new NullSecurityContextRepository())</div><div>&nbsp; .and()</div><div>&nbsp; .csrf().disable()</div><div>&nbsp; .httpBasic().realmName(realm);</div><div><font color="#007fff">这里关闭了CSRF配置,添加了BASIC配置</font></div></div></font>" style="rounded=1;whiteSpace=wrap;html=1;align=left;arcSize=7;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1960" y="2320" width="320" height="80" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-42" value="<div style="font-size: 10px;"><font color="#007fff">配置类变更为:</font></div><div style="font-size: 10px;"><span style="color: rgb(0, 127, 255); background-color: initial;">ExceptionHandlingConfigurer</span><br></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">HeadersConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">SessionManagementConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">SecurityContextConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">RequestCacheConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">AnonymousConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">ServletApiConfigurer</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;"><strike>DefaultLoginPageConfigurer</strike></font></div><div style=""><font color="#007fff" style="">LogoutConfigurer<br><b>AuthorizationServerSecurityConfigurer</b><br></font></div><div style=""><font color="#007fff" style="">ExpressionUrlAuthorizationConfigurer<br>HttpBasicConfigurer<br></font></div>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1720" y="2230" width="210" height="170" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-47" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-45" target="uCyp3sCYdSISI6nv47Nj-46" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-45" value="<font style="font-size: 10px;"><div style=""><font style="font-size: 10px;"><b>AuthorizationServerSecurityConfigurer</b></font><br></div><div style=""><font style="font-size: 10px;"><b style="">#</b><b>configure</b><b style="">(HttpSecurity http)</b></font></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1720" y="2420" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-49" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-46" target="uCyp3sCYdSISI6nv47Nj-48" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-46" value="<font style="font-size: 10px;"><div style="font-size: 10px;">frameworkEndpointHandlerMapping();<br style="font-size: 10px;"></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1960" y="2420" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-48" value="<font style="font-size: 9px;"><div style="">http.exceptionHandling()</div><div style="">.accessDeniedHandler(accessDeniedHandler);<br style="font-size: 10px;"></div><div style=""><font color="#007fff">替换&nbsp;ExceptionHandlingConfigurer&nbsp;<br>accessDeniedHandler 为 <b>OAuth2AccessDeniedHandler</b></font></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1960" y="2500" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-54" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-50" target="uCyp3sCYdSISI6nv47Nj-53" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-50" value="<font style="font-size: 10px;"><div style="font-size: 10px;"><b style="font-size: 10px;">ExpressionUrlAuthorizationConfigurer</b><br style="font-size: 10px;"></div><div style="font-size: 10px;"><font style="font-size: 10px;"><b style="font-size: 10px;">#</b><b style="font-size: 10px;">configure</b><b style="font-size: 10px;">(H http)</b></font></div><div style=""><font style=""><b><font color="#007fff">将基于SpEL表达式和URL的授权添加到应用程序</font></b><br></font></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1720" y="2580" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-56" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-53" target="uCyp3sCYdSISI6nv47Nj-55" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-137" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0;entryDx=0;entryDy=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="uCyp3sCYdSISI6nv47Nj-53" target="BTdmhbfbiTqf7HtIRt79-134" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1940" y="2640" />
<mxPoint x="1940" y="3920" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="eSneWQZtIDrDD-FYfVUk-12" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="uCyp3sCYdSISI6nv47Nj-53" target="eSneWQZtIDrDD-FYfVUk-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-53" value="<font style=""><div style="">FilterInvocationSecurityMetadataSource <b>metadataSource</b> = createMetadataSource(http);<br></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1960" y="2580" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-59" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="uCyp3sCYdSISI6nv47Nj-55" target="uCyp3sCYdSISI6nv47Nj-58" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-55" value="<font style=""><div style=""><div>FilterSecurityInterceptor securityInterceptor = <b>createFilterSecurityInterceptor</b>(<span style="background-color: initial;">http, <b>metadataSource</b>, http.getSharedObject(</span></div><div><span style="background-color: initial;">AuthenticationManager.class));</span></div></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1960" y="2660" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-57" value="<div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">{AntPathRequestMatcher@8160} "Ant [pattern='/oauth/token']" -&gt; {ArrayList@8161}&nbsp; size = 1</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp;key = {AntPathRequestMatcher@8160} "<b>Ant [pattern='/oauth/token']</b>"</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp;value = {ArrayList@8161}&nbsp; size = 1</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp; 0 = {SecurityConfig@8170} "<b>fullyAuthenticated</b>"</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">{AntPathRequestMatcher@8162} "Ant [pattern='/oauth/token_key']" -&gt; {ArrayList@8163}&nbsp; size = 1</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp;key = {AntPathRequestMatcher@8162} "Ant [pattern='/oauth/token_key']"</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp;value = {ArrayList@8163}&nbsp; size = 1</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp; 0 = {SecurityConfig@8174} "denyAll()"</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">{AntPathRequestMatcher@8164} "Ant [pattern='/oauth/check_token']" -&gt; {ArrayList@8165}&nbsp; size = 1</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp;key = {AntPathRequestMatcher@8164} "Ant [<b>pattern='/oauth/check_token'</b>]"</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp;value = {ArrayList@8165}&nbsp; size = 1</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">&nbsp; 0 = {SecurityConfig@8177} "<b>isAuthenticated</b>()"</font></div>" style="text;html=1;align=left;verticalAlign=top;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="2440" y="2480" width="470" height="160" as="geometry" />
</mxCell>
<mxCell id="uCyp3sCYdSISI6nv47Nj-58" value="<font style=""><div style=""><div>http.<b>addFilter</b>(securityInterceptor);</div><div>http.setSharedObject(</div><div>FilterSecurityInterceptor.class, securityInterceptor);</div></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1960" y="2740" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-17" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-4" target="BTdmhbfbiTqf7HtIRt79-11" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-4" value="OncePerRequestFilter#doFilter()<br style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">大部分过滤器都继承此过滤器</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1200.5" y="2880" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-19" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-11" target="BTdmhbfbiTqf7HtIRt79-18" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-11" value="BasicAuthenticationFilter#<b>doFilterInternal</b>()" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1440" y="2880" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-23" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-18" target="BTdmhbfbiTqf7HtIRt79-22" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-18" value="String header = request.getHeader("<b>Authorization</b>");" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1680" y="2880" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-26" value="N" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-22" target="BTdmhbfbiTqf7HtIRt79-25" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-28" value="Y" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-22" target="BTdmhbfbiTqf7HtIRt79-27" edge="1">
<mxGeometry x="0.6667" y="-10" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-22" value="<font style="font-size: 9px;">header != null &amp;&amp; header.toLowerCase()<br>.startsWith("<b>basic</b> ")</font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;" parent="1" vertex="1">
<mxGeometry x="1720" y="2960" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-25" value="直接走下一个过滤器" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;" parent="1" vertex="1">
<mxGeometry x="1920" y="2970" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-34" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-27" target="BTdmhbfbiTqf7HtIRt79-33" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-27" value="String[] tokens = this.extractAndDecodeHeader(header, request);<br><font color="#007fff">提取用于Basic认证的信息,tokens[0]是用户名,tokens[1]是密码</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1680" y="3060" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-30" value="<font color="#007fff" style="font-size: 10px;">Basic认证信息是将用户名密码通过“:”连接,<br>然后经过Base64编码,然后添加“Basic ”前缀生成<br></font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1888" y="3070" width="240" height="40" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-36" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-33" target="BTdmhbfbiTqf7HtIRt79-35" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-41" value="N" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="BTdmhbfbiTqf7HtIRt79-36" vertex="1" connectable="0">
<mxGeometry x="-0.1208" y="-2" relative="1" as="geometry">
<mxPoint x="5" y="-2" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-46" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-33" target="BTdmhbfbiTqf7HtIRt79-45" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-33" value="<font style="font-size: 9px;">this<br>.authenticationIsRequired(<br>username)</font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;" parent="1" vertex="1">
<mxGeometry x="1720" y="3140" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-35" value="直接走下一个过滤器" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;" parent="1" vertex="1">
<mxGeometry x="1920" y="3150" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-44" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-39" target="BTdmhbfbiTqf7HtIRt79-43" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-39" value="<div>UsernamePasswordAuthenticationToken authRequest = new <b>UsernamePasswordAuthenticationToken</b>(</div><div>username, tokens[1]);</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1920" y="3240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-42" value="<font color="#007fff"><b>是否需要认证</b>:<br>检查安全上下文是否已经存在认证信息,<br>不存在或信息未经过认证或认证的信息是匿名认证信息<br>或认证信息是用户名密码认证信息但不是当前用户的认证信息<br>都需要认证</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1455" y="3145" width="290" height="70" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-49" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-43" target="BTdmhbfbiTqf7HtIRt79-48" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-65" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-43" target="BTdmhbfbiTqf7HtIRt79-64" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-43" value="authRequest.setDetails(this<br>.authenticationDetailsSource<br>.<b>buildDetails</b>(request));" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1920" y="3320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-47" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-45" target="BTdmhbfbiTqf7HtIRt79-39" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-57" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-45" target="BTdmhbfbiTqf7HtIRt79-56" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-45" value="<div>BASIC认证流程</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1680" y="3240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-51" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-48" target="BTdmhbfbiTqf7HtIRt79-50" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-69" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-48" target="BTdmhbfbiTqf7HtIRt79-68" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-48" value="Authentication authResult = this.authenticationManager<br>.authenticate(authRequest);<br><font color="#007fff">调用认证管理器中的认证服务进行认证</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1920" y="3420" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-53" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-50" target="BTdmhbfbiTqf7HtIRt79-52" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-143" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=1;exitDx=0;exitDy=0;entryX=0.996;entryY=0.056;entryDx=0;entryDy=0;fillColor=#d5e8d4;strokeColor=#82b366;entryPerimeter=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-50" target="BTdmhbfbiTqf7HtIRt79-141" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2130" y="3560" />
<mxPoint x="2130" y="4003" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-50" value="SecurityContextHolder.getContext()<br>.setAuthentication(authResult);<br><font color="#007fff">保存认证结果到安全上下文</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1920" y="3500" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-52" value="this.<b>rememberMeServices</b><br>.loginSuccess(request, response, authResult);" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1920" y="3580" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-56" value="<div>走下一个过滤器</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1680" y="3320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-67" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;endArrow=diamondThin;endFill=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-61" target="BTdmhbfbiTqf7HtIRt79-66" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-74" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-61" target="BTdmhbfbiTqf7HtIRt79-70" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-75" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-61" target="BTdmhbfbiTqf7HtIRt79-71" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-61" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 10px;"><b style="font-size: 10px;">AbstractAuthenticationToken</b><br style="font-size: 10px;"></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 权限列表,如角色等,认证通过后获取</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Collection&lt;GrantedAuthority&gt; <b>authorities</b>;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 身份认证细节信息(比如请求来源IP、SessionId等)</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private Object <b>details</b>;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 是否已经认证过</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private boolean <b>authenticated</b> = false;</font></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-400" y="2720" width="360" height="120" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-62" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;fontSize=9;fontColor=#007FFF;endArrow=block;endFill=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-63" target="BTdmhbfbiTqf7HtIRt79-61" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-63" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 10px;"><b style="font-size: 10px;">UsernamePasswordAuthenticationToken</b><br style="font-size: 10px;"></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 意为“当事人</font><font color="#007fff" style="font-size: 10px;">”,此处是用户名</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 此单词容易和principle(原则)混淆发音相同</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Object principal;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 凭证,即密码信息</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private Object credentials;</font></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-400" y="2880" width="360" height="120" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-64" value="authRequest.setDetails(this<br>.authenticationDetailsSource<br>.<b>buildDetails</b>(request));" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="2160" y="3320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-66" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>WebAuthenticationDetails</b><br style="font-size: 10px;"></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 请求来源IP地址</font></p><p style="margin: 0px 0px 0px 4px;">private final String <b>remoteAddress</b>;</p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff">// 会话ID</font></p><p style="margin: 0px 0px 0px 4px;"></p><p style="margin: 0px 0px 0px 4px;">private final String <b>sessionId</b>;</p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-800" y="2720" width="360" height="120" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-79" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-68" target="BTdmhbfbiTqf7HtIRt79-78" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-68" value="for&nbsp;getProviders():<br><div>if (!provider.supports(toTest)) {</div><div>&nbsp; &nbsp; continue;<span style=""></span></div><div><span style="">}</span></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="2160" y="3420" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-73" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" source="BTdmhbfbiTqf7HtIRt79-70" target="BTdmhbfbiTqf7HtIRt79-72" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-70" value="<p style="margin: 4px 0px 0px; text-align: center;"><b>Authentication </b>(I)</p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-240" y="2640" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-71" value="<div style="text-align: center;"><b>CredentialsContainer</b><b style="background-color: initial;">&nbsp;</b><span style="background-color: initial;">(I)</span></div><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-480" y="2640" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-72" value="<div style="text-align: center;"><b>Principal</b><b style="background-color: initial;">&nbsp;</b><span style="background-color: initial;">(I)</span></div><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;" parent="1" vertex="1">
<mxGeometry x="-240" y="2580" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-77" value="<font style="font-size: 10px;">ProviderManager</font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="2210" y="3390" width="100" height="30" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-82" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-78" target="BTdmhbfbiTqf7HtIRt79-81" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-88" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-78" target="BTdmhbfbiTqf7HtIRt79-87" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-78" value="result = provider.authenticate(authentication);" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="2160" y="3500" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-80" value="<font style="font-size: 10px;">DaoAuthenticationProvider</font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="2190" y="3477" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-84" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-81" target="BTdmhbfbiTqf7HtIRt79-83" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-81" value="<div>user = <b>retrieveUser</b>(username,</div><div>(UsernamePasswordAuthenticationToken) authentication);</div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="2400" y="3500" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-86" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-83" target="BTdmhbfbiTqf7HtIRt79-85" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-83" value="UserDetails loadedUser = this.<b>getUserDetailsService</b>()<br>.loadUserByUsername(username);<br><font color="#007fff">此处的UserDetailsService是ClientDetailsUserDetailsService</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2640" y="3500" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-85" value="return new User(username, clientSecret, clientDetails.getAuthorities());" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="2640" y="3580" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-90" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-87" target="BTdmhbfbiTqf7HtIRt79-89" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-87" value="preAuthenticationChecks.check(user);<br><font color="#007fff">认证前置检查:检查用户是否有效(isEnabled()、isAccountNonExpired())</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="2160" y="3580" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-92" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-89" target="BTdmhbfbiTqf7HtIRt79-91" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-89" value="<div>additionalAuthenticationChecks(user,</div><div>(UsernamePasswordAuthenticationToken) authentication);<span style=""></span></div><div><font color="#007fff">检查输入的密码和保存的密码是否相同</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="2160" y="3660" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-94" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-91" target="BTdmhbfbiTqf7HtIRt79-93" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-91" value="postAuthenticationChecks.check(user);<br><font color="#007fff">检查凭证是否过期</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="2160" y="3740" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-96" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-93" target="BTdmhbfbiTqf7HtIRt79-95" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-98" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="BTdmhbfbiTqf7HtIRt79-93" target="BTdmhbfbiTqf7HtIRt79-97" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-93" value="return createSuccessAuthentication(<br>principalToReturn, authentication, user);<br><font color="#007fff">添加上权限信息</font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;" parent="1" vertex="1">
<mxGeometry x="2160" y="3820" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-95" value="<div style="font-size: 9px;"><font style="font-size: 9px;">usernamePasswordAuthenticationToken result = new <b>UsernamePasswordAuthenticationToken</b>(</font></div><div style="font-size: 9px;"><font style="font-size: 9px;">principal, authentication.getCredentials(),</font></div><div style="font-size: 9px;"><font style="font-size: 9px;">authoritiesMapper.<b>mapAuthorities</b>(</font></div><div style="font-size: 9px;"><font style="font-size: 9px;">user.getAuthorities()));</font></div><div style=""><font size="1" style=""><div style="">result.setDetails(authentication.getDetails());</div><div style=""><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp;</span>return result;</div></font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2390" y="3810" width="220" height="80" as="geometry" />
</mxCell>
<mxCell id="BTdmhbfbiTqf7HtIRt79-97" value="<div>if (eraseCredentialsAfterAuthentication</div><div>&amp;&amp; (result instanceof CredentialsContainer)) {<span style=""></span></div><div>((CredentialsContainer)result).eraseCredentials();<br></div><div style="font-size: 9px;">}</div><div style="font-size: 9px;"><font color="#007fff" style="font-size: 9px;">清除认证信息中的密码信息,为了安全,默认总是清除</font></div>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;" parent="1" vertex="1">
<mxGeometry x="2150" y="3900" width="220" height="60" as="geometry" />