{"id":208117,"date":"2020-11-27T04:36:19","date_gmt":"2020-11-26T20:36:19","guid":{"rendered":"http:\/\/4563.org\/?p=208117"},"modified":"2020-11-27T04:36:19","modified_gmt":"2020-11-26T20:36:19","slug":"spring-cloud-gateway-%e5%92%8c-spring-cloud-oauth2-%e6%8f%90%e7%a4%ba-filter-%e9%94%99%e8%af%af","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=208117","title":{"rendered":"Spring Cloud Gateway \u548c Spring Cloud Oauth2 \u63d0\u793a Filter \u9519\u8bef"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Spring Cloud Gateway \u548c Spring Cloud Oauth2 \u63d0\u793a Filter \u9519\u8bef               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : PeiXyJ <\/span>  <span><i><\/i> 7<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6211\u60f3\u4f7f\u7528 Spring cloud gateway \u6574\u5408 Oauth2,\u4f46\u662f\u53d1\u73b0\u542f\u52a8\u7684\u65f6\u5019\u63d0\u793a<\/p>\n<pre><code>java: \u65e0\u6cd5\u8bbf\u95ee javax.servlet.Filter \u627e\u4e0d\u5230 javax.servlet.Filter \u7684\u7c7b\u6587\u4ef6 <\/code><\/pre>\n<p>\u7136\u540e\u6211 Maven \u6dfb\u52a0\u4e86 <code>javax.servlet.Filter<\/code>\u4f46\u662f\u53d1\u73b0 gateway \u4f7f\u7528\u7684<code>spring-boot-starter-webflux<\/code>\u4f1a\u548c\u8fd9\u4e2a<code>Filter<\/code>\u51b2\u7a81.<\/p>\n<p>\u5404\u4f4d\u5927\u4f6c\u662f\u600e\u4e48\u5904\u7406\u6574\u5408\u8fd9\u4e24\u4e2a\u7ec4\u4ef6\u7684\uff1f<\/p>\n<pre><code>&lt;dependency&gt;     &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;     &lt;artifactId&gt;spring-cloud-starter-oauth2&lt;\/artifactId&gt; &lt;\/dependency&gt; &lt;dependency&gt;     &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;     &lt;artifactId&gt;spring-cloud-starter-gateway&lt;\/artifactId&gt; &lt;\/dependency&gt; <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4211486\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : buliugu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53c2\u8003 https:\/\/stackoverflow.com\/questions\/43187330\/spring-cloud-starter-oauth2-and-spring-boot-starter-webflux-no-server-on-start\uff0c\u4e0d\u80fd\u5171\u7528\uff0c\u4e00\u5b9a\u8981\u5728 gateway \u4f7f\u7528\u5f97\u81ea\u5df1\u5b9e\u73b0 Oauth2\uff0c\u53cd\u6b63 Spring Security \u4e0d\u63d0\u4f9b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4211487\" 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>                                                             \u8fd9\u4e24\u4e2a\u4e1c\u897f\u6574\u5408\u4e0d\u5230\u4e00\u5757\u53bb\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4211488\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tommyzhang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             gateway \u4e0d\u662f\u57fa\u4e8e servlet \u7684 \u4f30\u8ba1\u9700\u8981\u4f60\u81ea\u5df1\u96c6\u6210\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4211489\" 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>                                                             \u6574\u4e0d\u5230\u4e00\u5757\uff0c\u7528 servlet \u53ef\u4ee5\u7528 zuul                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Spring Cloud Gate&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\/208117"}],"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=208117"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/208117\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=208117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=208117"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=208117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}