monkeyDluffy6017 commented on code in PR #10252:
URL: https://github.com/apache/apisix/pull/10252#discussion_r1410266010


##########
apisix/plugins/jwe-decrypt.lua:
##########
@@ -0,0 +1,250 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local core            = require("apisix.core")
+local consumer_mod    = require("apisix.consumer")
+local base64          = require("ngx.base64")
+local aes             = require("resty.aes")
+local ngx             = ngx
+local sub_str         = string.sub
+local cipher          = aes.cipher(256, "gcm")
+
+local plugin_name     = "jwe-decrypt"
+
+local schema = {
+    type = "object",
+    properties = {
+        header = {
+            type = "string",
+            default = "Authorization"
+        },
+        forward_header = {
+            type = "string",
+            default = "Authorization"
+        },
+        strict = {
+            type = "boolean",
+            default = true
+        }
+    },
+    required = { "header", "forward_header" },
+}
+
+local consumer_schema = {
+    type = "object",
+    properties = {
+        key = { type = "string" },
+        secret = { type = "string", minLength = 32 },
+         is_base64_encoded = { type = "boolean" },
+    },
+    required = { "key", "secret" },
+}
+
+
+local _M = {
+    version = 0.1,
+    priority = 2509,
+    type = 'auth',
+    name = plugin_name,
+    schema = schema,
+    consumer_schema = consumer_schema
+}
+
+
+function _M.check_schema(conf, schema_type)
+    if schema_type == core.schema.TYPE_CONSUMER then
+        return core.schema.check(consumer_schema, conf)
+    end
+    return core.schema.check(schema, conf)
+end
+
+
+local function get_secret(conf)
+    local secret = conf.secret
+
+    if conf. is_base64_encoded then

Review Comment:
   ```suggestion
       if conf.is_base64_encoded then
   ```



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