{"id":1467,"date":"2023-03-24T22:14:13","date_gmt":"2023-03-24T14:14:13","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1467"},"modified":"2023-04-28T20:36:02","modified_gmt":"2023-04-28T12:36:02","slug":"nacos-1-2-0-permission-control-usage","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/24\/nacos-1-2-0-permission-control-usage\/","title":{"rendered":"Nacos 1.2.0 \u6743\u9650\u63a7\u5236\u4f7f\u7528"},"content":{"rendered":"<p>Nacos 1.2.0 \u6743\u9650\u63a7\u5236\u4ecb\u7ecd\u548c\u4f7f\u7528\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/nacos.io\/en-us\/blog\/nacos%201.2.0%20guide.html\">https:\/\/nacos.io\/en-us\/blog\/nacos%201.2.0%20guide.html<\/a><\/p>\n<h2>Server\u7aef\u914d\u7f6e<\/h2>\n<p>Server\u7aef\u6253\u5f00\u6743\u9650\u63a7\u5236\u5f00\u5173\u3002\u4fee\u6539<code>con\/application.properties<\/code>\u5185\u5bb9\uff1a<\/p>\n<p><!-- more --><\/p>\n<pre><code>nacos.core.auth.enabled=true<\/code><\/pre>\n<p>\u8fd9\u4e2a\u5f00\u5173\u91c7\u7528\u4e86\u70ed\u52a0\u8f7d\u6a21\u5f0f\uff0c\u65e0\u9700\u91cd\u542fServer\u5373\u53ef\u751f\u6548\u3002\u56e0\u6b64\u5f53\u6743\u9650\u63a7\u5236\u529f\u80fd\u4f7f\u7528\u6709\u5f02\u5e38\u65f6\uff0c\u53ef\u4ee5\u76f4\u63a5\u56de\u6eda\u5230\u4e0d\u9274\u6743\u7684\u6a21\u5f0f\u3002<\/p>\n<p>\u6ce8\u610f\uff1aNacos 1.2.0\u91cc\u767b\u5f55\u548c\u9274\u6743\u662f\u7ed1\u5b9a\u5173\u7cfb\uff0c\u800c\u7531\u4e8e\u8fd9\u4e2a\u5f00\u5173\u7684\u9ed8\u8ba4\u503c\u4e3afalse\uff0c\u56e0\u6b64\u9ed8\u8ba4\u542f\u52a8\u65f6\uff0c\u662f\u6ca1\u6709\u767b\u5f55\u754c\u9762\u7684\u3002<\/p>\n<h2>\u4f7f\u7528\u6743\u9650\u63a7\u5236<\/h2>\n<p>\u8bbe\u7f6e\u987a\u5e8f\uff1a<\/p>\n<ul>\n<li>\u547d\u540d\u7a7a\u95f4 -&gt; \u65b0\u5efa\u547d\u540d\u7a7a\u95f4<\/li>\n<li>\u6743\u9650\u63a7\u5236 -&gt; \u7528\u6237\u5217\u8868 -&gt; \u521b\u5efa\u7528\u6237<\/li>\n<li>\u6743\u9650\u63a7\u5236 -&gt; \u89d2\u8272\u7ba1\u7406 -&gt; \u7ed1\u5b9a\u89d2\u8272<\/li>\n<li>\u6743\u9650\u63a7\u5236 -&gt; \u6743\u9650\u7ba1\u7406 -&gt; \u6dfb\u52a0\u6743\u9650<\/li>\n<\/ul>\n<h2>Client\u7aef\u914d\u7f6e<\/h2>\n<h3>bootstap.yml\u914d\u7f6e\u6587\u4ef6<\/h3>\n<pre><code class=\"language-yml\">spring:\n  application:\n    name: union-pay-gateway\n  profiles: prod\n  cloud:\n    nacos:\n      #discovery:\n        #username: xxx\n        #password: xxx\n        #server-addr: https:\/\/nacos.yezhou.me\n      config:\n        server-addr: https:\/\/nacos.yezhou.me\n        context-path: \/nacos\n        file-extension: yaml\n        group: TAOZIPAY\n        namespace: production\n        timeout: 6000\n        username: xxx\n        password: xxx\n        extension-configs:\n          - data-id: common.yaml\n            group: DEFAULT_GROUP\n            refresh: true\n\nserver:\n  port: 8805<\/code><\/pre>\n<p>\u5176\u4e2dcontext-path\u5fc5\u987b\u6539\u6210 \/nacos\uff0c\u901a\u8fc7\u6e90\u7801\u8ffd\u8e2a\u53ef\u4ee5\u53d1\u73b0\uff0c\u5982\u679c\u4e0d\u6539\uff0c\u8fde\u63a5\u7684\u65f6\u5019\u4f1a\u767b\u9646\u4e0d\u4e0a\uff0c\u62a5\u9519403\u3002<\/p>\n<h3>\u52a0\u5165\u4e24\u4e2a\u65b0\u7684\u4f9d\u8d56<\/h3>\n<p>\u8fd9\u4e24\u4e2a\u4f9d\u8d56\u5728\u6700\u65b0\u7684<code>Alibaba Cloud<\/code>\u4e2d\u6ca1\u6709\uff0c\u9700\u8981\u624b\u52a8\u52a0\u5165\uff0c\u624d\u80fd\u4f7f\u7528\u6743\u9650\u529f\u80fd<\/p>\n<pre><code class=\"language-xml\">&lt;!-- https:\/\/mvnrepository.com\/artifact\/com.alibaba.nacos\/nacos-api --&gt;\n&lt;dependency&gt;\n    &lt;groupId&gt;com.alibaba.nacos&lt;\/groupId&gt;\n    &lt;artifactId&gt;nacos-api&lt;\/artifactId&gt;\n    &lt;version&gt;1.2.1&lt;\/version&gt;\n&lt;\/dependency&gt;\n&lt;!-- https:\/\/mvnrepository.com\/artifact\/com.alibaba.nacos\/nacos-client --&gt;\n&lt;dependency&gt;\n    &lt;groupId&gt;com.alibaba.nacos&lt;\/groupId&gt;\n    &lt;artifactId&gt;nacos-client&lt;\/artifactId&gt;\n    &lt;version&gt;1.2.1&lt;\/version&gt;\n&lt;\/dependency&gt;<\/code><\/pre>\n<h3>\u5728\u8bbf\u95eenacos\u524d\u52a0\u5165\u4e00\u5c42nginx<\/h3>\n<pre><code>location \/nacos\/ {\n  proxy_pass http:\/\/nacosserver\/nacos\/;\n  rewrite (.*)\/\/(.*) $1$2 permanent;\n}\nlocation \/n\/ {\n  proxy_pass http:\/\/nacosserver\/;\n  rewrite (.*)\/\/(.*) $1$2 permanent;\n}<\/code><\/pre>\n<p>\u8fd9\u6837\u505a\u7684\u76ee\u7684\u662f\u4e3a\u4e86\u91cd\u5199<code>\/\/<\/code>\u4e3a<code>\/<\/code>\uff0c\u4fdd\u8bc1security\u7684url\u6821\u9a8c\u80fd\u591f\u6210\u529f<br \/>\n\u5176\u4e2d nacosserver\u662fnacos\u7684\u8bbf\u95eeurl\uff0c\u8fd9\u91cc\u914d\u7f6e\u4e86\u4e24\u4e2a\uff0c\u7b2c\u4e00\u4e2a\u662f\u8bbf\u95eenacos\u7684\u7ba1\u7406\u754c\u9762\uff0c\u7b2c\u4e8c\u4e2a\u662fclient\u6ce8\u518cnacos\u7684url<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nacos 1.2.0 \u6743\u9650\u63a7\u5236\u4ecb\u7ecd\u548c\u4f7f\u7528\uff1ahttps:\/\/nacos.io\/en-us\/blog\/nacos [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-1467","post","type-post","status-publish","format-standard","hentry","category-nacos"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1467"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1467\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}