{"id":8617,"date":"2023-11-28T20:32:50","date_gmt":"2023-11-28T12:32:50","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=8617"},"modified":"2023-12-06T10:51:41","modified_gmt":"2023-12-06T02:51:41","slug":"springboot-zhongshiro-heoauth-hai-youcas-ta-men-zh","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/springboot-zhongshiro-heoauth-hai-youcas-ta-men-zh\/","title":{"rendered":"SpringBoot\u4e2dshiro\u548coauth\u8fd8\u6709cas\u4ed6\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u662f\u4ec0\u4e48\uff1f"},"content":{"rendered":"<p>Spring Boot \u4e2d\u7684 Shiro\u3001OAuth \u548c CAS\uff08Central Authentication Service\uff09\u90fd\u662f\u7528\u4e8e\u8eab\u4efd\u9a8c\u8bc1\u548c\u6388\u6743\u7684\u5b89\u5168\u6846\u67b6\uff0c\u4f46\u5b83\u4eec\u89e3\u51b3\u7684\u95ee\u9898\u9886\u57df\u7565\u6709\u4e0d\u540c\u3002\u4e0b\u9762\u7b80\u8981\u4ecb\u7ecd\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\uff1a<\/p>\n<ol>\n<li>\n<strong>Shiro\uff1a<\/strong><\/p>\n<ul>\n<li>Apache Shiro \u662f\u4e00\u4e2a\u901a\u7528\u7684 Java \u5b89\u5168\u6846\u67b6\uff0c\u63d0\u4f9b\u4e86\u8eab\u4efd\u9a8c\u8bc1\u3001\u6388\u6743\u3001\u52a0\u5bc6\u3001\u4f1a\u8bdd\u7ba1\u7406\u7b49\u529f\u80fd\u3002Shiro \u7684\u8bbe\u8ba1\u76ee\u6807\u662f\u7b80\u5355\u3001\u7075\u6d3b\uff0c\u9002\u7528\u4e8e\u5404\u79cd\u5e94\u7528\u573a\u666f\u3002\u5728 Spring Boot \u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 Spring Boot Starter Shiro \u6765\u96c6\u6210 Shiro \u5230\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u5b9e\u73b0\u5b89\u5168\u529f\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>OAuth\uff1a<\/strong><\/p>\n<ul>\n<li>OAuth\uff08\u5f00\u653e\u6388\u6743\uff09\u662f\u4e00\u4e2a\u5f00\u653e\u6807\u51c6\uff0c\u7528\u4e8e\u6388\u6743\u4e00\u4e2a\u7b2c\u4e09\u65b9\u5e94\u7528\u8bbf\u95ee\u7528\u6237\u7684\u8d44\u6e90\uff0c\u800c\u4e0d\u9700\u8981\u5206\u4eab\u7528\u6237\u7684\u51ed\u636e\u3002\u5728 Spring Boot \u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 Spring Security OAuth \u6765\u5b9e\u73b0 OAuth 2.0 \u534f\u8bae\uff0c\u4ece\u800c\u5b9e\u73b0\u5355\u70b9\u767b\u5f55\uff08Single Sign-On\uff0cSSO\uff09\u7b49\u573a\u666f\u3002Spring Security OAuth \u63d0\u4f9b\u4e86\u5bf9 OAuth 2.0 \u7684\u652f\u6301\uff0c\u5305\u62ec\u6388\u6743\u670d\u52a1\u5668\u548c\u8d44\u6e90\u670d\u52a1\u5668\u7684\u5b9e\u73b0\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>CAS\uff1a<\/strong><\/p>\n<ul>\n<li>CAS \u662f\u4e00\u4e2a\u5355\u70b9\u767b\u5f55\u534f\u8bae\u548c\u4e2d\u5fc3\u5316\u7684\u8ba4\u8bc1\u7cfb\u7edf\u3002\u5b83\u901a\u8fc7\u5728\u4e00\u4e2a\u670d\u52a1\u4e2d\u8fdb\u884c\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\uff0c\u5e76\u5728\u5176\u4ed6\u670d\u52a1\u4e2d\u5171\u4eab\u8fd9\u4e2a\u8eab\u4efd\u9a8c\u8bc1\u4fe1\u606f\uff0c\u5b9e\u73b0\u4e86\u5355\u70b9\u767b\u5f55\u3002\u5728 Spring Boot \u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 Apereo CAS Server \u6765\u642d\u5efa CAS \u670d\u52a1\u5668\uff0c\u540c\u65f6\u4f7f\u7528 Spring Security CAS \u6a21\u5757\u6765\u96c6\u6210 CAS \u5230\u5e94\u7528\u7a0b\u5e8f\u4e2d\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><strong>\u5173\u7cfb\uff1a<\/strong><\/p>\n<ul>\n<li>\n\u8fd9\u4e09\u8005\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u53ef\u4ee5\u7ed3\u5408\u4f7f\u7528\uff0c\u5f62\u6210\u4e00\u4e2a\u7efc\u5408\u7684\u5b89\u5168\u4f53\u7cfb\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 Shiro \u6765\u5904\u7406\u5e94\u7528\u7a0b\u5e8f\u5185\u90e8\u7684\u8eab\u4efd\u9a8c\u8bc1\u548c\u6388\u6743\uff0c\u540c\u65f6\u4f7f\u7528 OAuth \u6216 CAS \u6765\u5b9e\u73b0\u5355\u70b9\u767b\u5f55\u548c\u8de8\u5e94\u7528\u7684\u8eab\u4efd\u9a8c\u8bc1\u3002OAuth \u901a\u5e38\u7528\u4e8e\u4e0e\u5916\u90e8\u670d\u52a1\u7684\u96c6\u6210\uff0c\u800c CAS \u5219\u66f4\u4e13\u6ce8\u4e8e\u5355\u70b9\u767b\u5f55\u548c\u4e2d\u5fc3\u5316\u7684\u8ba4\u8bc1\u7cfb\u7edf\u3002\n<\/li>\n<li>\n\u5728\u4e00\u4e9b\u590d\u6742\u7684\u573a\u666f\u4e2d\uff0c\u4f60\u53ef\u80fd\u4f1a\u770b\u5230\u540c\u65f6\u4f7f\u7528 Shiro\u3001OAuth \u548c CAS \u7684\u60c5\u51b5\uff0c\u4ee5\u6ee1\u8db3\u4e0d\u540c\u5e94\u7528\u573a\u666f\u7684\u9700\u6c42\u3002\u8fd9\u79cd\u96c6\u6210\u9700\u8981\u8c28\u614e\u5904\u7406\uff0c\u786e\u4fdd\u5404\u4e2a\u7ec4\u4ef6\u4e4b\u95f4\u7684\u534f\u4f5c\u548c\u914d\u7f6e\u6b63\u786e\u3002\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Spring Boot \u4e2d\u7684 Shiro\u3001OAuth \u548c CAS\uff08Central Authentication [&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-8617","post","type-post","status-publish","format-standard","hentry","category-springboot"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8617","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=8617"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8617\/revisions"}],"predecessor-version":[{"id":16641,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8617\/revisions\/16641"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=8617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=8617"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=8617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}