moonming commented on a change in pull request #1029: feat: add basic-auth 
plugin
URL: https://github.com/apache/incubator-apisix/pull/1029#discussion_r363721623
 
 

 ##########
 File path: lua/apisix/plugins/basic-auth.lua
 ##########
 @@ -0,0 +1,224 @@
+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,
+    name = plugin_name,
+    schema = schema,
 
 Review comment:
   `type = 'auth',` is required for auth plugin.

----------------------------------------------------------------
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

Reply via email to