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

JwtPayload.Claims broken in Mono #153

Closed
wants to merge 1 commit into from
Closed

Conversation

ryan1234
Copy link

In Windows, JwtPayload.Claims works fine. If a JWT claim has an array of strings, for example, "scope": ["openid", "email", "profiles"], it decomposes them fine. One claim is turned into three.

With Mono however (4.0.1), the claim value is treated as an ArrayList, so it doesn't match IEnumerable and thus falls through to being serialized as JSON.

This PR works on Mono and is pretty simple. I just added a check for the ArrayList type and then mimicked the IEnumerable decomposition.

If it's too big of a change, I'm at least hoping it starts a discussion on how to fix claims for use with Mono.

  

In Windows, JwtPayload.Claims works fine. If a JWT claim has an array of strings, for example, "scope": ["openid", "email", "profiles"], it decomposes them fine. One claim is turned into three.

With Mono however (4.0.1), the claim value is treated as an ArrayList, so it doesn't match IEnumerable<Object> and thus falls through to being serialized as JSON.

This PR works on Mono and is pretty simple. I just added a check for the ArrayList type and then mimicked the IEnumerable decomposition.

If it's too big of a change, I'm at least hoping it starts a discussion on how to fix claims for use with Mono.
@ghost
Copy link

ghost commented May 25, 2015

Hi @ryan1234, I'm your friendly neighborhood Microsoft Open Technologies, Inc. Pull Request Bot (You can call me MSOTBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla2.msopentech.com.

TTYL, MSOTBOT;

@ghost
Copy link

ghost commented May 25, 2015

@ryan1234, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, MSOTBOT;

@ghost ghost added cla-signed and removed cla-required labels May 25, 2015
@ryan1234
Copy link
Author

Sorry this should have been done against dev.

@ryan1234 ryan1234 closed this May 27, 2015
@ryan1234 ryan1234 deleted the patch-2 branch May 27, 2015 16:09
@jonathankarsh
Copy link

Just adding a reference to the applied patches: #160 and #161
Thanks @ryan1234 for pushing this through, wish we could get this working on mono 3.12.1 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants