Skip to content

bug: jwe-decrypt Authorization header not showing up #10835

Description

@kayx23

Current Behavior

Current doc: https://apisix.apache.org/docs/apisix/plugins/jwe-decrypt/

Specifically, it mentions the Authorization header with payload in plaintext should show up:

image

However in actual testing, the Authorization header doesn't show up at all:

image

Expected Behavior

Confirm first if something is wrong with the code or with the doc. Eventually the doc should match up with the actual outcome.

Steps to Reproduce

Need APISIX 3.8.0.

Expose endpoint:

curl "http://127.0.0.1:9180/apisix/admin/routes/jwe-encrypt-api" -X PUT \
  -H "X-API-KEY: ${ADMIN_API_KEY}" \
  -d '{
    "uri": "/apisix/plugin/jwe/encrypt",
    "plugins": {
      "public-api": {}
    }
  }'

Create a consumer:

curl "http://127.0.0.1:9180/apisix/admin/consumers" -X PUT \         
  -H "X-API-KEY: ${ADMIN_API_KEY}" \          
  -d '{
    "username": "jack",
    "plugins": {
      "jwe-decrypt": {
        "key": "jack-key",
        "secret": "key-length-should-be-32-chars123"
      }
    }
  }'

Create route:

curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
  -H "X-API-KEY: ${ADMIN_API_KEY}" \
  -d '{
    "id": "jwe-decrypt-route",
    "uri": "/anything/jwe",
    "plugins": {
      "jwe-decrypt": {
        "header": "Authorization",
        "forward_header": "Authorization"
      }
    },
    "upstream": {
      "type": "roundrobin",
      "nodes": {
        "httpbin.org:80": 1
      }
    }
  }'

Encrypt:

curl -G --data-urlencode 'payload={"uid":10000,"uname":"test"}' 'http://127.0.0.1:9080/apisix/plugin/jwe/encrypt?key=jack-key'

You should get the JWE encrypted data.

Send a request to the route with the JWE encrypted data in the Authorization header:

curl "http://127.0.0.1:9080/anything/jwe" -H 'Authorization: <YOUR_TOKEN>'

Environment

  • APISIX version (run apisix version): 3.8.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status
✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions