Copilot commented on code in PR #13245:
URL: https://github.com/apache/apisix/pull/13245#discussion_r3099156192


##########
docs/zh/latest/plugins/jwe-decrypt.md:
##########
@@ -28,137 +28,349 @@ description: 本文档包含了关于 APISIX jwe-decrypt 插件的相关信息
 #
 -->
 
-## 描述
-
-`jwe-decrypt` 插件,用于解密 APISIX [Service](../terminology/service.md) 或者 
[Route](../terminology/route.md) 请求中的 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) 授权请求头。
+<head>
+  <link rel="canonical" href="https://docs.api7.ai/hub/jwe-decrypt"; />
+</head>
 
-插件增加了一个 `/apisix/plugin/jwe/encrypt` 的内部 API,提供给 JWE 加密使用。解密时,秘钥应该配置在 
[Consumer](../terminology/consumer.md)内。
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
 
-## 属性
+## 描述
 
-Consumer 配置:
+`jwe-decrypt` 插件解密发送到 APISIX 
[路由](../terminology/route.md)或[服务](../terminology/service.md)的请求中的 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) 授权请求头。
 
-| 名称          | 类型      | 必选项   | 默认值   | 有效值 | 描述                             
                             |
-|---------------|---------|-------|-------|-----|-------------------------------------------------------------|
-| key           | string  | True  |       |     | Consumer 的唯一 key             
                               |
-| secret        | string  | True  |       |     | 解密密钥,必须为 32 位。秘钥可以使用 
[Secret](../terminology/secret.md) 资源保存在密钥管理服务中 |
-| is_base64_encoded | boolean | False | false |     | 如果密钥是 Base64 编码,则需要配置为 
`true`                               |
+该插件添加了一个 `/apisix/plugin/jwe/encrypt` 内部端点用于 JWE 
加密。解密时,密钥应配置在[消费者](../terminology/consumer.md)中。
 
-:::note
+## 属性
 
-注意,在启用 `is_base64_encoded` 后,你的 `secret` 长度可能会超过 32 位,你只需要保证在 Decode 后的长度仍然是 
32 位即可。
+### 消费者
 
-:::
+| 名称              | 类型    | 必选项 | 默认值 | 有效值    | 描述                            
                                                                                
                                                                              |
+| ----------------- | ------- | ------ | ------ | --------- | 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
+| key               | string  | 是     |        |           | 用于标识消费者凭证的唯一密钥。   
                                                                                
                                                                             |
+| secret            | string  | 是     |        | 32 个字符 | 
加密密钥。也可以将其存储在环境变量中并使用 `env://` 前缀引用,或存储在 HashiCorp Vault 的 KV 密钥引擎等密钥管理器中并使用 
`secret://` 前缀引用。启用 `is_base64_encoded` 后,`secret` 长度可能超过 32 个字符,只需确保解码后长度仍为 32 
个字符即可。 |
+| is_base64_encoded | boolean | 否     | false  |           | 如果密钥为 Base64 
编码,则设置为 true。                                                                   
                                                                                
    |
 
-Route 配置:
+### 路由或服务
 
-| 名称             | 类型      | 必选项   | 默认值           | 描述                        
                                                 |
-|----------------|---------|-------|---------------|----------------------------------------------------------------------------|
-| header         | string  | True | Authorization | 指定请求头,用于获取加密令牌             
                                                |
-| forward_header | string  | True | Authorization | 传递给 Upstream 的请求头名称        
                                                |
-| strict         | boolean | False | true          | 如果为配置为 true,请求中缺失 JWE 
token 则抛出 `403` 异常。如果为 `false`, 在缺失 JWE token 的情况下不会抛出异常 |
+| 名称           | 类型    | 必选项 | 默认值        | 有效值 | 描述                           
                                                                |
+| -------------- | ------- | ------ | ------------- | ------ | 
----------------------------------------------------------------------------------------------
 |
+| header         | string  | 是     | Authorization |        | 用于获取令牌的请求头。      
                                                                   |
+| forward_header | string  | 是     | Authorization |        | 传递明文给上游的请求头名称。   
                                                                |
+| strict         | boolean | 否     | true          |        | 如果为 true,当请求中缺少 
JWE 令牌时抛出 403 错误。如果为 false,当找不到 JWE 令牌时不抛出错误。 |
 
-## 启用插件
+## 使用示例
 
-首先,基于 `jwe-decrypt` 插件创建一个 Consumer,并且配置解密密钥:
+以下示例演示了如何针对不同场景使用 `jwe-decrypt` 插件。
 
 :::note
 
 您可以这样从 `config.yaml` 中获取 `admin_key` 并存入环境变量:
 
 ```bash
-admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 
's/"//g')
+admin_key=$(yq '.deployment.admin.admin_key[0].key' 
/usr/local/apisix/conf/config.yaml | sed 's/"//g')
 ```
 
 :::
 
+### 暴露 JWE 加密端点并生成 JWE 令牌
+
+以下示例演示如何暴露 JWE 加密端点并生成 JWE 令牌。
+
+`jwe-decrypt` 插件在 `/apisix/plugin/jwe/encrypt` 创建一个内部端点用于 JWE 加密。使用 
[public-api](public-api.md) 插件暴露该端点:
+
+<Tabs groupId="api">
+<TabItem value="admin-api" label="Admin API">
+
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/consumers -H "X-API-KEY: $admin_key" 
-X PUT -d '
-{
-    "username": "jack",
+curl "http://127.0.0.1:9180/apisix/admin/routes/jwe-encrypt-api"; -X PUT \
+  -H "X-API-KEY: ${admin_key}" \
+  -d '{
+    "uri": "/apisix/plugin/jwe/encrypt",
     "plugins": {
-        "jwe-decrypt": {
-            "key": "user-key",
-            "secret": "-secret-length-must-be-32-chars-"
-        }
+      "public-api": {}
     }
-}'
+  }'
 ```
 
-下一步,基于 `jwe-decrypt` 插件创建一个路由,用于解密 authorization 请求头:
+创建带有 `jwe-decrypt` 的消费者并配置解密密钥:
 
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: $admin_key" -X 
PUT -d '
-{
-    "methods": ["GET"],
-    "uri": "/anything*",
+curl "http://127.0.0.1:9180/apisix/admin/consumers"; -X PUT \
+  -H "X-API-KEY: ${admin_key}" \
+  -d '{
+    "username": "jack",
     "plugins": {
-        "jwe-decrypt": {}
-    },
-    "upstream": {
-        "type": "roundrobin",
-        "nodes": {
-            "httpbin.org:80": 1
-        }
+      "jwe-decrypt": {
+        "key": "jack-key",
+        "secret": "key-length-should-be-32-chars123"
+      }
     }
-}'
+  }'
 ```
 
-### 使用 JWE 加密数据
+</TabItem>
+
+<TabItem value="adc" label="ADC">
+
+暴露 JWE 加密端点并创建带有 `jwe-decrypt` 凭证的消费者:
+
+```yaml title="adc.yaml"
+consumers:
+  - username: jack
+    plugins:
+      jwe-decrypt:
+        key: jack-key
+        secret: key-length-should-be-32-chars123
+services:
+  - name: jwe-encrypt-api-service
+    routes:
+      - name: jwe-encrypt-api-route
+        uris:
+          - /apisix/plugin/jwe/encrypt
+        plugins:
+          public-api: {}
+    upstream:
+      type: roundrobin
+      nodes:
+        - host: httpbin.org
+          port: 80
+          weight: 1
+```
 
-该插件创建了一个内部的 API `/apisix/plugin/jwe/encrypt` 以使用 JWE 进行加密。要公开它,需要创建一个对应的路由,并启用 
[public-api](public-api.md) 插件:
+将配置同步到网关:
 
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/jwenew -H "X-API-KEY: 
$admin_key" -X PUT -d '
-{
-    "uri": "/apisix/plugin/jwe/encrypt",
-    "plugins": {
-        "public-api": {}
-    }
-}'
+adc sync -f adc.yaml
+```
+
+</TabItem>
+
+<TabItem value="ingress-controller" label="Ingress Controller">
+
+创建带有 `jwe-decrypt` 的消费者并使用 `public-api` 插件暴露 JWE 加密端点:
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+```yaml title="jwe-encrypt-api-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: Consumer
+metadata:
+  namespace: aic
+  name: jack
+spec:
+  gatewayRef:
+    name: apisix
+  plugins:
+    - name: jwe-decrypt
+      config:
+        key: jack-key
+        secret: key-length-should-be-32-chars123
+---
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+  namespace: aic
+  name: jwe-encrypt-api-plugin-config
+spec:
+  plugins:
+    - name: public-api
+      config:
+        _meta:
+          disable: false
+---
+apiVersion: gateway.networking.k8s.io/v1
+kind: HTTPRoute
+metadata:
+  namespace: aic
+  name: jwe-encrypt-api-route
+spec:
+  parentRefs:
+    - name: apisix
+  rules:
+    - matches:
+        - path:
+            type: Exact
+            value: /apisix/plugin/jwe/encrypt
+      filters:
+        - type: ExtensionRef
+          extensionRef:
+            group: apisix.apache.org
+            kind: PluginConfig
+            name: jwe-encrypt-api-plugin-config
 ```
 
-向 API 发送一个请求,将 Consumer 中配置的密钥,以参数的方式传递给 URI,用于加密 payload 中的一些数据。
+将配置应用到集群:
 
 ```shell
