{"id":269061,"date":"2021-01-09T13:49:00","date_gmt":"2021-01-09T05:49:00","guid":{"rendered":"http:\/\/4563.org\/?p=269061"},"modified":"2021-01-09T13:49:00","modified_gmt":"2021-01-09T05:49:00","slug":"%e4%bd%bf%e7%94%a8-spring-security-%e5%90%8e%e6%80%a7%e8%83%bd%e7%9b%b8%e5%b7%ae-2-4-%e5%80%8d%ef%bc%9f%e6%98%af%e6%88%91%e8%87%aa%e5%b7%b1%e7%9a%84%e9%97%ae%e9%a2%98%e5%90%97%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=269061","title":{"rendered":"\u4f7f\u7528 Spring Security \u540e\u6027\u80fd\u76f8\u5dee 2-4 \u500d\uff1f\u662f\u6211\u81ea\u5df1\u7684\u95ee\u9898\u5417\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4f7f\u7528 Spring Security \u540e\u6027\u80fd\u76f8\u5dee 2-4 \u500d\uff1f\u662f\u6211\u81ea\u5df1\u7684\u95ee\u9898\u5417\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : VeryZero <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6d4b\u8bd5\u73af\u5883\uff1a \u786c\u4ef6\uff1aMacbookPro 8 \u6838 16G \u8f6f\u4ef6\uff1aJMeter 1000 \u7ebf\u7a0b\u6bcf\u79d2\uff0cSpringBoot2.2.10<\/p>\n<p>\u7981\u7528 Spring Security\uff0c\u541e\u5410\u91cf\u7ea6 20000 \u5de6\u53f3 \u542f\u7528 Spring Security\uff0c\u541e\u5410\u91cf\u4e0b\u964d\u4e3a 5000 \u5de6\u53f3<\/p>\n<p>Spring Security \u91cc\u9762\u7684\u903b\u8f91\u57fa\u672c\u90fd\u5220\u4e86\uff0c\u53ea\u7559\u4e86\u4e0b\u4e00\u4e9b antMatchers \u548c mvcMatchers\uff0c\u5927\u6982\u770b\u4e86\u4e0b\u4e3b\u8981\u8870\u51cf\u5e94\u8be5\u5c31\u662f\u56e0\u4e3a\u8fd9\u4e9b Matchers \u3002\u6709\u8870\u51cf\u5f88\u6b63\u5e38\uff0c\u4f46\u662f\u8fd9\u8870\u51cf\u5e45\u5ea6\u5f88\u8ba9\u6211\u5403\u60ca\u7684\u3002<\/p>\n<p>\u5728\u7f51\u4e0a\u627e\u4e86\u4e00\u5708\uff0c\u6ca1\u627e\u5230\u6709\u4eba\u8c08\u8bba\u8fd9\u4e2a\uff0c\u96be\u9053\u662f\u6211\u73af\u5883\u6709\u95ee\u9898\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>18<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4879680\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hantsy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u7cfb\u5217\u7684 Filter \u4e0a\u4e86\uff0c\u80af\u5b9a\u5f71\u54cd\u6027\u80fd\u554a\u3002<\/p>\n<p>\u4e0d\u9700\u8981\u5b8c\u5168\u5904\u7406\uff0c\u76f4\u63a5\u8df3\u8fc7\u53bb\u554a\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879681\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hantsy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u9700\u8981\u5b89\u5168\u7684\uff0c\u76f4\u63a5\u8df3\u8fc7\u53bb\u3002<\/p>\n<p>https:\/\/docs.spring.io\/spring-security\/site\/docs\/current\/api\/org\/springframework\/security\/config\/annotation\/web\/configuration\/WebSecurityConfigurerAdapter.html#configure-org.springframework.security.config.annotation.web.builders.WebSecurity-<\/p>\n<p>https:\/\/docs.spring.io\/spring-security\/site\/docs\/current\/api\/org\/springframework\/security\/config\/annotation\/web\/builders\/WebSecurity.html                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879682\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xbh1794970183564 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             mbp \u6027\u80fd\u8fd9\u4e48\u5c4c\uff0c\u541e\u5410\u80fd\u5230 2w \uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879683\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : KevinBlandy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u4e9b\u7b80\u5355\u7684\u6743\u9650\uff0c\u767b\u5f55\u3002\u3002\u6839\u672c\u6ca1\u5fc5\u8981\u7528\u8fd9\u4e2a\u4e1c\u897f\uff0cFilter\/Intercptor \u5c31\u80fd\u89e3\u51b3\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879684\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qwerthhusn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u611f\u89c9 Spring Security \u592a\u8fc7\u4e8e\u590d\u6742\u4e86<\/p>\n<p>\u73b0\u5728\u57fa\u672c\u4e0a\u90fd\u662f\u505a API \u5f00\u53d1\uff0c\u76f4\u63a5\u4e00\u4e2a Interceptor \u62ff\u5230 Token \u505a\u4e00\u4e0b\u8ba4\u8bc1\u9274\u6743\uff0c\u628a\u7528\u6237 id \u5565\u7684\u5199\u5230 attribute \u91cc\u9762\u53bb\uff0c\u76f4\u63a5\u5c31\u53bb Controller \u8dd1\u4ee3\u7801\u4e86\uff0c\u6e05\u6670\u76f4\u89c2\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879685\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : VeryZero <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hantsy \u4ed6\u9700\u8981\u901a\u8fc7\u8def\u5f84\u5339\u914d\u51b3\u5b9a\u662f\u8df3\u8fc7\u8fd8\u662f\u8fdb\u884c\u6743\u9650\u6821\u9a8c\u3002\u6211\u611f\u89c9\u6162\u5c31\u6162\u5728\u8def\u5f84\u5339\u914d\u8fd9\u4e00\u6b65\u3002\u5177\u4f53\u662f\u4e0d\u662f\u660e\u5929\u63a5\u7740\u6d4b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879686\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : VeryZero <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @qwerthhusn \u662f\u7684\uff0c\u592a\u590d\u6742\u4e86\u3002\u7528\u5728\u597d\u51e0\u4e2a\u9879\u76ee\u4e86\uff0c\u8fd8\u662f\u6ca1\u5b8c\u5168\u73a9\u8f6c\u3002\u5982\u679c\u8fd9\u4e48\u5927\u6027\u80fd\u635f\u8017\u786e\u5b9e\u5b58\u5728\uff0c\u4e0b\u4e2a\u9879\u76ee\u4e0d\u60f3\u518d\u7528\u4e86\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879687\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hantsy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @VeryZero <br \/>SpringSecurityConfigurger \u4e2d\u5e38\u89c1\u7684\u4e24\u4e2a\u65b9\u6cd5\uff1a<\/p>\n<p>configure(WebScurirty) \u51b3\u5b9a\u54ea\u4e9b\u8981\u901a\u8fc7 Spring Security Filter\uff0c\u8fd9\u4e2a\u51b3\u5b9a\u54ea\u4e2a\u8def\u5f84\u8981\u4e0d\u8981\u7528 Spring Filter \u3002\u4e00\u822c\u8fd9\u91cc\u90fd\u662f\u8fc7\u6ee4\u6389\u9759\u6001\u8d44\u6e90( css, js, swagger-ui \u7b49)\u3002<\/p>\n<p>configure(HttpSecurity) \u624d\u662f\u5b89\u5168\u914d\u7f6e\uff0c\u6bcf\u4e2a Path \u68c0\u6d4b\u7684\u76ee\u7684\u4e0d\u4e00\u6837\uff0c\u5bfc\u81f4\u7684\u4e0d\u540c Filter \u5e94\u7528\u4e0a\u53bb\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879688\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hantsy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @qwerthhusn \u4f60\u8fd9\u4e2a\u73a9\u6cd5\u53ef\u4ee5\u662f\u53ef\u4ee5\u3002\u81ea\u5df1\u73a9\u73a9\u6ca1\u95ee\u9898\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879689\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hantsy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6027\u80fd\u76f8\u5dee 2-4 \u500d\uff1f\u6211\u89c9\u5f97\u4e3b\u8981\u53d6\u51b3\u4f60\u7684\u7a0b\u5e8f\u590d\u6742\u5ea6\uff0c\u5982\u679c\u4ee5\u4e00\u4e2a\u57fa\u672c\u7684 CRUD\uff0c\u5305\u542b\u6570\u636e\u5e93\u64cd\u4f5c\u7b49\u7b49\uff0c\u5e94\u8be5\u4e0d\u4f1a\u90a3\u4e48\u5927\u3002\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u5355\u7eaf\u7684\u6d4b\u8bd5\u4e00\u4e2a\u7eaf Web \u5c42\uff0c\u4ec0\u4e48\u90fd\u4e0d\u505a\u6709\u4ec0\u4e48\u610f\u4e49\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879690\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : alex8 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u57fa\u4e8e Redis \u81ea\u5df1\u5199 AOP \u505a\u9274\u6743                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879691\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : beichenhpy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u4e1c\u897f\u592a\u91cd\u4e86\uff0c\u5982\u679c\u7528\u4e0d\u5230 rbac \u5c31\u4e0d\u7528\u4e86\u5427\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879692\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tomsun28 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fc7\u6ee4\u94fe ant \u5339\u914d\u95ee\u9898 \u8bb0\u5f97\u4ed6\u548c shiro \u90fd\u662f\u8fc7\u6ee4\u94fe\u4e00\u4e2a\u4e00\u4e2a\u5bf9\u8bf7\u6c42\u5339\u914d\u7684 \u53ef\u4ee5\u8003\u8651\u4e0b sureness https:\/\/github.com\/tomsun28\/sureness\/blob\/master\/docs\/design.md                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879693\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xuanbg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8def\u5f84\u5339\u914d\u4e0d\u8981\u50bb\u4e4e\u4e4e\u5730\u53bb\u904d\u5386\uff0c\u6ca1\u6709\u8def\u5f84\u53d8\u91cf\u7684 url \u53ef\u4ee5\u7528 hashmap\uff0c\u4e00\u4e0b\u5b50\u5c31\u4ece O(n)\u53d8\u6210 O(1)                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879694\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fpure <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Spring Security \u592a\u590d\u6742\u592a\u96be\u7528\u4e86\uff0c\u6211\u81ea\u5df1\u5199\u4e2a\u8fc7\u6ee4\u5668\u62e6\u622a\u5668\u7b80\u5355\u591a\u4e86\uff0c\u8981\u5b9e\u73b0 rbac \u4e5f\u7b80\u5355\u3002\u4e0d\u7406\u89e3\u4e3a\u4ec0\u4e48\u9274\u6743\u8fd9\u4e48\u7b80\u5355\u7684\u4e1a\u52a1\u5927\u5bb6\u5374\u8981\u4f7f\u7528\u8fd9\u4e48\u590d\u6742\u96be\u7528\u7684\u6846\u67b6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879695\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cs419 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             security \u7684\u4e3b\u8981\u8fd0\u884c\u6d41\u7a0b\u4e0d\u662f\u5f88\u96be <br \/>\u5751\u7239\u7684\u5730\u65b9\u5728\u4e8e \u903c\u7740\u5927\u4f19\u7528 \u914d\u7f6e\u7c7b\u53bb\u521d\u59cb\u5316\u5b83 <br \/>http.userdetailService(detailService) http.xxxConfigure http.xxx.disable \u7b49\u7b49 <br \/>\u8fd9\u4e9b\u73a9\u610f\u7528\u8d77\u6765\u5012\u662f\u7b80\u5355\uff0c \u60f3\u5b9a\u5236\u7684\u590d\u6742\u70b9\uff0c\u5c31\u7ed5\u7684\u614c\uff0c\u5570\u55e6\u7684\u4e0d\u884c <\/p>\n<p>\u98ce\u6c14\u5c31\u662f\u4ece spring boot \u90a3\u65f6\u5019\u641e\u574f\u7684\uff0cxml \u7684\u914d\u7f6e\u65b9\u5f0f\uff0c\u5570\u55e6\u4f46\u7ed3\u6784\u6e05\u6670 <br \/>\u5230\u4e86 boot \u7684\u65f6\u4ee3\uff0c\u81ea\u52a8\u5316\u914d\u7f6e\u7c7b\uff0c\u5404\u79cd\u6761\u4ef6\u88c5\u914d\uff0c \u7a0b\u5e8f\u7684\u88c5\u8f7d\u662f\u52a8\u6001\u5316\u4e86<br \/>\u60f3\u770b\u61c2\u4e3b\u8981\u7ed3\u6784 \u5934\u90fd\u5927\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879696\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : echo1937 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @cs419 #16 \u4e00\u6837\u7684\u914d\u7f6e\uff0c\u7528 Java Config \u7edd\u5bf9\u6bd4 XML \u7b80\u5355\u6709\u6548                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4879697\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Veneris <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u501f\u95ee\u4e00\u4e0b\uff0c\u505a\u540e\u7aef\u7ba1\u7406\u7684\u6743\u9650\u6709\u6ca1\u6709\u4ec0\u4e48\u7b80\u6d01\u8f7b\u91cf\u591a\u6846\u67b6\uff0c\u5c31\u662f\u63a7\u5236\u89d2\u8272\u80fd\u770b\u5230\uff0c\u8bbf\u95ee\u54ea\u4e9b\u9875\u9762\u548c\u6309\u94ae                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 Spring Securit&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/269061"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=269061"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/269061\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=269061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=269061"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=269061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}