Skip to content

Commit

Permalink
fix code checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Madhawa Gunasekara authored and Madhawa Gunasekara committed Nov 12, 2023
1 parent 13d4a84 commit 574197f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apisix/plugins/multi-auth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _M.rewrite(conf, ctx)
for k, auth_plugin in pairs(auth_plugins) do
for key, value in pairs(auth_plugin) do
local auth = require("apisix.plugins." .. key)
local auth_code, b = auth.rewrite(value, ctx)
local auth_code = auth.rewrite(value, ctx)
status_code = auth_code
if auth_code == nil then
core.log.debug("Authentication is successful" .. key .. " plugin")
Expand Down
3 changes: 2 additions & 1 deletion docs/en/latest/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
"plugins/authz-casbin",
"plugins/ldap-auth",
"plugins/opa",
"plugins/forward-auth"
"plugins/forward-auth",
"plugins/multi-auth"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions docs/en/latest/getting-started/key-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ APISIX has a flexible plugin extension system and a number of existing plugins f
- [LDAP](https://apisix.apache.org/docs/apisix/plugins/ldap-auth/)
- [Open Policy Agent (OPA)](https://apisix.apache.org/docs/apisix/plugins/opa/)
- [Forward Authentication](https://apisix.apache.org/docs/apisix/plugins/forward-auth/)
- [Multiple Authentications](https://apisix.apache.org/docs/apisix/plugins/multi-auth/)

In this tutorial, you will create a _consumer_ with _key authentication_, and learn how to enable and disable key authentication.

Expand Down
1 change: 1 addition & 0 deletions docs/zh/latest/getting-started/key-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ APISIX 拥有灵活的插件扩展系统,目前有很多可用于用户身份
- [LDAP](https://apisix.apache.org/zh/docs/apisix/plugins/ldap-auth/)
- [Open Policy Agent (OPA)](https://apisix.apache.org/zh/docs/apisix/plugins/opa/)
- [Forward Authentication](https://apisix.apache.org/zh/docs/apisix/plugins/forward-auth/)
- [Multiple Authentications](https://apisix.apache.org/docs/apisix/plugins/multi-auth/)

本教程中,你将创建一个带有 _密钥验证_ 插件的 _消费者_,并学习如何启用和停用身份验证插件。

Expand Down
2 changes: 1 addition & 1 deletion t/admin/plugins.t
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ qr/\{"metadata_schema":\{"properties":\{"ikey":\{"minimum":0,"type":"number"\},"
}
}
--- response_body eval
qr/\[\{"name":"wolf-rbac","priority":2555\},\{"name":"ldap-auth","priority":2540\},\{"name":"hmac-auth","priority":2530\},\{"name":"basic-auth","priority":2520\},\{"name":"jwt-auth","priority":2510\},\{"name":"key-auth","priority":2500\}\]/
qr/\[\{"name":"multi-auth","priority":2600\},\{"name":"wolf-rbac","priority":2555\},\{"name":"ldap-auth","priority":2540\},\{"name":"hmac-auth","priority":2530\},\{"name":"basic-auth","priority":2520\},\{"name":"jwt-auth","priority":2510\},\{"name":"key-auth","priority":2500\}\]/
Expand Down
8 changes: 4 additions & 4 deletions t/plugin/multi-auth.t
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ GET /hello
Authorization: Basic YmFyOmJhcgo=
--- error_code: 401
--- response_body
{"message":"Authorization Failed."}
{"message":"Authorization Failed"}



Expand All @@ -165,7 +165,7 @@ GET /hello
apikey: auth-two
--- error_code: 401
--- response_body
{"message":"Authorization Failed."}
{"message":"Authorization Failed"}



Expand Down Expand Up @@ -200,7 +200,7 @@ apikey: auth-two
GET /t
--- error_code: 400
--- response_body
{"error_msg":"invalid plugins configuration: failed to check the configuration of plugin multi-auth err: property \"auth_plugins\" is required"}
{"error_msg":"failed to check the configuration of plugin multi-auth err: property \"auth_plugins\" is required"}



Expand Down Expand Up @@ -241,4 +241,4 @@ GET /t
GET /t
--- error_code: 400
--- response_body
{"error_msg":"invalid plugins configuration: failed to check the configuration of plugin multi-auth err: property \"auth_plugins\" validation failed: expect array to have at least 2 items"}
{"error_msg":"failed to check the configuration of plugin multi-auth err: property \"auth_plugins\" validation failed: expect array to have at least 2 items"}

0 comments on commit 574197f

Please sign in to comment.