mangoGoForward commented on a change in pull request #6039:
URL: https://github.com/apache/apisix/pull/6039#discussion_r780067867
##########
File path: apisix/plugins/basic-auth.lua
##########
@@ -161,6 +170,11 @@ function _M.rewrite(conf, ctx)
return 401, { message = "Password is error" }
end
+ -- 5. hide `Authentication` header if `hide_auth_header` is `true`
+ if conf.hide_auth_header == true then
+ core.response.set_header("Authentication", "")
Review comment:
My fault. Done.
##########
File path: apisix/plugins/basic-auth.lua
##########
@@ -30,7 +30,12 @@ local consumers_lrucache = core.lrucache.new({
local schema = {
type = "object",
title = "work with route or service object",
- properties = {},
+ properties = {
+ hide_auth_header = {
+ type = "boolean",
+ default = true,
Review comment:
Done.
##########
File path: docs/zh/latest/plugins/basic-auth.md
##########
@@ -43,6 +43,7 @@ title: basic-auth
| -------- | ------ | ------ | ------ | ------ |
------------------------------------------------------------------------------------------------------------------
|
| username | string | 必须 | | | 不同的 `consumer`
对象应有不同的值,它应当是唯一的。不同 consumer 使用了相同的 `username` ,将会出现请求匹配异常。 |
| password | string | 必须 | | | 用户的密码
|
+| hide_auth_header | boolean | 可选 | true | | 是否将 Authentication
请求头返回给客户端.
|
Review comment:
Done.
##########
File path: docs/en/latest/plugins/basic-auth.md
##########
@@ -39,10 +39,11 @@ For more information on Basic authentication, refer to
[Wiki](https://en.wikiped
## Attributes
-| Name | Type | Requirement | Default | Valid | Description
|
-| -------- | ------ | ----------- | ------- | ----- |
----------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-| username | string | required | | | Different `consumer`
should have different value which is unique. When different `consumer` use a
same `username`, a request matching exception would be raised. |
-| password | string | required | | | the user's password
|
+| Name | Type | Requirement | Default | Valid | Description
|
+| -------- | ------ | ----------- | ------- | ----- |
----------------------------------------------------------------------------------------------------------------------------------------------------------------
|
+| username | string | required | | | Different
`consumer` should have different value which is unique. When different
`consumer` use a same `username`, a request matching exception would be raised.
|
+| password | string | required | | | the user's
password
|
+| hide_auth_header | boolean | optional | true | | Whether to
return the Authentication request headers to the client.
|
Review comment:
Done.
##########
File path: apisix/plugins/basic-auth.lua
##########
@@ -161,6 +170,11 @@ function _M.rewrite(conf, ctx)
return 401, { message = "Password is error" }
end
+ -- 5. hide `Authentication` request header if `hide_auth_header` is `true`
+ if conf.hide_auth_header == true then
+ core.request.set_header(ctx, "Authentication", "")
+ end
+
Review comment:
Yes, use `core.request.set_header(ctx, "Authentication", nil)` can avoid.
##########
File path: apisix/plugins/basic-auth.lua
##########
@@ -30,7 +30,12 @@ local consumers_lrucache = core.lrucache.new({
local schema = {
type = "object",
title = "work with route or service object",
- properties = {},
+ properties = {
+ hide_auth_header = {
+ type = "boolean",
+ default = true,
Review comment:
Done.
--
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]