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

Builder setters #794

Merged
merged 25 commits into from
Aug 9, 2023
Merged

Builder setters #794

merged 25 commits into from
Aug 9, 2023

Conversation

lhazlewood
Copy link
Contributor

Changed all old set* mutation methods to more modern builder-style methods: e.g setSubject(String) is now subject(String), etc.

This had a better-than-expected impact on improving the readability and cleanliness of the API, making it less verbose, easier to read and more pleasant to work with.

…efix)

- Renamed Keys.forPassword to slightly cleaner/less verbose Keys.password
- Ensured ClaimsMutator extends MapMutator
- Ensured JwtBuilder verifyWith is overloaded and accepts only SecretKey and PublicKey instances
- Ensured JwtBuilder decryptWith is overloaded and accepts only SecretKey and PrivateKey instances
- Renamed JwtParserBuilder#enableUnsecuredJwts() to enableUnsecured() since any JWT or JWS without a header (or with an alg of none) are both considered 'unsecured', so the suffix was removed to avoid confusion.
…ter full replacement idiom confusion (as opposed to add/append)
…utation methods on the JwtBuilder are a little confusing.

- Added JwtBuilder#claims() method that returns a Claims mutator with an and()  method to get back to the JwtBuilder
…tyle name)

- Added a new JwtBuilder#encoder to eventually replace the now-deprecated JwtBuilder#base64UrlEncodeWith method
- Added a new JwtBuilder#serializer to eventually replace the now-deprecated JwtBuilder#serializeToJsonWith method
…decoder

- Renamed JwtParserBuilder#jsonDeserializer to just JwtParserBuilder#deserializer
- Lots of README.md updates to reflect builder api name changes
…upplier#key()

- Renamed KeyPairBuilderSupplier#keyPairBuilder() to less verbose KeyPairBuilderSupplier#keyPair()
…ng/import conflict with io.jsonwebtoken.Header

- Renamed JwtBuilder.Claims to JwtBuilder.BuilderClaims to avoid naming/import conflict with io.jsonwebtoken.Claims
- added generic DynamicJwkBuilder#keyPair(KeyPair) method
- added generic DynamicJwkBuilder#chain method
… transition to 0.12.0, will remove in next release
@lhazlewood lhazlewood merged commit 7ed0b77 into master Aug 9, 2023
@lhazlewood lhazlewood deleted the builder-setters branch August 9, 2023 02:13
@lhazlewood lhazlewood added this to the 0.12.0 milestone Aug 11, 2023
alecharp added a commit to alecharp/plugin-health-scoring that referenced this pull request Oct 9, 2023
The API changes made in jwtk/jjwt#794 were are not ported to GitHub API project.
Until then, the new version cannot be used.
@jglick
Copy link

jglick commented Apr 5, 2024

FYI this change caused considerable headaches for clients. Needing to replace calls to previously deprecated methods before updating to a new release is routine if irritating, but renaming an interface method makes it impossible to write code which works with both the older and newer versions of the library, leading to reflection as in hub4j/github-api#1727. It would be more polite to do #308 first so that @Deprecated default methods could delegate to the new versions, or just keep both versions abstract in the interface for at least one release if the expected implementations are also in the library.

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