-
Notifications
You must be signed in to change notification settings - Fork 48
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
Consistent Injection combinations of Claims #222
Comments
@radcortez What is the problem with having the claims converted to JsonValue/Array/Object and then provide the conversion when needed ? This conversion from |
No problem at all. Right now the missing piece is conversion from the type stored in the claimSet (usually JsonValue) to another supported type when injection uses a ClaimValue wrapper. For instance, you can see conversions being done here: And that is why injection of But there is no equivalent conversion code here: So when you try to inject a What we need is to determine the right type of |
@radcortez can we keep the injection type available in the constructor and do the conversion from JsonValue/etc in |
Here is the code that I've written to fix the issue previously: I believe I've done that. Just an additional method to unwrap the type in the constructor. And then |
@radcortez Cool, told you it would be easier for me to grok the changes if we go the smaller PR way :-). |
…ed types of Claims.
Done in #226. |
…ed types of Claims.
…ed types of Claims.
There are multiple ways to inject values from a
JWT
. From the latest MP JWT Spec, the following injection combinations must be supported (usingLong
as an example):There is also valid for other types like
Boolean
,String
and correspondingJsonValue
types. In #218, we realized that SmallRye JWT is not covering all cases and should be more consistent in how injection is done for the multiple combinations. The current implementation is able to handle the following injection combinations:long
Long
ClaimValue<Long>
Optional<Long>
ClaimValue<Optional<Long>>
JsonNumber
Optional<JsonNumber>
ClaimValue<JsonNumber>
ClaimValue<Optional<JsonNumber>>
The main reason for injection to fail is a
ClassCastException
because values in theclaimSet
are usually stored as aJsonValue
(except if it is a known claim and the type is set in theClaims
enum).So we need to determine the right type at injection point and then provide a conversion if required so the types match and injection work.
The text was updated successfully, but these errors were encountered: