Request-transformation Plugin

I have following payload in my JWT token, passed as Authorization header, i.e. Authorization Bearer

“sub”: “7adcae34-8303-4cbf-9854-6edab851ed9a”,
“iat”: 1685012149,
“exp”: 1685012749,

My goal is to extract “sub” claim and add it to request body. Tried following but its adding whole JWT token to my request body.

  • name: request-transformer
    - sub:$(headers[“Authorization”]:gsub(“^Bearer “,””))

Can anyone please help with the expression that can get be just the “sub” claim as i dont want to parse the JWTs in all my upstream services to get “sub” value.