You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/25 06:27:20 UTC

[GitHub] [apisix] liangliang4ward opened a new pull request #6195: fix consumer-restriction plugin doc

liangliang4ward opened a new pull request #6195:
URL: https://github.com/apache/apisix/pull/6195


   ### What this PR does / why we need it:
   consumer-restiction has allowed_by_methods,but doc need to improment.
   ### Pre-submission checklist:
   
   <!--
   Please follow the PR manners:
   1. Use Draft if the PR is not ready to be reviewed
   2. Test is required for the feat/fix PR, unless you have a good reason
   3. Doc is required for the feat PR
   4. Use a new commit to resolve review instead of `push -f`
   5. If you need to resolve merge conflicts after the PR is reviewed, please merge master but do not rebase
   6. Use "request review" to notify the reviewer once you have resolved the review
   7. Only reviewer can click "Resolve conversation" to mark the reviewer's review resolved
   -->
   
   * [ ] Did you explain what problem does this PR solve? Or what new features have been added?
   * [ ] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander merged pull request #6195: docs: fix consumer-restriction plugin

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #6195:
URL: https://github.com/apache/apisix/pull/6195


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander merged pull request #6195: docs: fix consumer-restriction plugin

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #6195:
URL: https://github.com/apache/apisix/pull/6195


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] zaunist commented on a change in pull request #6195: fix consumer-restriction plugin doc

Posted by GitBox <gi...@apache.org>.
zaunist commented on a change in pull request #6195:
URL: https://github.com/apache/apisix/pull/6195#discussion_r791529363



##########
File path: docs/zh/latest/plugins/consumer-restriction.md
##########
@@ -117,6 +119,74 @@ HTTP/1.1 403 Forbidden
 {"message":"The consumer_name is forbidden."}
 ```
 
+### 如何限制 `allowed_by_methods`
+
+下面是一个示例,在指定的route上开启了`consumer-restriction`插件,限制`jack1`只能使用`POST`进行访问:

Review comment:
       ```suggestion
   下面是一个示例,在指定的 route 上开启了`consumer-restriction`插件,限制`jack1`只能使用`POST`进行访问:
   ```
   We should add a space between Chinese and English. You can ref https://github.com/sparanoid/chinese-copywriting-guidelines

##########
File path: docs/zh/latest/plugins/consumer-restriction.md
##########
@@ -117,6 +119,74 @@ HTTP/1.1 403 Forbidden
 {"message":"The consumer_name is forbidden."}
 ```
 
+### 如何限制 `allowed_by_methods`
+
+下面是一个示例,在指定的route上开启了`consumer-restriction`插件,限制`jack1`只能使用`POST`进行访问:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "basic-auth": {},
+        "consumer-restriction": {
+            "allowed_by_methods":[{
+                "user": "jack1",
+                "methods": ["POST"]
+            }]
+        }
+    }
+}'
+```
+
+**测试插件**
+
+jack1访问:
+
+```shell
+curl -u jack2019:123456 http://127.0.0.1:9080/index.html
+HTTP/1.1 403 Forbidden
+...
+{"message":"The consumer_name is forbidden."}
+```
+
+增加`jack1` `GET`访问能力:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "basic-auth": {},
+        "consumer-restriction": {
+            "allowed_by_methods":[{
+                "user": "jack1",
+                "methods": ["POST","GET"]
+            }]
+        }
+    }
+}'
+```
+
+jack1访问:

Review comment:
       ditto




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] liangliang4ward commented on a change in pull request #6195: fix consumer-restriction plugin doc

Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on a change in pull request #6195:
URL: https://github.com/apache/apisix/pull/6195#discussion_r791571543



