{"id":8601,"date":"2023-11-28T20:32:14","date_gmt":"2023-11-28T12:32:14","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=8601"},"modified":"2023-12-06T10:49:03","modified_gmt":"2023-12-06T02:49:03","slug":"springboot-zhong-bi-jiao-yi-xiaspring-security-hes","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/springboot-zhong-bi-jiao-yi-xiaspring-security-hes\/","title":{"rendered":"SpringBoot\u4e2d\u6bd4\u8f83\u4e00\u4e0bSpring Security\u548cShiro\u5404\u81ea\u7684\u4f18\u7f3a\u70b9?"},"content":{"rendered":"<p>Spring Security\u548cApache Shiro\u662f\u4e24\u4e2a\u5728Java\u9886\u57df\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u5b89\u5168\u6846\u67b6\uff0c\u5b83\u4eec\u90fd\u63d0\u4f9b\u4e86\u8eab\u4efd\u9a8c\u8bc1\uff08Authentication\uff09\u548c\u6388\u6743\uff08Authorization\uff09\u7684\u529f\u80fd\uff0c\u4f46\u5728\u8bbe\u8ba1\u7406\u5ff5\u3001\u4f7f\u7528\u65b9\u5f0f\u548c\u7279\u70b9\u4e0a\u5b58\u5728\u4e00\u4e9b\u533a\u522b\u3002\u4e0b\u9762\u662f\u5bf9\u5b83\u4eec\u7684\u4f18\u7f3a\u70b9\u7684\u7b80\u8981\u6bd4\u8f83\uff1a<\/p>\n<h3><a id=\"spring-security\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>Spring Security:<\/h3>\n<h4><a id=\"%E4%BC%98%E7%82%B9%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u4f18\u70b9\uff1a<\/h4>\n<ol>\n<li>\n<strong>\u5f3a\u5927\u7684\u96c6\u6210\u6027\uff1a<\/strong><\/p>\n<ul>\n<li>Spring Security\u4e0eSpring\u6846\u67b6\u6df1\u5ea6\u96c6\u6210\uff0c\u53ef\u4ee5\u65e0\u7f1d\u4e0eSpring\u7684\u5404\u4e2a\u6a21\u5757\u548c\u5176\u4ed6\u7b2c\u4e09\u65b9\u5e93\u96c6\u6210\u3002\u7279\u522b\u662f\u5728\u57fa\u4e8eSpring\u7684\u5e94\u7528\u4e2d\uff0cSpring Security\u662f\u4e00\u4e2a\u81ea\u7136\u800c\u7136\u7684\u9009\u62e9\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u5e7f\u6cdb\u7684\u793e\u533a\u652f\u6301\uff1a<\/strong><\/p>\n<ul>\n<li>\u7531\u4e8eSpring Security\u662fSpring\u9879\u76ee\u7684\u4e00\u90e8\u5206\uff0c\u5b83\u6709\u7740\u5e9e\u5927\u7684\u793e\u533a\u652f\u6301\uff0c\u4e30\u5bcc\u7684\u6587\u6863\u548c\u793e\u533a\u8ba8\u8bba\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u66f4\u590d\u6742\u7684\u573a\u666f\u652f\u6301\uff1a<\/strong><\/p>\n<ul>\n<li>Spring Security\u66f4\u9002\u5408\u4e8e\u590d\u6742\u7684\u4f01\u4e1a\u7ea7\u5e94\u7528\uff0c\u63d0\u4f9b\u4e86\u7ec6\u7c92\u5ea6\u7684\u8bbf\u95ee\u63a7\u5236\u3001LDAP\u96c6\u6210\u3001OpenID Connect\u7b49\u9ad8\u7ea7\u529f\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>AOP\u652f\u6301\uff1a<\/strong><\/p>\n<ul>\n<li>Spring Security\u4f7f\u7528AOP\uff08\u9762\u5411\u5207\u9762\u7f16\u7a0b\uff09\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u5b89\u5168\u6027\uff0c\u5141\u8bb8\u5f00\u53d1\u8005\u901a\u8fc7\u6ce8\u89e3\u548c\u914d\u7f6e\u7684\u65b9\u5f0f\u5b9a\u4e49\u5b89\u5168\u7b56\u7565\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4><a id=\"%E7%BC%BA%E7%82%B9%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u7f3a\u70b9\uff1a<\/h4>\n<ol>\n<li>\n<strong>\u5b66\u4e60\u66f2\u7ebf\u8f83\u9661\u5ced\uff1a<\/strong><\/p>\n<ul>\n<li>\u7531\u4e8eSpring Security\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\u548c\u914d\u7f6e\u9009\u9879\uff0c\u56e0\u6b64\u5b66\u4e60\u66f2\u7ebf\u76f8\u5bf9\u8f83\u9661\u5ced\uff0c\u521d\u5b66\u8005\u53ef\u80fd\u9700\u8981\u82b1\u8d39\u4e00\u4e9b\u65f6\u95f4\u6765\u7406\u89e3\u5176\u5de5\u4f5c\u539f\u7406\u548c\u914d\u7f6e\u65b9\u5f0f\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u914d\u7f6e\u8f83\u4e3a\u590d\u6742\uff1a<\/strong><\/p>\n<ul>\n<li>\u5bf9\u4e8e\u7b80\u5355\u7684\u5e94\u7528\u7a0b\u5e8f\uff0cSpring Security\u7684\u914d\u7f6e\u53ef\u80fd\u663e\u5f97\u8fc7\u4e8e\u590d\u6742\uff0c\u6709\u65f6\u53ef\u80fd\u9700\u8981\u5927\u91cf\u7684XML\u6216Java\u914d\u7f6e\u6765\u5b9a\u4e49\u5b89\u5168\u7b56\u7565\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h3><a id=\"apache-shiro\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>Apache Shiro:<\/h3>\n<h4><a id=\"%E4%BC%98%E7%82%B9%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u4f18\u70b9\uff1a<\/h4>\n<ol>\n<li>\n<strong>\u7b80\u5355\u6613\u7528\uff1a<\/strong><\/p>\n<ul>\n<li>Shiro\u88ab\u8bbe\u8ba1\u6210\u7b80\u5355\u6613\u7528\uff0c\u76f8\u6bd4\u4e8eSpring Security\uff0c\u5176\u5165\u95e8\u95e8\u69db\u8f83\u4f4e\uff0c\u914d\u7f6e\u4e5f\u76f8\u5bf9\u7b80\u5355\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u8f7b\u91cf\u7ea7\uff1a<\/strong><\/p>\n<ul>\n<li>Shiro\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u6846\u67b6\uff0c\u4e0d\u50cfSpring Security\u90a3\u6837\u4f9d\u8d56\u4e8e\u5927\u91cf\u7684Spring\u6a21\u5757\uff0c\u9002\u7528\u4e8e\u4e00\u4e9b\u5c0f\u578b\u6216\u4e2d\u5c0f\u578b\u9879\u76ee\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u76f4\u89c2\u7684API\uff1a<\/strong><\/p>\n<ul>\n<li>Shiro\u63d0\u4f9b\u4e86\u76f4\u89c2\u7684API\uff0c\u4f7f\u5f97\u5f00\u53d1\u8005\u80fd\u591f\u66f4\u5bb9\u6613\u7406\u89e3\u548c\u4f7f\u7528\u5b83\u3002\u5b83\u7684\u8bbe\u8ba1\u76ee\u6807\u4e4b\u4e00\u5c31\u662f\u63d0\u4f9b\u4e00\u4e2a\u7b80\u6d01\u800c\u7075\u6d3b\u7684\u7f16\u7a0b\u63a5\u53e3\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u53ef\u5d4c\u5165\u6027\uff1a<\/strong><\/p>\n<ul>\n<li>Shiro\u53ef\u4ee5\u72ec\u7acb\u4f7f\u7528\uff0c\u4e5f\u53ef\u4ee5\u5d4c\u5165\u5230\u5176\u4ed6\u6846\u67b6\u4e2d\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u7528\u4e8eJava EE\u5e94\u7528\u7a0b\u5e8f\uff0c\u8fd8\u53ef\u4ee5\u7528\u4e8e\u975eJava EE\u73af\u5883\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4><a id=\"%E7%BC%BA%E7%82%B9%EF%BC%9A\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u7f3a\u70b9\uff1a<\/h4>\n<ol>\n<li>\n<strong>\u529f\u80fd\u76f8\u5bf9\u8f83\u7b80\u5355\uff1a<\/strong><\/p>\n<ul>\n<li>\u76f8\u6bd4\u4e8eSpring Security\uff0cShiro\u7684\u529f\u80fd\u76f8\u5bf9\u8f83\u4e3a\u7b80\u5355\uff0c\u5bf9\u4e8e\u4e00\u4e9b\u590d\u6742\u7684\u4f01\u4e1a\u7ea7\u573a\u666f\u53ef\u80fd\u4e0d\u591f\u7075\u6d3b\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u793e\u533a\u76f8\u5bf9\u8f83\u5c0f\uff1a<\/strong><\/p>\n<ul>\n<li>\u867d\u7136Shiro\u6709\u7740\u6d3b\u8dc3\u7684\u793e\u533a\uff0c\u4f46\u76f8\u6bd4\u4e8eSpring Security\u7684\u5e9e\u5927\u793e\u533a\uff0cShiro\u7684\u793e\u533a\u89c4\u6a21\u76f8\u5bf9\u8f83\u5c0f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u7efc\u5408\u6765\u8bf4\uff0c\u9009\u62e9Spring Security\u8fd8\u662fShiro\u53d6\u51b3\u4e8e\u5177\u4f53\u7684\u9879\u76ee\u9700\u6c42\u548c\u56e2\u961f\u7ecf\u9a8c\u3002\u5982\u679c\u4f60\u5df2\u7ecf\u5728\u4f7f\u7528Spring\u6846\u67b6\uff0c\u800c\u4e14\u9700\u8981\u4e00\u5957\u529f\u80fd\u5f3a\u5927\u3001\u9ad8\u5ea6\u96c6\u6210\u7684\u5b89\u5168\u6846\u67b6\uff0c\u90a3\u4e48Spring Security\u53ef\u80fd\u66f4\u9002\u5408\u3002\u5982\u679c\u4f60\u5e0c\u671b\u4e00\u4e2a\u7b80\u5355\u3001\u8f7b\u91cf\u7ea7\u7684\u5b89\u5168\u6846\u67b6\uff0c\u6216\u8005\u4f60\u7684\u9879\u76ee\u89c4\u6a21\u8f83\u5c0f\uff0c\u90a3\u4e48Shiro\u53ef\u80fd\u662f\u4e00\u4e2a\u66f4\u597d\u7684\u9009\u62e9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring Security\u548cApache Shiro\u662f\u4e24\u4e2a\u5728Java\u9886\u57df\u4e2d\u5e7f\u6cdb\u4f7f\u7528\u7684\u5b89\u5168\u6846\u67b6\uff0c\u5b83\u4eec\u90fd\u63d0\u4f9b\u4e86 [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-8601","post","type-post","status-publish","format-standard","hentry","category-springboot"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=8601"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8601\/revisions"}],"predecessor-version":[{"id":16637,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8601\/revisions\/16637"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=8601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=8601"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=8601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}