Support JWT functionality in System.IdentityModel.Tokens.Jwt #1236

Merged
merged 4 commits into from Aug 28, 2014

Conversation

Projects
None yet
4 participants
@RyanMelenaNoesis
Contributor

RyanMelenaNoesis commented Aug 28, 2014

Minimal implementation of classes and methods necessary to support the JWT functionality in System.IdentityModel.Tokens.Jwt (https://github.com/MSOpenTech/azure-activedirectory-identitymodel-extensions-for-dotnet)

@monoadmin

This comment has been minimized.

Show comment
Hide comment
@monoadmin

monoadmin Aug 28, 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.

@@ -203,6 +203,10 @@ object ConvertToType (object obj, Type targetType)
return ConvertToType<T> (DeserializeObjectInternal(input));
}
+ public object Deserialize (string input, Type targetType) {

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Add missing Deserialize overload

@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Add missing Deserialize overload

@@ -84,24 +84,62 @@ public X509AsymmetricSecurityKey (X509Certificate2 certificate)
switch (algorithm) {
//case SignedXml.XmlDsigDSAUrl: // it is documented as supported, but it isn't in reality and it wouldn't be possible.
case SignedXml.XmlDsigRSASHA1Url:
- return new HMACSHA1 ();
+ return new SHA1Managed ();

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Use correct hashing algorithm

@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Use correct hashing algorithm

case SecurityAlgorithms.RsaSha256Signature:
- return new HMACSHA256 ();
+ return new SHA256Managed ();

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Use correct hashing algorithm

@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Use correct hashing algorithm

@@ -68,6 +68,8 @@ protected SecurityKeyIdentifierClause (string clauseType, byte [] derivationNonc
return nonce != null ? (byte []) nonce.Clone () : null;
}
+ public string Id { get; set; }

This comment has been minimized.

@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Add missing property

@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Add missing property

alexischr added a commit that referenced this pull request Aug 28, 2014

Merge pull request #1236 from NoesisLabs/master
Support JWT functionality in System.IdentityModel.Tokens.Jwt

@alexischr alexischr merged commit b27c2d6 into mono:master Aug 28, 2014

@akoeplinger

This comment has been minimized.

Show comment
Hide comment
@akoeplinger

akoeplinger Aug 28, 2014

Member

@alexischr This broke the build:

Test/System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs(248,5): error CS0433: The imported type `System.ServiceModel.Security.X509CertificateValidationMode' is defined multiple times
/var/lib/jenkins/workspace/test-mono-mainline/label/debian-amd64/mcs/class/System.ServiceModel/./../../class/lib/net_4_5/System.ServiceModel.dll (Location of the symbol related to previous error)
./../../class/lib/net_4_5/System.IdentityModel.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 4 warnings
Member

akoeplinger commented Aug 28, 2014

@alexischr This broke the build:

Test/System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs(248,5): error CS0433: The imported type `System.ServiceModel.Security.X509CertificateValidationMode' is defined multiple times
/var/lib/jenkins/workspace/test-mono-mainline/label/debian-amd64/mcs/class/System.ServiceModel/./../../class/lib/net_4_5/System.ServiceModel.dll (Location of the symbol related to previous error)
./../../class/lib/net_4_5/System.IdentityModel.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 4 warnings
@RyanMelenaNoesis

This comment has been minimized.

Show comment
Hide comment
@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

This is a strange situation where the enum in question X509CertificateValidationMode has a namespace of: System.ServiceModel.Security but resides in the assembly: System.IdentityModel.dll

It looks like we somehow missed the fact that there already exists an implementation in mono / mcs / class / System.ServiceModel / System.ServiceModel / AllEnums.cs

How would you suggest correcting this duplication, keeping the original or the new file?

Sorry for the issue, we'll correct it as soon as we get direction on the previous question.

Contributor

RyanMelenaNoesis commented Aug 28, 2014

This is a strange situation where the enum in question X509CertificateValidationMode has a namespace of: System.ServiceModel.Security but resides in the assembly: System.IdentityModel.dll

It looks like we somehow missed the fact that there already exists an implementation in mono / mcs / class / System.ServiceModel / System.ServiceModel / AllEnums.cs

How would you suggest correcting this duplication, keeping the original or the new file?

Sorry for the issue, we'll correct it as soon as we get direction on the previous question.

@RyanMelenaNoesis

This comment has been minimized.

Show comment
Hide comment
@RyanMelenaNoesis

RyanMelenaNoesis Aug 28, 2014

Contributor

Just discovered that this is due to the enum being moved between assemblies between .NET 4.0 and .NET 4.5. Adding necessary pragmas to both files to correct this issue, will issue a new pull request shortly.

Contributor

RyanMelenaNoesis commented Aug 28, 2014

Just discovered that this is due to the enum being moved between assemblies between .NET 4.0 and .NET 4.5. Adding necessary pragmas to both files to correct this issue, will issue a new pull request shortly.

@RyanMelenaNoesis

This comment has been minimized.

Show comment
Hide comment
Contributor

RyanMelenaNoesis commented Aug 29, 2014

New pull request submitted ( https://github.com/mono/mono/pull/1240/files )

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