moonming commented on a change in pull request #1029: feat: add basic-auth plugin URL: https://github.com/apache/incubator-apisix/pull/1029#discussion_r363631623
########## File path: lua/apisix/plugins/basic-auth.lua ########## @@ -0,0 +1,225 @@ +local core = require("apisix.core") +local ngx = ngx +local ngx_re = require("ngx.re") +local json = require("apisix.core.json") + +local authorizations_etcd + +local lrucache = core.lrucache.new({ + ttl = 300, count = 512 +}) + +-- You can follow this document to write schema: +-- https://github.com/Tencent/rapidjson/blob/master/bin/draft-04/schema +-- rapidjson not supported `format` in draft-04 yet +local schema = { + type = "object", + properties = { + enable = { type = "boolean", default = true, enum = { true, false } }, + }, +} + +local plugin_name = "basic-auth" + +local function gen_key(username) + local key = "/authorizations/" .. username + return key +end + +local _M = { + version = 0.1, + priority = 1802, Review comment: the priority of auth plugin is begin from 2500, for example https://github.com/apache/incubator-apisix/blob/master/lua/apisix/plugins/jwt-auth.lua#L44 and https://github.com/apache/incubator-apisix/blob/master/lua/apisix/plugins/key-auth.lua#L33 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services