AlinsRan commented on code in PR #12040: URL: https://github.com/apache/apisix/pull/12040#discussion_r2017874635
########## apisix/admin/credentials.lua: ########## @@ -32,14 +34,37 @@ 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: There are too many nested judgments inside, but I think we can extract this logic into a universal function that can be used by both consumers and credentials. -- 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