##########
File path: docs/zh/latest/plugins/consumer-restriction.md
##########
@@ -117,6 +119,74 @@ HTTP/1.1 403 Forbidden
 {"message":"The consumer_name is forbidden."}
 ```
 
+### 如何限制 `allowed_by_methods`
+
+下面是一个示例,在指定的route上开启了`consumer-restriction`插件,限制`jack1`只能使用`POST`进行访问:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "basic-auth": {},
+        "consumer-restriction": {
+            "allowed_by_methods":[{
+                "user": "jack1",
+                "methods": ["POST"]
+            }]
+        }
+    }
+}'
+```
+
+**测试插件**
+
+jack1访问:
+
+```shell
+curl -u jack2019:123456 http://127.0.0.1:9080/index.html
+HTTP/1.1 403 Forbidden
+...
+{"message":"The consumer_name is forbidden."}
+```
+
+增加`jack1` `GET`访问能力:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "basic-auth": {},
+        "consumer-restriction": {
+            "allowed_by_methods":[{
+                "user": "jack1",
+                "methods": ["POST","GET"]
+            }]
+        }
+    }
+}'
+```
+
+jack1访问:

Review comment:
       ok




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] zaunist commented on a change in pull request #6195: fix consumer-restriction plugin doc

Posted by GitBox <gi...@apache.org>.
zaunist commented on a change in pull request #6195:
URL: https://github.com/apache/apisix/pull/6195#discussion_r791529363



##########
File path: docs/zh/latest/plugins/consumer-restriction.md
##########
@@ -117,6 +119,74 @@ HTTP/1.1 403 Forbidden
 {"message":"The consumer_name is forbidden."}
 ```
 
+### 如何限制 `allowed_by_methods`
+
+下面是一个示例,在指定的route上开启了`consumer-restriction`插件,限制`jack1`只能使用`POST`进行访问:

Review comment:
       ```suggestion
   下面是一个示例,在指定的 route 上开启了`consumer-restriction`插件,限制`jack1`只能使用`POST`进行访问:
   ```
   We should add a space between Chinese and English. You can ref https://github.com/sparanoid/chinese-copywriting-guidelines

##########
File path: docs/zh/latest/plugins/consumer-restriction.md
##########
@@ -117,6 +119,74 @@ HTTP/1.1 403 Forbidden
 {"message":"The consumer_name is forbidden."}
 ```
 
+### 如何限制 `allowed_by_methods`
+
+下面是一个示例,在指定的route上开启了`consumer-restriction`插件,限制`jack1`只能使用`POST`进行访问:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "basic-auth": {},
+        "consumer-restriction": {
+            "allowed_by_methods":[{
+                "user": "jack1",
+                "methods": ["POST"]
+            }]
+        }
+    }
+}'
+```
+
+**测试插件**
+
+jack1访问:
+
+```shell
+curl -u jack2019:123456 http://127.0.0.1:9080/index.html
+HTTP/1.1 403 Forbidden
+...
+{"message":"The consumer_name is forbidden."}
+```
+
+增加`jack1` `GET`访问能力:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "basic-auth": {},
+        "consumer-restriction": {
+            "allowed_by_methods":[{
+                "user": "jack1",
+                "methods": ["POST","GET"]
+            }]
+        }
+    }
+}'
+```
+
+jack1访问:

Review comment:
       ditto




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] liangliang4ward commented on a change in pull request #6195: fix consumer-restriction plugin doc

Posted by GitBox <gi...@apache.org>.
liangliang4ward commented on a change in pull request #6195:
URL: https://github.com/apache/apisix/pull/6195#discussion_r791571543



##########
File path: docs/zh/latest/plugins/consumer-restriction.md
##########
@@ -117,6 +119,74 @@ HTTP/1.1 403 Forbidden
 {"message":"The consumer_name is forbidden."}
 ```
 
+### 如何限制 `allowed_by_methods`
+
+下面是一个示例,在指定的route上开启了`consumer-restriction`插件,限制`jack1`只能使用`POST`进行访问:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "basic-auth": {},
+        "consumer-restriction": {
+            "allowed_by_methods":[{
+                "user": "jack1",
+                "methods": ["POST"]
+            }]
+        }
+    }
+}'
+```
+
+**测试插件**
+
+jack1访问:
+
+```shell
+curl -u jack2019:123456 http://127.0.0.1:9080/index.html
+HTTP/1.1 403 Forbidden
+...
+{"message":"The consumer_name is forbidden."}
+```
+
+增加`jack1` `GET`访问能力:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    },
+    "plugins": {
+        "basic-auth": {},
+        "consumer-restriction": {
+            "allowed_by_methods":[{
+                "user": "jack1",
+                "methods": ["POST","GET"]
+            }]
+        }
+    }
+}'
+```
+
+jack1访问:

Review comment:
       ok




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org