Skip to content

Conversation

@stuioco
Copy link
Contributor

@stuioco stuioco commented Nov 20, 2025

A new templating function to decode a JWT and return the result of a JsonPath query over it.

@stuioco stuioco requested a review from tommysitu November 20, 2025 14:48
Copy link
Member

@tommysitu tommysitu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, just one nit

Comment on lines +638 to +650
decode := func(seg string) (interface{}, bool) {
b, err := base64.RawURLEncoding.DecodeString(seg)
if err != nil {
log.Error("error decoding jwt segment: ", err)
return nil, false
}
var v interface{}
if err := json.Unmarshal(b, &v); err != nil {
log.Error("error unmarshalling jwt segment: ", err)
return nil, false
}
return v, true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be a reusable function rather than declaring it every time.

@tommysitu tommysitu merged commit 106e72c into master Nov 24, 2025
4 checks passed
@tommysitu tommysitu deleted the feature/jwt-json-from-header branch November 24, 2025 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants