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 2020/11/30 21:42:16 UTC

[GitHub] [apisix] jenskeiner opened a new pull request #2905: fix: Basic auth plugin should run in rewrite phase.

jenskeiner opened a new pull request #2905:
URL: https://github.com/apache/apisix/pull/2905


   ### What this PR does / why we need it:
   The `basic-auth` plugin, as an authentication plugin, should run in the rewrite phase, not the access phase.
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] 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.

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



[GitHub] [apisix] spacewander commented on a change in pull request #2905: fix: Basic auth plugin should run in rewrite phase.

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



##########
File path: apisix/init.lua
##########
@@ -513,6 +513,8 @@ function _M.http_access_phase()
                 api_ctx.consumer,
                 api_ctx
             )
+            core.log.debug("find consumer ", api_ctx.consumer.username,

Review comment:
       IMHO, we can use `info` level error log, therefore we can check it without `log_level('debug')`. `debug` is too low to check it in the production if needed.

##########
File path: t/plugin/basic-auth.t
##########
@@ -189,6 +190,7 @@ Authorization: Basic Zm9vOmZvbwo=
 
 
 === TEST 8: verify
+--- yaml_config eval: $::yaml_config

Review comment:
       We don't need this line?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] membphis merged pull request #2905: fix: Basic auth plugin should run in rewrite phase.

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


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] membphis commented on pull request #2905: fix: Basic auth plugin should run in rewrite phase.

Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #2905:
URL: https://github.com/apache/apisix/pull/2905#issuecomment-736610374


   @jenskeiner many thx, merged right now


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] jenskeiner commented on a change in pull request #2905: fix: Basic auth plugin should run in rewrite phase.

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



##########
File path: apisix/init.lua
##########
@@ -513,6 +513,8 @@ function _M.http_access_phase()
                 api_ctx.consumer,
                 api_ctx
             )
+            core.log.debug("find consumer ", api_ctx.consumer.username,

Review comment:
       Sure, just thought we don't want to clutter the log too much in a prod setting where you might be running with `info` level.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] jenskeiner commented on pull request #2905: fix: Basic auth plugin should run in rewrite phase.

Posted by GitBox <gi...@apache.org>.
jenskeiner commented on pull request #2905:
URL: https://github.com/apache/apisix/pull/2905#issuecomment-736074309


   As per comment from @spacewander, added a check for the consumer handling; see https://github.com/apache/apisix/pull/2859#discussion_r531816904.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix] jenskeiner commented on a change in pull request #2905: fix: Basic auth plugin should run in rewrite phase.

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



##########
File path: t/plugin/basic-auth.t
##########
@@ -189,6 +190,7 @@ Authorization: Basic Zm9vOmZvbwo=
 
 
 === TEST 8: verify
+--- yaml_config eval: $::yaml_config

Review comment:
       Yep, will remove it. Was left over from my first attempt at changing the log level.




----------------------------------------------------------------
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:
users@infra.apache.org