JWT Decode
Synopsis
Decodes JSON Web Tokens into header, claims, and signature components.
Schema
- jwt_decode:
field: <ident>
target_field: <string>
verify_signature: <boolean>
secret: <string>
algorithm: <string>
extract_claims: <array>
description: <text>
if: <script>
ignore_failure: <boolean>
ignore_missing: <boolean>
on_failure: <processor[]>
on_success: <processor[]>
tag: <string>
Configuration
The following fields are used to define the processor:
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Source field containing JWT token to decode |
target_field | N | {field}_decoded | Target field to store decoded JWT components |
verify_signature | N | false | Verify JWT signature using provided secret |
secret | N | - | Secret key for signature verification |
algorithm | N | HS256 | JWT signing algorithm for verification |
extract_claims | N | - | Array of specific claims to extract to separate fields |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue processing if decoding fails |
ignore_missing | N | false | Skip processing if referenced field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
Decodes JSON Web Tokens (JWT) into their constituent parts: header, payload (claims), and signature. The processor can extract the token structure without verification or optionally verify the signature using a provided secret.
The decoded result includes the header information (algorithm, token type), all claims from the payload, and signature verification status when enabled.
JWT tokens consist of three base64-encoded parts separated by dots: header.payload.signature. The processor decodes each part and presents them in a structured format.
When extract_claims
is specified, the processor creates additional fields for specific claims, making them easily accessible for further processing.
If signature verification is enabled but fails, the processor will still decode the token structure but mark it as invalid. Set ignore_failure
to true
to continue processing invalid tokens.
Examples
Basic JWT Decoding
Decoding JWT token structure... |
|
extracts header and payload: |
|
With Signature Verification
Verifying JWT signature with secret... |
|
includes signature verification: |
|
Extracting Specific Claims
Extracting specific claims to separate fields... |
|
creates fields for extracted claims: |
|
Array of Tokens
Processing multiple JWT tokens... |
|
decodes each token: |
|