1. local typedefs = require "kong.db.schema.typedefs"
  2. return {
  3. name = "key-auth",
  4. fields = {
  5. { consumer = typedefs.no_consumer },
  6. { protocols = typedefs.protocols_http },
  7. { config = {
  8. type = "record",
  9. fields = {
  10. { key_names = {
  11. type = "array",
  12. required = true,
  13. elements = typedefs.header_name,
  14. default = { "apikey" },
  15. }, },
  16. { hide_credentials = { type = "boolean", default = false }, },
  17. { anonymous = { type = "string" }, },
  18. { key_in_body = { type = "boolean", default = false }, },
  19. { run_on_preflight = { type = "boolean", default = true }, },
  20. },
  21. }, },
  22. },
  23. }

参考

https://qizhidao.top/2021/03/07/Kong%E7%BD%91%E5%85%B3%E6%95%B4%E5%90%88spring-cloud%E5%BE%AE%E6%9C%8D%E5%8A%A1oauth2/