Skip to content

Conversation

@netlify
Copy link

netlify bot commented Sep 11, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 5fa46fa
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/68c2dd6809cbed0008f03168
😎 Deploy Preview https://deploy-preview-7893--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Member

@philipaconrad philipaconrad left a comment

Choose a reason for hiding this comment

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

@charlieegan3, these examples are absolutely gorgeous when rendered. I have no quibbles with the content-- I read through all three languages for each example, and the code looks pretty reasonable and/or idiomatic for each language, I think.

The only gripes I foresee will be from folks who have a favorite library that does some/all of an example's validation tasks. For folks rolling fairly vanilla validation and authz code without libraries, these examples should map pretty closely to the level of verbosity they will see in the wild.

I'm marking Approve, because I think this is a solid upgrade for the docs site. One small review comment follows below, just a remark on an example that tripped me up at first:

return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
}

return []byte("pa$$w0rd"), nil
Copy link
Member

Choose a reason for hiding this comment

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

I found this function to be a bit inscrutable on its own, and the docs site for golang-jwt/jwt wasn't exactly helpful. However, one of their HMAC examples demonstrates that the func(token *jwt.Token) func exists to extract a secret from the token. This explains what's going on here: the function in this example just hardcodes the returned secret for demonstration purposes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review Philip, I did leave a comment for this hard coded password on the java example since it was b64 encoded.

I have in each JWT example tried to use a commonly used package for the code, but perhaps developers are used to even higher level functions.

do you think it warrants a disclaimer of some sort? If so, do you have common libraries in mind that might be good to reference. I suppose we have lib.jwt on the OPA side too if we wanted to do a higher level comparison. https://github.com/StyraOSS/lib.jwt

@srenatus srenatus merged commit fce128d into open-policy-agent:main Sep 12, 2025
20 checks passed
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