spacewander commented on a change in pull request #2859:
URL: https://github.com/apache/apisix/pull/2859#discussion_r531447581



##########
File path: doc/plugin-develop.md
##########
@@ -168,8 +168,8 @@ local _M = {
 Determine which phase to run, generally access or rewrite. If you don't know 
the [Openresty life 
cycle](https://openresty-reference.readthedocs.io/en/latest/Directives/), it's
 recommended to know it in advance. For example key-auth is an authentication 
plugin, thus the authentication should be completed
 before forwarding the request to any upstream service. Therefore, the plugin 
can be executed in the rewrite and access phases.
-In APISIX, the authentication logic is implemented in the rewrite phase. 
Generally, IP access and interface
-permission are completed in the access phase.
+In APISIX, the authentication logic is implemented in the access phase. 
Generally, IP access and interface

Review comment:
       The reason why we need to run authentication plugins in the rewrite 
phases:
   
https://github.com/apache/apisix/blob/f4161d39a495879edffbc75e2099f6e487bae81d/apisix/init.lua#L508-L520
   And:
   
https://github.com/apache/apisix/blob/f4161d39a495879edffbc75e2099f6e487bae81d/apisix/admin/consumers.lua#L50
   
   Plugins has `type = 'auth'` should run in rewrite phase and set up the 
consumer for current api_ctx.




----------------------------------------------------------------
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.

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


Reply via email to