Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default constructor for jwks object #346

Merged
merged 9 commits into from
Apr 24, 2024

Conversation

justend29
Copy link
Contributor

@justend29 justend29 commented Apr 21, 2024

I appreciate the design to always uphold the invariants of every type.
For jwt::jwks, which is an object holding a collection of jwks, constructing an empty collection of jwks is valid and maintains the invariants of the type.
The motivation for this is encapsulating jwt::jwks in a caching class, where JWKs are often cached with periodic refreshing. There aren't any keys until fetched from issuer. I found myself doing jwt::jwks{"{\"keys\":[]}"} since there wasn't a default constructor, which feels silly.

@justend29
Copy link
Contributor Author

whoever created the CI job to not only indicate exactly where the lining error is, but also generate a patch file and sample commands to apply it deserves a gold star.

@prince-chrismc
Copy link
Collaborator

also generate a patch file and sample commands to apply it deserves a gold star.

⭐ appreciate it 🙏

@prince-chrismc
Copy link
Collaborator

It would be amazing to have a test to help ensure this behavior is maintained :)

Similar to

https://github.com/prince-chrismc/jwt-cpp/blob/e9cd684d027eb40396f2db6b07f41275415806a4/tests/JwksTest.cpp#L55

But just check the list empty (you might need to usenthe itors to count)

@justend29
Copy link
Contributor Author

@prince-chrismc I shouldn't have made the PR w/o a test. It's in.

@prince-chrismc prince-chrismc merged commit 461162c into Thalhammer:master Apr 24, 2024
58 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.

2 participants