{"id":7171,"date":"2026-08-14T15:15:25","date_gmt":"2026-08-14T07:15:25","guid":{"rendered":"https:\/\/t.n-years.com\/?p=7171"},"modified":"2026-08-14T15:17:00","modified_gmt":"2026-08-14T07:17:00","slug":"%e5%90%8e%e7%ab%af%e5%bc%80%e5%8f%91%e5%b8%b8%e8%a7%81-%e6%9d%83%e9%99%90%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/t.n-years.com\/?p=7171","title":{"rendered":"\u540e\u7aef\u5f00\u53d1\u5e38\u89c1 \u6743\u9650\u6a21\u578b"},"content":{"rendered":"<p>\u540e\u7aef\u6743\u9650\u6a21\u578b\u901a\u5e38\u5206\u4e3a\u4e0b\u9762\u51e0\u7c7b\uff0c\u5b9e\u9645\u7cfb\u7edf\u5f80\u5f80\u662f\u7ec4\u5408\u4f7f\u7528\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u6a21\u578b<\/th>\n<th>\u6838\u5fc3\u5224\u65ad<\/th>\n<th>\u9002\u7528\u573a\u666f<\/th>\n<th>\u793a\u4f8b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><strong>RBAC<\/strong>\uff08\u89d2\u8272\u6743\u9650\uff09<\/td>\n<td>\u7528\u6237\u662f\u5426\u62e5\u6709\u67d0\u89d2\u8272\uff0c\u89d2\u8272\u662f\u5426\u62e5\u6709\u6743\u9650<\/td>\n<td>\u7ba1\u7406\u540e\u53f0\u3001\u4f01\u4e1a\u7cfb\u7edf<\/td>\n<td>\u7ba1\u7406\u5458\u53ef\u5220\u7528\u6237\uff1b\u5f00\u53d1\u8005\u53ef\u53d1\u5e03\u5e94\u7528<\/td>\n<\/tr>\n<tr>\n<td><strong>ACL<\/strong>\uff08\u8bbf\u95ee\u63a7\u5236\u5217\u8868\uff09<\/td>\n<td>\u67d0\u4e2a\u8d44\u6e90\u5141\u8bb8\u54ea\u4e9b\u5177\u4f53\u7528\u6237\/\u4e3b\u4f53\u8bbf\u95ee<\/td>\n<td>\u6587\u4ef6\u3001\u6587\u6863\u3001\u9879\u76ee\u7b49\u8d44\u6e90\u7ea7\u6388\u6743<\/td>\n<td>\u6587\u6863 A \u5141\u8bb8\u5f20\u4e09\u8bfb\u5199\u3001\u674e\u56db\u53ea\u8bfb<\/td>\n<\/tr>\n<tr>\n<td><strong>ABAC<\/strong>\uff08\u5c5e\u6027\u6743\u9650\uff09<\/td>\n<td>\u6839\u636e\u7528\u6237\u3001\u8d44\u6e90\u3001\u73af\u5883\u5c5e\u6027\u52a8\u6001\u51b3\u7b56<\/td>\n<td>\u591a\u79df\u6237\u3001\u590d\u6742\u6570\u636e\u6743\u9650<\/td>\n<td>\u4ec5\u5141\u8bb8\u201c\u6240\u5c5e\u90e8\u95e8=\u5f53\u524d\u7528\u6237\u90e8\u95e8\u201d\u7684\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td><strong>PBAC<\/strong>\uff08\u7b56\u7565\u6743\u9650\uff09<\/td>\n<td>\u4f7f\u7528\u53ef\u914d\u7f6e\u7b56\u7565\u5f15\u64ce\u5224\u5b9a<\/td>\n<td>\u89c4\u5219\u590d\u6742\u3001\u9700\u8fd0\u8425\u914d\u7f6e<\/td>\n<td>\u5de5\u4f5c\u65e5\u3001\u5185\u7f51\u4e14\u98ce\u9669\u7b49\u7ea7\u4f4e\u65f6\u5141\u8bb8\u5bfc\u51fa<\/td>\n<\/tr>\n<tr>\n<td><strong>ReBAC<\/strong>\uff08\u5173\u7cfb\u6743\u9650\uff09<\/td>\n<td>\u6839\u636e\u4e3b\u4f53\u548c\u8d44\u6e90\u4e4b\u95f4\u7684\u5173\u7cfb\u5224\u65ad<\/td>\n<td>\u534f\u4f5c\u5e73\u53f0\u3001\u793e\u4ea4\u3001\u77e5\u8bc6\u5e93<\/td>\n<td>\u9879\u76ee\u6210\u5458\u3001\u6587\u6863\u534f\u4f5c\u8005\u53ef\u8bbf\u95ee<\/td>\n<\/tr>\n<tr>\n<td><strong>MAC<\/strong>\uff08\u5f3a\u5236\u8bbf\u95ee\u63a7\u5236\uff09<\/td>\n<td>\u6309\u5b89\u5168\u7b49\u7ea7\u4e0e\u5bc6\u7ea7\u5f3a\u5236\u63a7\u5236<\/td>\n<td>\u653f\u52a1\u3001\u519b\u5de5\u3001\u9ad8\u5b89\u5168\u7cfb\u7edf<\/td>\n<td>\u673a\u5bc6\u7ea7\u7528\u6237\u4e0d\u80fd\u8bfb\u7edd\u5bc6\u6587\u6863<\/td>\n<\/tr>\n<tr>\n<td><strong>DAC<\/strong>\uff08\u81ea\u4e3b\u8bbf\u95ee\u63a7\u5236\uff09<\/td>\n<td>\u8d44\u6e90\u62e5\u6709\u8005\u81ea\u884c\u6388\u4e88\/\u56de\u6536\u6743\u9650<\/td>\n<td>\u6587\u4ef6\u7cfb\u7edf\u3001\u4e2a\u4eba\u8d44\u6e90<\/td>\n<td>\u6587\u4ef6\u521b\u5efa\u8005\u5206\u4eab\u7ed9\u6307\u5b9a\u540c\u4e8b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u6700\u5e38\u89c1\uff1aRBAC<\/strong><\/p>\n<pre><code class=\"language-text\">\u7528\u6237 \u2192 \u7528\u6237\u89d2\u8272\u5173\u7cfb \u2192 \u89d2\u8272 \u2192 \u89d2\u8272\u6743\u9650\u5173\u7cfb \u2192 \u6743\u9650<\/code><\/pre>\n<pre><code class=\"language-text\">\u7528\u6237\uff1azhangsan\n\u89d2\u8272\uff1a\u5e94\u7528\u7ba1\u7406\u5458\n\u6743\u9650\uff1aapp:create\u3001app:publish\u3001app:delete<\/code><\/pre>\n<p>\u4f18\u70b9\u662f\u6613\u7406\u89e3\u3001\u6613\u7ba1\u7406\uff1b\u7f3a\u70b9\u662f\u8d44\u6e90\u8303\u56f4\u590d\u6742\u65f6\uff0c\u89d2\u8272\u4f1a\u81a8\u80c0\u3002\u4f60\u5f53\u524d\u5de5\u7a0b\u57fa\u672c\u662f\u8fd9\u4e2a\u6a21\u5f0f\uff0c\u5e76\u901a\u8fc7 <code>moduleKey + moduleType<\/code> \u7ed9\u89d2\u8272\u589e\u52a0\u8d44\u6e90\u4f5c\u7528\u57df\u3002<\/p>\n<p><strong>RBAC \u7684\u5e38\u89c1\u6269\u5c55<\/strong><\/p>\n<ul>\n<li><strong>RBAC0<\/strong>\uff1a\u7528\u6237\u3001\u89d2\u8272\u3001\u6743\u9650\u4e09\u8005\u57fa\u7840\u5173\u7cfb\u3002<\/li>\n<li><strong>RBAC1<\/strong>\uff1a\u652f\u6301\u89d2\u8272\u7ee7\u627f\uff0c\u4f8b\u5982\u201c\u8d85\u7ea7\u7ba1\u7406\u5458\u201d\u7ee7\u627f\u201c\u7ba1\u7406\u5458\u201d\u3002<\/li>\n<li><strong>RBAC2<\/strong>\uff1a\u652f\u6301\u7ea6\u675f\uff0c\u4f8b\u5982\u804c\u8d23\u5206\u79bb\u3001\u4e92\u65a5\u89d2\u8272\u3001\u89d2\u8272\u4eba\u6570\u4e0a\u9650\u3002<\/li>\n<li><strong>RBAC3<\/strong>\uff1aRBAC1 + RBAC2\u3002<\/li>\n<\/ul>\n<p><strong>ACL\uff1a\u8d44\u6e90\u76f4\u63a5\u6388\u6743<\/strong><\/p>\n<pre><code class=\"language-text\">project:1001\n  zhangsan: READ, WRITE\n  lisi: READ<\/code><\/pre>\n<p>\u9002\u5408\u6bcf\u4efd\u8d44\u6e90\u7684\u6388\u6743\u90fd\u4e0d\u540c\u7684\u573a\u666f\u3002\u7f3a\u70b9\u662f\u6570\u636e\u91cf\u4e0e\u7ba1\u7406\u590d\u6742\u5ea6\u4f1a\u968f\u8d44\u6e90\u6570\u91cf\u5feb\u901f\u589e\u957f\u3002<\/p>\n<p><strong>ABAC\uff1a\u5c5e\u6027\u9a71\u52a8<\/strong><\/p>\n<pre><code class=\"language-text\">allow if:\n  user.tenantId == resource.tenantId\n  &amp;&amp; user.departmentId == resource.departmentId\n  &amp;&amp; request.time within workHours<\/code><\/pre>\n<p>\u5c5e\u6027\u53ef\u6765\u81ea\uff1a<\/p>\n<ul>\n<li>\u4e3b\u4f53\uff1a\u7528\u6237\u3001\u89d2\u8272\u3001\u90e8\u95e8\u3001\u5c97\u4f4d\u3001\u79df\u6237\uff1b<\/li>\n<li>\u8d44\u6e90\uff1a\u6240\u5c5e\u7ec4\u7ec7\u3001\u521b\u5efa\u4eba\u3001\u5bc6\u7ea7\u3001\u72b6\u6001\uff1b<\/li>\n<li>\u73af\u5883\uff1aIP\u3001\u65f6\u95f4\u3001\u8bbe\u5907\u3001\u5730\u57df\u3001\u98ce\u9669\u7b49\u7ea7\uff1b<\/li>\n<li>\u64cd\u4f5c\uff1a\u67e5\u770b\u3001\u7f16\u8f91\u3001\u5bfc\u51fa\u3001\u5220\u9664\u3002<\/li>\n<\/ul>\n<p>\u5b83\u6bd4 RBAC \u7075\u6d3b\uff0c\u4f46\u89c4\u5219\u8c03\u8bd5\u3001\u5ba1\u8ba1\u4e0e\u53ef\u89e3\u91ca\u6027\u66f4\u96be\u3002<\/p>\n<p><strong>ReBAC\uff1a\u5173\u7cfb\u9a71\u52a8<\/strong><\/p>\n<pre><code class=\"language-text\">viewer(document) = owner\n                or editor\n                or member_of(document.project)<\/code><\/pre>\n<p>\u9002\u5408\u201c\u9879\u76ee\u6210\u5458\u53ef\u770b\u9879\u76ee\u8d44\u6599\u201d\u201c\u4e0a\u7ea7\u53ef\u67e5\u770b\u4e0b\u5c5e\u6570\u636e\u201d\u201c\u597d\u53cb\u53ef\u67e5\u770b\u52a8\u6001\u201d\u7b49\u5173\u7cfb\u7f51\u5bc6\u96c6\u7684\u4ea7\u54c1\u3002\u5e38\u89c1\u5b9e\u73b0\u601d\u8def\u53c2\u8003 Google Zanzibar \u7c7b\u6a21\u578b\u3002<\/p>\n<p><strong>\u5de5\u7a0b\u4e0a\u5e38\u7528\u7684\u7ec4\u5408<\/strong><\/p>\n<pre><code class=\"language-text\">\u8ba4\u8bc1\uff08SSO \/ JWT \/ Session\uff09\n  \u2192 \u529f\u80fd\u6743\u9650\uff1aRBAC\n  \u2192 \u6570\u636e\u8303\u56f4\uff1aRBAC Scope \/ ABAC\n  \u2192 \u5355\u8d44\u6e90\u5171\u4eab\uff1aACL \u6216 ReBAC\n  \u2192 \u9ad8\u98ce\u9669\u52a8\u4f5c\uff1aPBAC\uff08\u9644\u52a0\u65f6\u95f4\u3001IP\u3001\u5ba1\u6279\u7b49\u7b56\u7565\uff09<\/code><\/pre>\n<p>\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u201c\u80fd\u5426\u8fdb\u5165\u5e94\u7528\u7ba1\u7406\u9875\u201d\uff1aRBAC\u3002<\/li>\n<li>\u201c\u80fd\u770b\u54ea\u4e9b\u5e94\u7528\u201d\uff1a\u6309\u79df\u6237\u3001\u9879\u76ee\u3001\u90e8\u95e8\u505a ABAC \u6216\u5e26\u8d44\u6e90\u8303\u56f4\u7684 RBAC\u3002<\/li>\n<li>\u201c\u80fd\u5426\u67e5\u770b\u67d0\u4e2a\u88ab\u5206\u4eab\u7684\u6587\u6863\u201d\uff1aACL\/ReBAC\u3002<\/li>\n<li>\u201c\u80fd\u5426\u5bfc\u51fa\u5168\u91cf\u6570\u636e\u201d\uff1aRBAC \u57fa\u7840\u6743\u9650 + PBAC \u98ce\u9669\u7b56\u7565\u3002<\/li>\n<\/ul>\n<p>\u5b9e\u8df5\u4e2d\uff0c\u4e0d\u5efa\u8bae\u4e00\u5f00\u59cb\u5c31\u4e0a\u7eaf ABAC \u6216\u590d\u6742\u7b56\u7565\u5f15\u64ce\u3002\u591a\u6570\u4f01\u4e1a\u540e\u53f0\u5148\u91c7\u7528 <strong>RBAC + \u8d44\u6e90\u4f5c\u7528\u57df<\/strong>\uff0c\u5f53\u51fa\u73b0\u6587\u6863\u5206\u4eab\u3001\u8de8\u7ec4\u7ec7\u534f\u4f5c\u3001\u7ec6\u7c92\u5ea6\u8d44\u6e90\u6388\u6743\u65f6\uff0c\u518d\u8865\u5145 ACL \u6216 ReBAC\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u540e\u7aef\u6743\u9650\u6a21\u578b\u901a\u5e38\u5206\u4e3a\u4e0b\u9762\u51e0\u7c7b\uff0c\u5b9e\u9645\u7cfb\u7edf\u5f80\u5f80\u662f\u7ec4\u5408\u4f7f\u7528\u3002 \u6a21\u578b \u6838\u5fc3\u5224\u65ad \u9002\u7528\u573a\u666f \u793a\u4f8b RBAC\uff08\u89d2\u8272\u6743\u9650\uff09 &#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/t.n-years.com\/?p=7171\">\u9605\u8bfb\u66f4\u591a<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[123],"tags":[],"class_list":["post-7171","post","type-post","status-publish","format-standard","hentry","category-123"],"_links":{"self":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/7171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7171"}],"version-history":[{"count":2,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/7171\/revisions"}],"predecessor-version":[{"id":7173,"href":"https:\/\/t.n-years.com\/index.php?rest_route=\/wp\/v2\/posts\/7171\/revisions\/7173"}],"wp:attachment":[{"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/t.n-years.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}