@@ -4,7 +4,7 @@ A Serverless Workflow 1.x function that decodes JWT (JSON Web Token) payloads us
44
55## Technical Implementation
66
7- This function implements JWT payload extraction through a ` set ` task using jq expressions:
7+ This function implements JWT payload extraction through a ` run ` task using jq expressions:
88
99** Core JWT Decoding Logic:**
1010``` jq
@@ -36,10 +36,10 @@ document:
3636 version : 1.0.0
3737do :
3838 - decodeJWT :
39- use : jwt-parser
39+ call : jwt-parser
4040 with :
4141 token : ${ .headers.authorization }
42- # Returns: { claims: {...}, result: {...} }
42+ # Returns: complete JWT payload as JSON object
4343```
4444
4545### Specific Claim Extraction
@@ -52,17 +52,17 @@ document:
5252 version : 1.0.0
5353do :
5454 - extractSubject :
55- use : jwt-parser
55+ call : jwt-parser
5656 with :
5757 token : ${ .headers.authorization }
5858 claimPath : " .sub"
59- # Returns: { claims: {...}, result: "user-id-123" }
59+ # Returns: "user-id-123"
6060 - extractNestedClaim :
61- use : jwt-parser
61+ call : jwt-parser
6262 with :
6363 token : ${ .headers.authorization }
6464 claimPath : " .custom.department"
65- # Returns: { claims: {...}, result: "engineering" }
65+ # Returns: "engineering"
6666```
6767
6868### Token Format Handling
@@ -75,11 +75,11 @@ document:
7575 version : 1.0.0
7676do :
7777 - parseRawToken :
78- use : jwt-parser
78+ call : jwt-parser
7979 with :
8080 token : " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.signature"
8181 - parseBearerToken :
82- use : jwt-parser
82+ call : jwt-parser
8383 with :
8484 token : " Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.signature"
8585 # Both handle the token format automatically
9494| ` claimPath ` | string | No | jq path expression for specific claim extraction |
9595
9696### Output Structure
97+
98+ ** When ` claimPath ` is NOT provided** (complete payload):
9799``` json
98100{
99- "claims" : {
100- "sub" : " user-123" ,
101- "preferred_username" : " john.doe" ,
102- 103- "exp" : 1234567890 ,
104- "iat" : 1234567800
105- },
106- "result" : " ..." // Complete payload or specific claim based on claimPath
101+ "sub" : " user-123" ,
102+ "preferred_username" : " john.doe" ,
103+ 104+ "exp" : 1234567890 ,
105+ "iat" : 1234567800
107106}
108107```
109108
109+ ** When ` claimPath ` is provided** (specific claim value):
110+ ``` json
111+ " user-123"
112+ ```
113+ or
114+ ``` json
115+ " engineering"
116+ ```
117+
110118## Technical Details
111119
112120### JWT Token Structure
0 commit comments