-curl -G --data-urlencode 'payload={"uid":10000,"uname":"test"}' 
'http://127.0.0.1:9080/apisix/plugin/jwe/encrypt?key=user-key' -i
+kubectl apply -f jwe-encrypt-api-ic.yaml
 ```
 
-您应该看到类似于如下内容的响应结果,其中 JWE 加密的数据位于响应体中:
+</TabItem>
 
+<TabItem value="apisix-ingress-controller" label="APISIX Ingress Controller">
+
+`ApisixConsumer` 仅通过 `authParameter` 字段支持认证插件,而 `jwe-decrypt` 不在支持的类型中。此示例无法使用 
APISIX Ingress Controller 完成。
+
+</TabItem>
+</Tabs>
+
+</TabItem>
+</Tabs>
+
+向加密端点发送请求,使用消费者密钥加密 payload 中的示例数据:
+
+```shell
+curl "http://127.0.0.1:9080/apisix/plugin/jwe/encrypt?key=jack-key"; \
+  -d 'payload={"uid":10000,"uname":"test"}' -G

Review Comment:
   该 curl 示例使用 `-G` 并通过 `-d 'payload={...}'` 传递 JSON,但没有进行 URL 
编码;花括号、引号、逗号等可能导致查询串解析异常,影响复制粘贴可用性。建议对 `payload=...` 使用 
`--data-urlencode`(旧版示例也采用了该写法)。
   ```suggestion
     --data-urlencode 'payload={"uid":10000,"uname":"test"}' -G
   ```



##########
docs/en/latest/plugins/jwe-decrypt.md:
##########
@@ -28,136 +28,349 @@ description: This document contains information about the 
Apache APISIX jwe-decr
 #
 -->
 
+<head>
+  <link rel="canonical" href="https://docs.api7.ai/hub/jwe-decrypt"; />
+</head>
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
 ## Description
 
-The `jwe-decrypt` Plugin is used to decrypt 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) authorization headers in 
requests to an APISIX [Service](../terminology/service.md) or 
[Route](../terminology/route.md).
+The `jwe-decrypt` Plugin decrypts 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) authorization headers in 
requests sent to APISIX [Routes](../terminology/route.md) or 
[Services](../terminology/service.md).
 
 This Plugin adds an endpoint `/apisix/plugin/jwe/encrypt` for JWE encryption. 
For decryption, the key should be configured in 
[Consumer](../terminology/consumer.md).
 
 ## Attributes
 
-For Consumer:
-
-| Name          | Type    | Required                                           
   | Default | Valid values                | Description                        
                                                                                
                          |
-|---------------|---------|-------------------------------------------------------|---------|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
-| key           | string  | True                                               
   |         |                             | Unique key for a Consumer.         
                                                                                
                          |
-| secret        | string  | True                                               
  |         |                             | The decryption key. Must be 32 
characters. The key could be saved in a secret manager using the 
[Secret](../terminology/secret.md) resource. |
-| is_base64_encoded | boolean | False                                          
       | false   |                             | Set to true if the secret is 
base64 encoded.                                                                 
                                |
-
-:::note
-
-After enabling `is_base64_encoded`, your `secret` length may exceed 32 chars. 
You only need to make sure that the length after decoding is still 32 chars.
+### Consumer
 
-:::
+| Name              | Type    | Required | Default | Valid values   | 
Description                                                                     
                                                                                
                                                         |
+| ----------------- | ------- | -------- | ------- | -------------- | 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
+| key               | string  | True     |         |                | A unique 
key that identifies the Credential for a Consumer.                              
                                                                                
                                                |
+| secret            | string  | True     |         | 32 characters  | The 
encryption key. You can also store it in an environment variable and reference 
it using the `env://` prefix, or in a secret manager such as HashiCorp Vault's 
KV secrets engine, and reference it using the `secret://` prefix. |
+| is_base64_encoded | boolean | False    | false   |                | Set to 
true if the secret is base64 encoded. Note that after enabling 
`is_base64_encoded`, the `secret` length may exceed 32 characters. You only 
need to make sure the decoded length is still 32 characters.           |

Review Comment:
   The Consumer attribute `secret` is described as “The encryption key”, but 
this Plugin is primarily used for decryption and the surrounding text calls it 
a decryption key. Consider rephrasing to “encryption/decryption key” or “shared 
symmetric key” to avoid implying it is only used for encryption.
   ```suggestion
   | Name              | Type    | Required | Default | Valid values   | 
Description                                                                     
                                                                                
                                                                         |
   | ----------------- | ------- | -------- | ------- | -------------- | 
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
   | key               | string  | True     |         |                | A 
unique key that identifies the Credential for a Consumer.                       
                                                                                
                                                                       |
   | secret            | string  | True     |         | 32 characters  | The 
shared symmetric encryption/decryption key. You can also store it in an 
environment variable and reference it using the `env://` prefix, or in a secret 
manager such as HashiCorp Vault's KV secrets engine, and reference it using the 
`secret://` prefix. |
   | is_base64_encoded | boolean | False    | false   |                | Set to 
