You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2020/10/29 06:37:22 UTC

[apisix] branch master updated: fix: jwt-auth add consumer_schema to the _M (#2555)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 61bcb18  fix: jwt-auth add consumer_schema to the _M (#2555)
61bcb18 is described below

commit 61bcb1888581edfdae03b40c97e44e43405f4583
Author: JinChen <36...@users.noreply.github.com>
AuthorDate: Thu Oct 29 14:37:13 2020 +0800

    fix: jwt-auth add consumer_schema to the _M (#2555)
    
    Signed-off-by: Jaycean <ji...@163.com>
---
 apisix/plugins/jwt-auth.lua |  1 +
 t/plugin/jwt-auth.t         | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/apisix/plugins/jwt-auth.lua b/apisix/plugins/jwt-auth.lua
index a594e6f..40959f0 100644
--- a/apisix/plugins/jwt-auth.lua
+++ b/apisix/plugins/jwt-auth.lua
@@ -62,6 +62,7 @@ local _M = {
     type = 'auth',
     name = plugin_name,
     schema = schema,
+    consumer_schema = consumer_schema
 }
 
 
diff --git a/t/plugin/jwt-auth.t b/t/plugin/jwt-auth.t
index 0a041b0..e44fc03 100644
--- a/t/plugin/jwt-auth.t
+++ b/t/plugin/jwt-auth.t
@@ -519,3 +519,33 @@ GET /t
 \{"error_msg":"failed to check the configuration of plugin jwt-auth err: additional properties forbidden, found key"\}
 --- no_error_log
 [error]
+
+
+
+=== TEST 25: get the schema by schema_type
+--- request
+GET /apisix/admin/schema/plugins/jwt-auth?schema_type=consumer
+--- response_body
+{"required":["key"],"properties":{"exp":{"minimum":1,"type":"integer"},"algorithm":{"type":"string","default":"HS256","enum":["HS256","HS512","RS256"]},"base64_secret":{"default":false,"type":"boolean"},"secret":{"type":"string"},"key":{"type":"string"}},"additionalProperties":false,"type":"object"}
+--- no_error_log
+[error]
+
+
+
+=== TEST 26: get the schema by error schema_type
+--- request
+GET /apisix/admin/schema/plugins/jwt-auth?schema_type=consumer123123
+--- response_body
+{"properties":{"disable":{"type":"boolean"}},"additionalProperties":false,"type":"object"}
+--- no_error_log
+[error]
+
+
+
+=== TEST 27: get the schema by default schema_type
+--- request
+GET /apisix/admin/schema/plugins/jwt-auth
+--- response_body
+{"properties":{"disable":{"type":"boolean"}},"additionalProperties":false,"type":"object"}
+--- no_error_log
+[error]