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

Introduce Jwt.Builder #6851

Closed
jzheaux opened this issue May 9, 2019 · 0 comments
Closed

Introduce Jwt.Builder #6851

jzheaux opened this issue May 9, 2019 · 0 comments
Assignees
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented May 9, 2019

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.

@jzheaux jzheaux added type: enhancement A general enhancement in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) labels May 9, 2019
@jzheaux jzheaux modified the milestones: General Backlog, 5.2.0.M3, 5.2.x May 9, 2019
@jzheaux jzheaux self-assigned this May 13, 2019
jzheaux added a commit that referenced this issue May 22, 2019
Simplified the initial support to introduce fewer classes and only the
features described in the ticket.

Changed tests to align with existing patterns in the repository.

Added JavaDoc to remaining public methods introduced for this feature.

Issue: gh-6634
Issue: gh-6851
@jzheaux jzheaux modified the milestones: 5.2.x, 5.2.0.M3 Jun 13, 2019
This was referenced Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant