Closed
Description
Since there are many aspects to building a Jwt
, it'd be nice to have a builder to simplify that work:
Jwt jwt = Jwt.withTokenValue("token")
.header("alg", JwsAlgorithms.RS256)
.claim(ISS, URI.create("https://idp.example.org"))
.build();
The builder would contain at least four configuration methods:
header(name, value) // adds a header
headers(headers) // sets the header map
claim(name, value) // add a claim
claims(claims) // sets the claim map
And would be inlined in Jwt
, as the code does with other builders like ClientRegistration.Builder
.
To assist with type coherence, it could also have helper methods for the claims specified in RFC 7519.
Finally, it would be helpful to prove out the abstraction by updating NimbusJwtDecoder
and NimbusReactiveJwtDecoder
to use it.