true if the secret is base64 encoded. Note that after enabling 
`is_base64_encoded`, the `secret` length may exceed 32 characters. You only 
need to make sure the decoded length is still 32 characters.                    
   |
   ```



##########
docs/zh/latest/plugins/jwe-decrypt.md:
##########
@@ -28,137 +28,349 @@ description: 本文档包含了关于 APISIX jwe-decrypt 插件的相关信息
 #
 -->
 
-## 描述
-
-`jwe-decrypt` 插件,用于解密 APISIX [Service](../terminology/service.md) 或者 
[Route](../terminology/route.md) 请求中的 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) 授权请求头。
+<head>
+  <link rel="canonical" href="https://docs.api7.ai/hub/jwe-decrypt"; />
+</head>
 
-插件增加了一个 `/apisix/plugin/jwe/encrypt` 的内部 API,提供给 JWE 加密使用。解密时,秘钥应该配置在 
[Consumer](../terminology/consumer.md)内。
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
 
-## 属性
+## 描述
 
-Consumer 配置:
+`jwe-decrypt` 插件解密发送到 APISIX 
[路由](../terminology/route.md)或[服务](../terminology/service.md)的请求中的 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) 授权请求头。
 
-| 名称          | 类型      | 必选项   | 默认值   | 有效值 | 描述                             
                             |
-|---------------|---------|-------|-------|-----|-------------------------------------------------------------|
-| key           | string  | True  |       |     | Consumer 的唯一 key             
                               |
-| secret        | string  | True  |       |     | 解密密钥,必须为 32 位。秘钥可以使用 
[Secret](../terminology/secret.md) 资源保存在密钥管理服务中 |
-| is_base64_encoded | boolean | False | false |     | 如果密钥是 Base64 编码,则需要配置为 
`true`                               |
+该插件添加了一个 `/apisix/plugin/jwe/encrypt` 内部端点用于 JWE 
加密。解密时,密钥应配置在[消费者](../terminology/consumer.md)中。
 
-:::note
+## 属性
 
-注意,在启用 `is_base64_encoded` 后,你的 `secret` 长度可能会超过 32 位,你只需要保证在 Decode 后的长度仍然是 
32 位即可。
+### 消费者
 
-:::
+| 名称              | 类型    | 必选项 | 默认值 | 有效值    | 描述                            
                                                                                
                                                                              |
+| ----------------- | ------- | ------ | ------ | --------- | 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
+| key               | string  | 是     |        |           | 用于标识消费者凭证的唯一密钥。   
                                                                                
                                                                             |
+| secret            | string  | 是     |        | 32 个字符 | 
加密密钥。也可以将其存储在环境变量中并使用 `env://` 前缀引用,或存储在 HashiCorp Vault 的 KV 密钥引擎等密钥管理器中并使用 
`secret://` 前缀引用。启用 `is_base64_encoded` 后,`secret` 长度可能超过 32 个字符,只需确保解码后长度仍为 32 
个字符即可。 |
+| is_base64_encoded | boolean | 否     | false  |           | 如果密钥为 Base64 
编码,则设置为 true。                                                                   
                                                                                
    |
 
-Route 配置:
+### 路由或服务
 
-| 名称             | 类型      | 必选项   | 默认值           | 描述                        
                                                 |
-|----------------|---------|-------|---------------|----------------------------------------------------------------------------|
-| header         | string  | True | Authorization | 指定请求头,用于获取加密令牌             
                                                |
-| forward_header | string  | True | Authorization | 传递给 Upstream 的请求头名称        
                                                |
-| strict         | boolean | False | true          | 如果为配置为 true,请求中缺失 JWE 
token 则抛出 `403` 异常。如果为 `false`, 在缺失 JWE token 的情况下不会抛出异常 |
+| 名称           | 类型    | 必选项 | 默认值        | 有效值 | 描述                           
                                                                |
+| -------------- | ------- | ------ | ------------- | ------ | 
----------------------------------------------------------------------------------------------
 |
+| header         | string  | 是     | Authorization |        | 用于获取令牌的请求头。      
                                                                   |
+| forward_header | string  | 是     | Authorization |        | 传递明文给上游的请求头名称。   
                                                                |
+| strict         | boolean | 否     | true          |        | 如果为 true,当请求中缺少 
JWE 令牌时抛出 403 错误。如果为 false,当找不到 JWE 令牌时不抛出错误。 |
 
-## 启用插件
+## 使用示例
 
-首先,基于 `jwe-decrypt` 插件创建一个 Consumer,并且配置解密密钥:
+以下示例演示了如何针对不同场景使用 `jwe-decrypt` 插件。
 
 :::note
 
 您可以这样从 `config.yaml` 中获取 `admin_key` 并存入环境变量:
 
 ```bash
-admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 
's/"//g')
+admin_key=$(yq '.deployment.admin.admin_key[0].key' 
/usr/local/apisix/conf/config.yaml | sed 's/"//g')

Review Comment:
   `admin_key` 获取命令硬编码了 `/usr/local/apisix/conf/config.yaml`,但文档其他位置普遍使用 
`conf/config.yaml`(例如 
docs/zh/latest/terminology/route.md:57)。这会导致非默认安装路径下示例无法直接运行;建议改回 
`conf/config.yaml`,或在文中明确说明路径取决于安装位置。
   ```suggestion
   admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 
's/"//g')
   ```



##########
docs/en/latest/plugins/jwe-decrypt.md:
##########
@@ -28,136 +28,349 @@ description: This document contains information about the 
Apache APISIX jwe-decr
 #
 -->
 
+<head>
+  <link rel="canonical" href="https://docs.api7.ai/hub/jwe-decrypt"; />
+</head>
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
 ## Description
 
-The `jwe-decrypt` Plugin is used to decrypt 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) authorization headers in 
requests to an APISIX [Service](../terminology/service.md) or 
[Route](../terminology/route.md).
+The `jwe-decrypt` Plugin decrypts 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) authorization headers in 
requests sent to APISIX [Routes](../terminology/route.md) or 
[Services](../terminology/service.md).
 
 This Plugin adds an endpoint `/apisix/plugin/jwe/encrypt` for JWE encryption. 
For decryption, the key should be configured in 
[Consumer](../terminology/consumer.md).
 
 ## Attributes
 
-For Consumer:
-
-| Name          | Type    | Required                                           
   | Default | Valid values                | Description                        
                                                                                
                          |
-|---------------|---------|-------------------------------------------------------|---------|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
-| key           | string  | True                                               
   |         |                             | Unique key for a Consumer.         
                                                                                
                          |
-| secret        | string  | True                                               
  |         |                             | The decryption key. Must be 32 
characters. The key could be saved in a secret manager using the 
[Secret](../terminology/secret.md) resource. |
-| is_base64_encoded | boolean | False                                          
       | false   |                             | Set to true if the secret is 
base64 encoded.                                                                 
                                |
-
-:::note
-
-After enabling `is_base64_encoded`, your `secret` length may exceed 32 chars. 
You only need to make sure that the length after decoding is still 32 chars.
+### Consumer
 
-:::
+| Name              | Type    | Required | Default | Valid values   | 
Description                                                                     
                                                                                
                                                         |
+| ----------------- | ------- | -------- | ------- | -------------- | 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
+| key               | string  | True     |         |                | A unique 
key that identifies the Credential for a Consumer.                              
                                                                                
                                                |
+| secret            | string  | True     |         | 32 characters  | The 
encryption key. You can also store it in an environment variable and reference 
it using the `env://` prefix, or in a secret manager such as HashiCorp Vault's 
KV secrets engine, and reference it using the `secret://` prefix. |
+| is_base64_encoded | boolean | False    | false   |                | Set to 
true if the secret is base64 encoded. Note that after enabling 
`is_base64_encoded`, the `secret` length may exceed 32 characters. You only 
need to make sure the decoded length is still 32 characters.           |
 
-For Route:
+### Route or Service
 
-| Name   | Type   | Required | Default       | Description                     
                                    |
-|--------|--------|----------|---------------|---------------------------------------------------------------------|
-| header | string | True    | Authorization | The header to get the token 
from.                                   |
-| forward_header | string | True     | Authorization  | Set the header name 
that passes the plaintext to the Upstream.   |
-| strict | boolean | False     | true  | If true, throw a 403 error if JWE 
token is missing from the request. If false, do not throw an error if JWE token 
cannot be found.  |
+| Name           | Type    | Required | Default       | Valid values | 
Description                                                                     
                                                  |
+| -------------- | ------- | -------- | ------------- | ------------ | 
---------------------------------------------------------------------------------------------------------------------------------
 |
+| header         | string  | True     | Authorization |              | The 
header to get the token from.                                                   
                                              |
+| forward_header | string  | True     | Authorization |              | Name of 
the header that passes the plaintext to the Upstream.                           
                                          |
+| strict         | boolean | False    | true          |              | If 
true, throw a 403 error if JWE token is missing from the request. If false, do 
not throw an error when JWE token is not found. |
 
-## Example usage
+## Examples
 
-First, create a Consumer with `jwe-decrypt` and configure the decryption key:
+The examples below demonstrate how you can work with the `jwe-decrypt` Plugin 
for different scenarios.
 
 :::note
+
 You can fetch the `admin_key` from `config.yaml` and save to an environment 
variable with the following command:
 
 ```bash
-admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 
's/"//g')
+admin_key=$(yq '.deployment.admin.admin_key[0].key' 
/usr/local/apisix/conf/config.yaml | sed 's/"//g')

Review Comment:
   The `admin_key` extraction command hard-codes 
`/usr/local/apisix/conf/config.yaml`, but the rest of the docs consistently 
reference `conf/config.yaml` (e.g., docs/en/latest/admin-api.md:129). This 
absolute path will fail for common non-default installs; consider reverting to 
`conf/config.yaml` or explicitly explaining that the path depends on the 
installation location.
   ```suggestion
   admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 
