Closed victornoel closed 5 years ago
(ps: I can do a PR :)
I'm not familiar with the Predicate
class but I guess it's Java 8. Adding that would break existing JDK7 users. This is also not a common case. It might be for arrays but not for maps. I'll leave this suggestion open for the next major though👌
Today, you can do the extra check right after the token signature and typical claims are verified.
Verify -> get claim as -> assert contains value
@lbalmaceda it doesn't have to be the actual Predicate
class: you can introduce your own for this purpose. The important thing is for it to have only one method, so that Java 8 users can use lambdas.
Until then, I will use the method you propose :)
@lbalmaceda actually it's not very nice, because I don't create the verifier in the same place where I use it, and I need to setup the constraints when I create it. It means I have to introduce another abstraction to be able to do that.
How about using this custom validator I just created? https://github.com/auth0/java-jwt/pull/290
@rocketraman great!
That's exactly what I had in mind @lbalmaceda :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇♂️
In the JWT token I use, there is a claim that can contains multiple values (it's not an array, but it's not the problem here).
I'm facing a problem because I would like to be able to validate that one value is present, not that the scope completely equals a certain string.
It would thus be great if I could write:
So that
withClaim
could take aPredicate<String>
(and also the other available types).