nic-6443 commented on code in PR #12944:
URL: https://github.com/apache/apisix/pull/12944#discussion_r2753043008


##########
apisix/plugins/jwt-auth.lua:
##########
@@ -141,15 +176,24 @@ function _M.check_schema(conf, schema_type)
         return false, err
     end
 
+    local is_hs_alg = conf.algorithm:sub(1, 2) == "HS"
     if (conf.algorithm == "HS256" or conf.algorithm == "HS512") and not 
conf.secret then
         return false, "property \"secret\" is required "..
                       "when \"algorithm\" is \"HS256\" or \"HS512\""
+    end
+
+    if is_hs_alg and not conf.secret then
+        conf.secret = ngx_encode_base64(resty_random.bytes(32, true))

Review Comment:
   ```suggestion
       local is_hs_alg = conf.algorithm:sub(1, 2) == "HS"
   
       if is_hs_alg and not conf.secret then
           return false, "property \"secret\" is required"
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to