's/"//g')
   ```



##########
docs/zh/latest/plugins/jwe-decrypt.md:
##########
@@ -28,137 +28,349 @@ description: 本文档包含了关于 APISIX jwe-decrypt 插件的相关信息
 #
 -->
 
-## 描述
-
-`jwe-decrypt` 插件,用于解密 APISIX [Service](../terminology/service.md) 或者 
[Route](../terminology/route.md) 请求中的 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) 授权请求头。
+<head>
+  <link rel="canonical" href="https://docs.api7.ai/hub/jwe-decrypt"; />
+</head>
 
-插件增加了一个 `/apisix/plugin/jwe/encrypt` 的内部 API,提供给 JWE 加密使用。解密时,秘钥应该配置在 
[Consumer](../terminology/consumer.md)内。
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
 
-## 属性
+## 描述
 
-Consumer 配置:
+`jwe-decrypt` 插件解密发送到 APISIX 
[路由](../terminology/route.md)或[服务](../terminology/service.md)的请求中的 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) 授权请求头。
 
-| 名称          | 类型      | 必选项   | 默认值   | 有效值 | 描述                             
                             |
-|---------------|---------|-------|-------|-----|-------------------------------------------------------------|
-| key           | string  | True  |       |     | Consumer 的唯一 key             
                               |
-| secret        | string  | True  |       |     | 解密密钥,必须为 32 位。秘钥可以使用 
[Secret](../terminology/secret.md) 资源保存在密钥管理服务中 |
-| is_base64_encoded | boolean | False | false |     | 如果密钥是 Base64 编码,则需要配置为 
`true`                               |
+该插件添加了一个 `/apisix/plugin/jwe/encrypt` 内部端点用于 JWE 
加密。解密时,密钥应配置在[消费者](../terminology/consumer.md)中。
 
-:::note
+## 属性
 
-注意,在启用 `is_base64_encoded` 后,你的 `secret` 长度可能会超过 32 位,你只需要保证在 Decode 后的长度仍然是 
32 位即可。
+### 消费者
 
-:::
+| 名称              | 类型    | 必选项 | 默认值 | 有效值    | 描述                            
                                                                                
                                                                              |
+| ----------------- | ------- | ------ | ------ | --------- | 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
+| key               | string  | 是     |        |           | 用于标识消费者凭证的唯一密钥。   
                                                                                
                                                                             |
+| secret            | string  | 是     |        | 32 个字符 | 
加密密钥。也可以将其存储在环境变量中并使用 `env://` 前缀引用,或存储在 HashiCorp Vault 的 KV 密钥引擎等密钥管理器中并使用 
`secret://` 前缀引用。启用 `is_base64_encoded` 后,`secret` 长度可能超过 32 个字符,只需确保解码后长度仍为 32 
个字符即可。 |
+| is_base64_encoded | boolean | 否     | false  |           | 如果密钥为 Base64 
编码,则设置为 true。                                                                   
                                                                                
    |

Review Comment:
   消费者属性 `secret` 
描述为“加密密钥”,但该插件主要用于解密,且上下文也称其为解密密钥。建议改为“加/解密共用密钥”或“对称密钥”,避免读者误解该值只用于加密。
   ```suggestion
   | 名称              | 类型    | 必选项 | 默认值 | 有效值    | 描述                          
                                                                                
                                                                                
        |
   | ----------------- | ------- | ------ | ------ | --------- | 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
   | key               | string  | 是     |        |           | 用于标识消费者凭证的唯一密钥。 
                                                                                
                                                                                
       |
   | secret            | string  | 是     |        | 32 个字符 | 
加/解密共用的对称密钥。也可以将其存储在环境变量中并使用 `env://` 前缀引用,或存储在 HashiCorp Vault 的 KV 
密钥引擎等密钥管理器中并使用 `secret://` 前缀引用。启用 `is_base64_encoded` 后,`secret` 长度可能超过 32 
个字符,只需确保解码后长度仍为 32 个字符即可。 |
   | is_base64_encoded | boolean | 否     | false  |           | 如果密钥为 Base64 
