This is an automated email from the ASF dual-hosted git repository.
wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new c11f602fc fix: use `plugin.get` to fetch plugin configured in
multi-auth plugin (#11794)
c11f602fc is described below
commit c11f602fc86c59a27bba4229cf8fdc0720333c33
Author: Ashish Tiwari <[email protected]>
AuthorDate: Thu Dec 5 14:52:34 2024 +0530
fix: use `plugin.get` to fetch plugin configured in multi-auth plugin
(#11794)
---
apisix/plugins/multi-auth.lua | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/apisix/plugins/multi-auth.lua b/apisix/plugins/multi-auth.lua
index 9a259d038..7d34ffb23 100644
--- a/apisix/plugins/multi-auth.lua
+++ b/apisix/plugins/multi-auth.lua
@@ -18,6 +18,7 @@ local core = require("apisix.core")
local require = require
local pairs = pairs
local type = type
+local plugin = require("apisix.plugin")
local schema = {
type = "object",
@@ -48,7 +49,7 @@ function _M.check_schema(conf)
local auth_plugins = conf.auth_plugins
for k, auth_plugin in pairs(auth_plugins) do
for auth_plugin_name, auth_plugin_conf in pairs(auth_plugin) do
- local auth = require("apisix.plugins." .. auth_plugin_name)
+ local auth = plugin.get(auth_plugin_name)
if auth == nil then
return false, auth_plugin_name .. " plugin did not found"
else
@@ -73,7 +74,7 @@ function _M.rewrite(conf, ctx)
for k, auth_plugin in pairs(auth_plugins) do
for auth_plugin_name, auth_plugin_conf in pairs(auth_plugin) do
- local auth = require("apisix.plugins." .. auth_plugin_name)
+ local auth = plugin.get(auth_plugin_name)
-- returns 401 HTTP status code if authentication failed,
otherwise returns nothing.
local auth_code, err = auth.rewrite(auth_plugin_conf, ctx)
if type(err) == "table" then