tzssangglass commented on a change in pull request #2657:
URL: https://github.com/apache/apisix/pull/2657#discussion_r519449535



##########
File path: t/plugin/jwt-auth.t
##########
@@ -1140,3 +1140,73 @@ base64_secret required but the secret is not in base64 
format
 [error]
 --- request
 GET /t
+
+
+
+=== TEST 50: when the exp value is not set, make sure the default value(86400) 
works
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+            local code, body, res_data = t('/apisix/admin/consumers',
+                ngx.HTTP_PUT,
+                [[{
+                    "username": "kerouac",
+                    "plugins": {
+                        "jwt-auth": {
+                            "key": "exp-not-set",
+                            "secret": "my-secret-key"
+                        }
+                    }
+                }]],
+                [[{
+                    "node": {
+                        "value": {
+                            "username": "kerouac",
+                            "plugins": {
+                                "jwt-auth": {
+                                    "key": "exp-not-set",
+                                    "secret": "my-secret-key"
+                                }
+                            }
+                        }
+                    },
+                    "action": "set"
+                }]]
+                )
+
+            ngx.status = code
+            ngx.say(require("cjson").encode(res_data))
+        }
+    }
+--- request
+GET /t
+--- response_body_like eval
+qr/"exp":86400/
+--- no_error_log
+[error]
+
+
+
+=== TEST 51: when the exp value is not set, sign jwt use the default 
value(86400)
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+            local code, body, res_data = 
t('/apisix/plugin/jwt/sign?key=exp-not-set',
+                ngx.HTTP_GET, nil, nil)

Review comment:
       let me try




----------------------------------------------------------------
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:
[email protected]


Reply via email to