编码,则设置为 true。                                                                   
                                                                                
            |
   ```



##########
docs/en/latest/plugins/jwe-decrypt.md:
##########
@@ -28,136 +28,349 @@ description: This document contains information about the 
Apache APISIX jwe-decr
 #
 -->
 
+<head>
+  <link rel="canonical" href="https://docs.api7.ai/hub/jwe-decrypt"; />
+</head>
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
 ## Description
 
-The `jwe-decrypt` Plugin is used to decrypt 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) authorization headers in 
requests to an APISIX [Service](../terminology/service.md) or 
[Route](../terminology/route.md).
+The `jwe-decrypt` Plugin decrypts 
[JWE](https://datatracker.ietf.org/doc/html/rfc7516) authorization headers in 
requests sent to APISIX [Routes](../terminology/route.md) or 
[Services](../terminology/service.md).
 
 This Plugin adds an endpoint `/apisix/plugin/jwe/encrypt` for JWE encryption. 
For decryption, the key should be configured in 
[Consumer](../terminology/consumer.md).
 
 ## Attributes
 
-For Consumer:
-
-| Name          | Type    | Required                                           
   | Default | Valid values                | Description                        
                                                                                
                          |
-|---------------|---------|-------------------------------------------------------|---------|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
-| key           | string  | True                                               
   |         |                             | Unique key for a Consumer.         
                                                                                
                          |
-| secret        | string  | True                                               
  |         |                             | The decryption key. Must be 32 
characters. The key could be saved in a secret manager using the 
[Secret](../terminology/secret.md) resource. |
-| is_base64_encoded | boolean | False                                          
       | false   |                             | Set to true if the secret is 
base64 encoded.                                                                 
                                |
-
-:::note
-
-After enabling `is_base64_encoded`, your `secret` length may exceed 32 chars. 
You only need to make sure that the length after decoding is still 32 chars.
+### Consumer
 
-:::
+| Name              | Type    | Required | Default | Valid values   | 
Description                                                                     
                                                                                
                                                         |
+| ----------------- | ------- | -------- | ------- | -------------- | 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 |
+| key               | string  | True     |         |                | A unique 
key that identifies the Credential for a Consumer.                              
                                                                                
                                                |
+| secret            | string  | True     |         | 32 characters  | The 
encryption key. You can also store it in an environment variable and reference 
it using the `env://` prefix, or in a secret manager such as HashiCorp Vault's 
KV secrets engine, and reference it using the `secret://` prefix. |
+| is_base64_encoded | boolean | False    | false   |                | Set to 
true if the secret is base64 encoded. Note that after enabling 
`is_base64_encoded`, the `secret` length may exceed 32 characters. You only 
need to make sure the decoded length is still 32 characters.           |
 
-For Route:
+### Route or Service
 
-| Name   | Type   | Required | Default       | Description                     
                                    |
-|--------|--------|----------|---------------|---------------------------------------------------------------------|
-| header | string | True    | Authorization | The header to get the token 
from.                                   |
-| forward_header | string | True     | Authorization  | Set the header name 
that passes the plaintext to the Upstream.   |
-| strict | boolean | False     | true  | If true, throw a 403 error if JWE 
token is missing from the request. If false, do not throw an error if JWE token 
cannot be found.  |
+| Name           | Type    | Required | Default       | Valid values | 
Description                                                                     
                                                  |
+| -------------- | ------- | -------- | ------------- | ------------ | 
---------------------------------------------------------------------------------------------------------------------------------
 |
+| header         | string  | True     | Authorization |              | The 
header to get the token from.                                                   
                                              |
+| forward_header | string  | True     | Authorization |              | Name of 
the header that passes the plaintext to the Upstream.                           
                                          |
+| strict         | boolean | False    | true          |              | If 
true, throw a 403 error if JWE token is missing from the request. If false, do 
not throw an error when JWE token is not found. |
 
-## Example usage
+## Examples
 
-First, create a Consumer with `jwe-decrypt` and configure the decryption key:
+The examples below demonstrate how you can work with the `jwe-decrypt` Plugin 
for different scenarios.
 
 :::note
+
 You can fetch the `admin_key` from `config.yaml` and save to an environment 
variable with the following command:
 
 ```bash
-admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 
's/"//g')
+admin_key=$(yq '.deployment.admin.admin_key[0].key' 
/usr/local/apisix/conf/config.yaml | sed 's/"//g')
 ```
 
 :::
 
+### Expose JWE Encryption Endpoint and Generate JWE Token
+
+The following example demonstrates how to expose the JWE encryption endpoint 
and generate a JWE token.
+
+The `jwe-decrypt` Plugin creates an internal endpoint at 
`/apisix/plugin/jwe/encrypt` to encrypt JWE. Expose the endpoint with the 
[public-api](public-api.md) Plugin:
+
+<Tabs groupId="api">
+<TabItem value="admin-api" label="Admin API">
+
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/consumers -H "X-API-KEY: $admin_key" 
-X PUT -d '
-{
-    "username": "jack",
+curl "http://127.0.0.1:9180/apisix/admin/routes/jwe-encrypt-api"; -X PUT \
+  -H "X-API-KEY: ${admin_key}" \
+  -d '{
+    "uri": "/apisix/plugin/jwe/encrypt",
     "plugins": {
-        "jwe-decrypt": {
-            "key": "user-key",
-            "secret": "-secret-length-must-be-32-chars-"
-        }
+      "public-api": {}
     }
-}'
+  }'
 ```
 
-Next, create a Route with `jwe-decrypt` enabled to decrypt the authorization 
header:
+Create a Consumer with `jwe-decrypt` and configure the decryption key:
 
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: $admin_key" -X 
PUT -d '
-{
-    "methods": ["GET"],
-    "uri": "/anything*",
+curl "http://127.0.0.1:9180/apisix/admin/consumers"; -X PUT \
+  -H "X-API-KEY: ${admin_key}" \
+  -d '{
+    "username": "jack",
     "plugins": {
-        "jwe-decrypt": {}
-    },
-    "upstream": {
-        "type": "roundrobin",
-        "nodes": {
-            "httpbin.org:80": 1
-        }
+      "jwe-decrypt": {
+        "key": "jack-key",
+        "secret": "key-length-should-be-32-chars123"
+      }
     }
-}'
+  }'
 ```
 
