dvsekhvalnov / jose-pcl

Experimental jose-rt implementation based on PCLCrypto library
MIT License
11 stars 6 forks source link

Port two-phase validation helpers from main lib #3

Open luisgoncalves opened 8 years ago

luisgoncalves commented 8 years ago

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 for Decode.

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.

luisgoncalves commented 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...

dvsekhvalnov commented 8 years ago

Hi, @luisgoncalves , yeah i would path both: header dictionary and byte[]/string payload. Just to be generic as possible.

luisgoncalves commented 8 years ago

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:

What are your thoughts on this?

dvsekhvalnov commented 8 years ago

@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.

luisgoncalves commented 8 years ago

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!

luisgoncalves commented 7 years ago

Just wondering if you were able to take a look at this? :)

dvsekhvalnov commented 7 years ago

Well, no :) i finally went to vacation this year. Totally forgot.

Feel free to add this if still needed, i'll merge :)