Additional JWT Security Token Support #1337

Merged
merged 1 commit into from Oct 29, 2014

Conversation

Projects
None yet
4 participants
@RyanMelenaNoesis
Contributor

RyanMelenaNoesis commented Oct 14, 2014

Updates to support for JWT based authentication (primarily around JWT decoding/decryption and claims checking)

@monoadmin

This comment has been minimized.

Show comment
Hide comment
@monoadmin

monoadmin Oct 14, 2014

Hello! I'm the build bot for the Mono project. I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done. Contributors can ignore this message.

Hello! I'm the build bot for the Mono project. I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done. Contributors can ignore this message.

+
+namespace System.IdentityModel.Tokens
+{
+ public class SecurityTokenExpiredException : SecurityTokenValidationException

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Implement missing exception

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Implement missing exception

+
+namespace System.IdentityModel.Tokens
+{
+ public class SecurityTokenNotYetValidException : SecurityTokenValidationException

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Implement missing exception

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Implement missing exception

+
+namespace System.IdentityModel.Tokens
+{
+ public class SecurityTokenReplayDetectedException : SecurityTokenValidationException

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Implement missing exception

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Implement missing exception

+
+namespace System.IdentityModel
+{
+ public class SignatureVerificationFailedException : Exception

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Implement missing exception

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Implement missing exception

+ if (obj == null)
+ return Activator.CreateInstance (targetType);
+
+ return ConvertToType (obj, targetType);

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Convert object before returning to avoid error when calling code attempts to cast

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Convert object before returning to avoid error when calling code attempts to cast

This comment has been minimized.

@migueldeicaza

migueldeicaza Oct 20, 2014

Member

Can we have a test case showing this scenario?

@migueldeicaza

migueldeicaza Oct 20, 2014

Member

Can we have a test case showing this scenario?

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 20, 2014

Contributor

Added unit test for non-generic Deserialize overload

@RyanMelenaNoesis

RyanMelenaNoesis Oct 20, 2014

Contributor

Added unit test for non-generic Deserialize overload

@@ -833,7 +833,7 @@ bool ProcessCharacter (char ch)
void CreateArray ()
{
- var arr = new ArrayList ();
+ var arr = new List <object> ();

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Make compatible with MS claims processing code which apparently assumes deserialized json collection can be cast to IEnumerable<object>

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Make compatible with MS claims processing code which apparently assumes deserialized json collection can be cast to IEnumerable<object>

@@ -58,6 +58,9 @@ public Claim (string type, string value, string valueType, string issuer, string
throw new ArgumentNullException ("type");
if (value == null)
throw new ArgumentNullException ("value");
+
+ Properties = new Dictionary <string, string> ();

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Make compatible with MS code that seems to assume Properties dictionary is initialized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 14, 2014

Contributor

Make compatible with MS code that seems to assume Properties dictionary is initialized.

@migueldeicaza

This comment has been minimized.

Show comment
Hide comment
@migueldeicaza

migueldeicaza Oct 20, 2014

Member

Please notify mono-deve-list and discuss this PR there.

Member

migueldeicaza commented Oct 20, 2014

Please notify mono-deve-list and discuss this PR there.

@migueldeicaza

View changes

mcs/class/System.IdentityModel/System.IdentityModel-net_4_5.csproj
- </Target>
- -->
- <PropertyGroup>
+<?xml version="1.0" encoding="utf-8"?>

This comment has been minimized.

@migueldeicaza

migueldeicaza Oct 20, 2014

Member

Whitespace change, please resubmit once this is fixed, and squash the commits (so we do not end up nuking the file history with the two changes).

@migueldeicaza

migueldeicaza Oct 20, 2014

Member

Whitespace change, please resubmit once this is fixed, and squash the commits (so we do not end up nuking the file history with the two changes).

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Oct 20, 2014

Contributor

Line endings corrected

@RyanMelenaNoesis

RyanMelenaNoesis Oct 20, 2014

Contributor

Line endings corrected

Additional JWT Security Token Support
Fix line endings.  Add test for JavaScriptSerializer.Deserialize(string input, Type targetType).

migueldeicaza added a commit that referenced this pull request Oct 29, 2014

Merge pull request #1337 from RyanMelenaNoesis/master
Additional JWT Security Token Support

@migueldeicaza migueldeicaza merged commit c265540 into mono:master Oct 29, 2014

@akoeplinger

This comment has been minimized.

Show comment
Hide comment
@akoeplinger

akoeplinger Oct 30, 2014

Member

This breaks a bunch of tests:

MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.DeserializeDictionaryOfArrayList
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.DeserializeObject
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.InfinityAndNaN
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestDeserialize
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestDeserializeConverter1
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestDeserializeNonGenericOverload
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestDeserializeTypeResolver
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestSerialize1 
Member

akoeplinger commented Oct 30, 2014

This breaks a bunch of tests:

MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.DeserializeDictionaryOfArrayList
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.DeserializeObject
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.InfinityAndNaN
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestDeserialize
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestDeserializeConverter1
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestDeserializeNonGenericOverload
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestDeserializeTypeResolver
MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest.TestSerialize1 
@RyanMelenaNoesis

This comment has been minimized.

Show comment
Hide comment
@RyanMelenaNoesis

RyanMelenaNoesis Oct 30, 2014

Contributor

Unit Test issues corrected in PR #1380

Contributor

RyanMelenaNoesis commented Oct 30, 2014

Unit Test issues corrected in PR #1380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment