AlinsRan commented on code in PR #12040: URL: https://github.com/apache/apisix/pull/12040#discussion_r2013386887
########## apisix/admin/credentials.lua: ########## @@ -32,14 +34,41 @@ local function check_conf(_id, conf, _need_id, schema) return nil, {error_msg = "invalid plugins configuration: " .. err} end - for name, _ in pairs(conf.plugins) do + for name, plugin_conf in pairs(conf.plugins) do local plugin_obj = plugin.get(name) if not plugin_obj then return nil, {error_msg = "unknown plugin " .. name} end + if plugin_obj.type ~= "auth" then return nil, {error_msg = "only supports auth type plugins in consumer credential"} end + + -- check duplicate key + local decrypted_conf = core.table.deepcopy(plugin_conf) Review Comment: These two pieces of code are basically the same. I suggest using a universal function. -- 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: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org