-### Encrypt Data with JWE
+</TabItem>
+
+<TabItem value="adc" label="ADC">
+
+Expose the JWE encryption endpoint and create a Consumer with `jwe-decrypt` 
Credential:
+
+```yaml title="adc.yaml"
+consumers:
+  - username: jack
+    plugins:
+      jwe-decrypt:
+        key: jack-key
+        secret: key-length-should-be-32-chars123
+services:
+  - name: jwe-encrypt-api-service
+    routes:
+      - name: jwe-encrypt-api-route
+        uris:
+          - /apisix/plugin/jwe/encrypt
+        plugins:
+          public-api: {}
+    upstream:
+      type: roundrobin
+      nodes:
+        - host: httpbin.org
+          port: 80
+          weight: 1
+```
 
-The Plugin creates an internal endpoint `/apisix/plugin/jwe/encrypt` to 
encrypt data with JWE. To expose it publicly, create a Route with the 
[public-api](public-api.md) Plugin:
+Synchronize the configuration to the gateway:
 
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/jwenew -H "X-API-KEY: 
$admin_key" -X PUT -d '
-{
-    "uri": "/apisix/plugin/jwe/encrypt",
-    "plugins": {
-        "public-api": {}
-    }
-}'
+adc sync -f adc.yaml
+```
+
+</TabItem>
+
+<TabItem value="ingress-controller" label="Ingress Controller">
+
+Create a Consumer with `jwe-decrypt` and expose the JWE encryption endpoint 
with the `public-api` Plugin:
+
+<Tabs groupId="k8s-api">
+<TabItem value="gateway-api" label="Gateway API">
+
+```yaml title="jwe-encrypt-api-ic.yaml"
+apiVersion: apisix.apache.org/v1alpha1
+kind: Consumer
+metadata:
+  namespace: aic
+  name: jack
+spec:
+  gatewayRef:
+    name: apisix
+  plugins:
+    - name: jwe-decrypt
+      config:
+        key: jack-key
+        secret: key-length-should-be-32-chars123
+---
+apiVersion: apisix.apache.org/v1alpha1
+kind: PluginConfig
+metadata:
+  namespace: aic
+  name: jwe-encrypt-api-plugin-config
+spec:
+  plugins:
+    - name: public-api
+      config:
+        _meta:
+          disable: false
+---
+apiVersion: gateway.networking.k8s.io/v1
+kind: HTTPRoute
+metadata:
+  namespace: aic
+  name: jwe-encrypt-api-route
+spec:
+  parentRefs:
+    - name: apisix
+  rules:
+    - matches:
+        - path:
+            type: Exact
+            value: /apisix/plugin/jwe/encrypt
+      filters:
+        - type: ExtensionRef
+          extensionRef:
+            group: apisix.apache.org
+            kind: PluginConfig
+            name: jwe-encrypt-api-plugin-config
 ```
 
-Send a request to the endpoint passing the key configured in Consumer to the 
URI parameter to encrypt some sample data in the payload:
+Apply the configuration to your cluster:
 
 ```shell
-curl -G --data-urlencode 'payload={"uid":10000,"uname":"test"}' 
'http://127.0.0.1:9080/apisix/plugin/jwe/encrypt?key=user-key' -i
+kubectl apply -f jwe-encrypt-api-ic.yaml
 ```
 
-You should see a response similar to the following, with the JWE encrypted 
data in the response body:
+</TabItem>
+
+<TabItem value="apisix-ingress-controller" label="APISIX Ingress Controller">
 
+`ApisixConsumer` only supports authentication plugins via the `authParameter` 
field, and `jwe-decrypt` is not among the supported types. This example cannot 
be completed using the APISIX Ingress Controller.
+
+</TabItem>
+</Tabs>
+
+</TabItem>
+</Tabs>
+
+Send a request to the encryption endpoint with Consumer key to encrypt some 
sample data in the payload:
+
+```shell
+curl "http://127.0.0.1:9080/apisix/plugin/jwe/encrypt?key=jack-key"; \
+  -d 'payload={"uid":10000,"uname":"test"}' -G

Review Comment:
   This curl example uses `-G` with `-d 'payload={...}'` but does not 
URL-encode the JSON. Unescaped `{`, `}`, `"`, and commas can be interpreted by 
the shell/curl and may produce an invalid query string. Use `--data-urlencode` 
for `payload=...` (as in the previous version of this doc) to make the command 
copy/paste safe.
   ```suggestion
     --data-urlencode 'payload={"uid":10000,"uname":"test"}' -G
   ```



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