{"id":96479,"date":"2020-04-18T19:55:27","date_gmt":"2020-04-18T11:55:27","guid":{"rendered":"http:\/\/4563.org\/?p=96479"},"modified":"2020-04-18T19:55:27","modified_gmt":"2020-04-18T11:55:27","slug":"springsecurityoauth-%e8%ae%bf%e9%97%ae-oauth-authorize-%e4%bc%9a%e8%a2%ab%e6%8b%a6%e6%88%aa","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=96479","title":{"rendered":"SpringSecurityOAuth \u8bbf\u95ee oauth\/authorize \u4f1a\u88ab\u62e6\u622a"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  SpringSecurityOAuth \u8bbf\u95ee oauth\/authorize \u4f1a\u88ab\u62e6\u622a               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : rqxiao <\/span>  <span><i><\/i> 55<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5728\u4ee3\u7801\u4e2d\u6709\u914d\u7f6e&#8221;\/oauth\/*&#8221; \u4e0d\u9700\u8981\u767b\u5f55\u8ba4\u8bc1<\/p>\n<pre><code>            .and()             .authorizeRequests()\/\/\u5bf9\u4e0b\u9762\u8bf7\u6c42             .antMatchers(\"\/authentication\/require\",\"\/oauth\/*\"                     ,securityProperties.getBrowser().getLoginPage()                     ,\"\/code\/*\").permitAll()\/\/\u5bf9\u8fd9\u4e9b\u4e2a\u8bf7\u6c42\u4e0d\u9700\u8981\u8eab\u4efd\u9a8c\u8bc1             .anyRequest()\/\/\u4efb\u4f55\u8bf7\u6c42             .authenticated()\/\/\u90fd\u9700\u8981\u8ba4\u8bc1 \/\u767b\u5f55 <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"872708\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : skypyb <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b9e\u73b0\u5165\u53c2\u662f WebSecurity \u8fd9\u4e2a\u53c2\u6570\u7684\u65b9\u6cd5\uff1aconfigure(WebSecurity web) <br \/>\u7136\u540e\u65b9\u6cd5\u4f53\u5185\u4e66\u5199<br \/>web.ignoring().antMatchers(HttpMethod.POST,&#8221;\/oauth\/*&#8221;);<\/p>\n<p>\u8bd5\u4e00\u4e0b                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"872709\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : rqxiao <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @skypyb \u989d \u67e5\u4e86\u534a\u5929\u8bf4\u8c8c\u4f3c SpringSecurityOAuth \u7684\u6388\u6743\u7801\u6a21\u5f0f \u83b7\u53d6\u6388\u6743\u7801\uff08\/oauth\/authorize \uff09\u8fd9\u4e00\u6b65\u662f\u9700\u8981\u767b\u5f55\uff08\u4f8b\u5982 httpbasic \u65b9\u5f0f\uff09\u7684\uff0c\u5bc6\u7801\u6a21\u5f0f\uff08 password \uff09\u5c31\u662f\u76f4\u63a5\u4f20\u8d26\u5bc6\u83b7\u53d6 token,\u5c31\u53ea\u6709\u4e00\u6b65\u4e86\uff0c\u4e0d\u9700\u8981\u767b\u5f55 <br \/> \u4e5f\u6709\u53ef\u80fd\u6211\u8bf4\u7684\u4e0d\u592a\u5bf9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"872710\" 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>                                                             @rqxiao \u7528 Code Flow \u7684\u65f6\u5019\uff0c \/oauth\/* \u9700\u8981 ClientId\uff0cClientSecret\uff0c\u8fd9\u4e2a\u4e00\u822c\u901a\u8fc7 HttpBasic \u4f20\u9012\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 Form \u53c2\u6570\u65b9\u5f0f\uff08\u4e00\u822c\u53ef\u914d\u7f6e\uff09\u3002<\/p>\n<p>Resource owner Password Flow \u4e0d\u662f\u6240\u6709\u7684 IdP \u90fd\u652f\u6301\uff0c\u4e00\u822c Authorization Code Flow \u6700\u5e38\u89c1\u3002Client Credentials \u8bbe\u8ba1\u7528 Client \u64cd\u4f5c\u3002Implicit \u662f\u7b80\u5316\u7684 Code, \u5f88\u591a IDP \u8ba4\u4e3a\u6709\u5b89\u5168\u95ee\u9898\uff0c\u4e0d\u652f\u6301\u3002<\/p>\n<p>https:\/\/oauth.net\/2\/                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>SpringSecurityOAu&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\/96479"}],"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=96479"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/96479\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=96479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=96479"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=96479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}