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

Suggestion to create method withPayload in JWTCreator.java #445

Closed
onmax opened this issue Oct 7, 2020 · 3 comments · Fixed by #475
Closed

Suggestion to create method withPayload in JWTCreator.java #445

onmax opened this issue Oct 7, 2020 · 3 comments · Fixed by #475
Assignees
Labels
feature request A feature has been asked for or suggested by the community

Comments

@onmax
Copy link

onmax commented Oct 7, 2020

Description

Rigth now, I have my own implementation of a JWT with its own Header and Payload class. But, I am struggling with signing, decoding and verifying the JWT so I have decided to use an external library like this one. As I said, I already have my own payload (and it is kind of extensive), it has a lot of keys and values. Some of them are JSONObjects so if I want to use this library I just can't initialize JWTCreator because I don't have the function withClaim(String name, Object value) in this file.

So, it is a reason for this? I suggest create a new method similar to withHeader but for the payload.

Maybe there is another solution that I don't know so this change is unnecessary.

If you think this is a good idea, I am up to make the change and create the tests

@onmax
Copy link
Author

onmax commented Oct 9, 2020

Hey, any comment on this?

@JordiGiros
Copy link

I'm struggling with the same problem. I read my own Payload from a json file and I have a lot of keys and values. I was looking for an approach with a map, but there is no way to pass a map to the claims without setting a "name" to that...

@jimmyjames jimmyjames self-assigned this Nov 5, 2020
@jimmyjames jimmyjames added the needs investigation An issue that has more questions to answer or otherwise needs work to fully understand the issue label Nov 5, 2020
@jimmyjames
Copy link
Contributor

Thanks for the request, I think this makes sense to add.

We've added this to our backlog, to add a method withPayload that accepts of a map of claim names -> values. In the meantime, would be happy to review or discuss specifics if someone is interested in making a PR. We'll need to ensure that we're consistent with how we validate the claims (non-null claim name, valid object types for serialization purposes, etc), and verify/document behavior if calling this new method and the other withClaim methods.

/cc @lbalmaceda

@jimmyjames jimmyjames added feature request A feature has been asked for or suggested by the community and removed needs investigation An issue that has more questions to answer or otherwise needs work to fully understand the issue labels Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A feature has been asked for or suggested by the community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants