123libohan opened a new issue #5850:
URL: https://github.com/apache/apisix/issues/5850


   ### Issue description
   
   We want to use key-auth to control consumer access to different routes and 
prevent unauthorized consumers from accessing the route.
   That's the way we do it right now:
   1)POST:http://xxxx:9080/apisix/admin/consumers/
   `{
       "username": "consumer_A",
       "plugins": {
           "key-auth": {
               "key": "consumer_A"
           }
       }
   }`
   2)POST:http://xxx:9080/apisix/admin/routes/
   {
       "uri": "/nacos-remote/call",
       "plugins": {
           "key-auth": {
               "query": "ak",
               "header": "apikey"
           },
        "consumer-restriction": {
               "whitelist": [
                   "consumer_A","consumer_B"
               ]
           },
           "limit-count-by-client": {
           }
       },
       "service_id": "00000000000000032029"
   }
   This method is very inconvenient when adding or deleting a consumer, because 
every time the route adds or deletes a consumer, it needs to check all 
whitelist names under the consumer, and then set the whitelist again, which is 
prone to error.
   Is there a better way to do this?
   
   In addition, when you want to give a consumer access to all routes under the 
service, you need to traverse all routes under the service and then set them 
one by one through the above method. Is there a better way?
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl 
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: 
depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks 
--version`):
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to