Open luisgoncalves opened 8 years ago
@dvsekhvalnov I'll probably do this enhancement. I was thinking about an overload for Decode
with a callback that gets the headers on the form of IDictionary<string, object>
. Do you think it's worthy to also passing in the payload? You have that on jose2go...
Hi, @luisgoncalves , yeah i would path both: header dictionary and byte[]/string payload. Just to be generic as possible.
I was just wondering if the IDictionary<string, object>
is sufficient... For header fields whose value is a string, it should be OK (with a cast), but for complex header values (such as jwk
) deserializing with JSON.NET will create a JObject... but the dictionary doesn't expose that and consumers can't do much. A few ideas:
JObject
instead of IDictionary<string, object>
: would make the dependency on JSON.NET externally visible.IDictionary<string, dynamic>
: not sure this is valid and whether it is supported on PCL/all platforms.IDictionary<string, object>
: something like headers.Value<T>("key")
. T could be a primitive type or a complex type provided by the consumer. This implies that T can be deserialized (proper member names and so)... but I think that's not too bad.What are your thoughts on this?
@luisgoncalves ,
damn sorry, totally missed your comment.. Json.NET can deserialize nested maps, see here https://github.com/dvsekhvalnov/jose-jwt/blob/master/jose-jwt/json/NewtonsoftMapper.cs
I wanted to ask how you guys doing with enhancement? I have some time, probably can handle it myself if nothing was implemented yet.
Ah of course! Registering a converter to get the nesting. I was actually waiting on your feedback :) If you have the time maybe it's better that you implement it. I'll integrate it on OpenIdClient afterwards. Thanks!
Just wondering if you were able to take a look at this? :)
Well, no :) i finally went to vacation this year. Totally forgot.
Feel free to add this if still needed, i'll merge :)
As discussed on IdentityModel/IdentityModel.OidcClient#12 it'd be nice to have the
Headers
helper on the PCL in order to select the appropriate key forDecode
.In addition (or alternative?),
Decode
could have an overload that gets a callback for key selection, similar to https://github.com/dvsekhvalnov/jose2go#two-phase-validation.