diff --git a/src/Microsoft.IdentityModel.TestExtensions/TestTokenCreator.cs b/src/Microsoft.IdentityModel.TestExtensions/TestTokenCreator.cs
index ace57502c4..5b0db81a15 100644
--- a/src/Microsoft.IdentityModel.TestExtensions/TestTokenCreator.cs
+++ b/src/Microsoft.IdentityModel.TestExtensions/TestTokenCreator.cs
@@ -357,7 +357,7 @@ public SecurityTokenDescriptor CreateTokenDescriptorWithInstanceOverrides()
{
var securityTokenDescriptor = new SecurityTokenDescriptor()
{
- Subject = new ClaimsIdentity(_payloadClaims),
+ Subject = ClaimsIdentityFactory.Create(_payloadClaims),
};
if (!string.IsNullOrEmpty(Issuer))
diff --git a/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlSecurityTokenHandler.cs b/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlSecurityTokenHandler.cs
index 9b70430151..8cc0013ee5 100644
--- a/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlSecurityTokenHandler.cs
+++ b/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlSecurityTokenHandler.cs
@@ -870,7 +870,7 @@ protected virtual void SetDelegateFromAttribute(SamlAttribute attribute, ClaimsI
}
}
- subject.Actor = new ClaimsIdentity(claims, "Federation");
+ subject.Actor = ClaimsIdentityFactory.Create(claims, "Federation");
SetDelegateFromAttribute(actingAsAttribute, subject.Actor, issuer);
}
diff --git a/src/Microsoft.IdentityModel.Tokens.Saml/Saml2/Saml2SecurityTokenHandler.cs b/src/Microsoft.IdentityModel.Tokens.Saml/Saml2/Saml2SecurityTokenHandler.cs
index 4100330a51..5c914442da 100644
--- a/src/Microsoft.IdentityModel.Tokens.Saml/Saml2/Saml2SecurityTokenHandler.cs
+++ b/src/Microsoft.IdentityModel.Tokens.Saml/Saml2/Saml2SecurityTokenHandler.cs
@@ -1122,7 +1122,7 @@ protected virtual void SetClaimsIdentityActorFromAttribute(Saml2Attribute attrib
}
}
- identity.Actor = new ClaimsIdentity(claims);
+ identity.Actor = ClaimsIdentityFactory.Create(claims);
SetClaimsIdentityActorFromAttribute(actorAttribute, identity.Actor, issuer);
}
@@ -1308,6 +1308,7 @@ protected virtual ClaimsIdentity CreateClaimsIdentity(Saml2SecurityToken samlTok
}
var identity = validationParameters.CreateClaimsIdentity(samlToken, actualIssuer);
+
ProcessSubject(samlToken.Assertion.Subject, identity, actualIssuer);
ProcessStatements(samlToken.Assertion.Statements, identity, actualIssuer);
diff --git a/src/Microsoft.IdentityModel.Tokens/AppContextSwitches.cs b/src/Microsoft.IdentityModel.Tokens/AppContextSwitches.cs
new file mode 100644
index 0000000000..865e7d0de0
--- /dev/null
+++ b/src/Microsoft.IdentityModel.Tokens/AppContextSwitches.cs
@@ -0,0 +1,21 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Security.Claims;
+
+namespace Microsoft.IdentityModel.Tokens
+{
+ ///
+ /// AppContext switches for Microsoft.IdentityModel.Tokens and referencing packages.
+ ///
+ internal static class AppContextSwitches
+ {
+ ///
+ /// Enables a new behavior of using instead of globally.
+ ///
+ internal const string UseCaseSensitiveClaimsIdentityTypeSwitch = "Microsoft.IdentityModel.Tokens.UseCaseSensitiveClaimsIdentity";
+
+ internal static bool UseCaseSensitiveClaimsIdentityType() => (AppContext.TryGetSwitch(UseCaseSensitiveClaimsIdentityTypeSwitch, out bool useCaseSensitiveClaimsIdentityType) && useCaseSensitiveClaimsIdentityType);
+ }
+}
diff --git a/src/Microsoft.IdentityModel.Tokens/CaseSensitiveClaimsIdentity.cs b/src/Microsoft.IdentityModel.Tokens/CaseSensitiveClaimsIdentity.cs
new file mode 100644
index 0000000000..1c48b36a2c
--- /dev/null
+++ b/src/Microsoft.IdentityModel.Tokens/CaseSensitiveClaimsIdentity.cs
@@ -0,0 +1,122 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.Security.Claims;
+
+namespace Microsoft.IdentityModel.Tokens
+{
+ ///
+ /// A derived where claim retrieval is case-sensitive. The current retrieves claims in a case-insensitive manner which is different than querying the underlying . The provides consistent retrieval logic between the and .
+ ///
+ public class CaseSensitiveClaimsIdentity : ClaimsIdentity
+ {
+ ///
+ /// Gets the associated with this claims identity.
+ ///
+ public SecurityToken SecurityToken { get; internal set; }
+
+ ///
+ /// Initializes an instance of .
+ ///
+ public CaseSensitiveClaimsIdentity() : base()
+ {
+ }
+
+ ///
+ /// Initializes an instance of .
+ ///
+ /// The authentication method used to establish this identity.
+ public CaseSensitiveClaimsIdentity(string authenticationType) : base(authenticationType)
+ {
+ }
+
+ ///
+ /// Initializes an instance of .
+ ///
+ /// to copy.
+ public CaseSensitiveClaimsIdentity(ClaimsIdentity claimsIdentity) : base(claimsIdentity)
+ {
+ }
+
+ ///
+ /// Initializes an instance of .
+ ///
+ /// associated with this instance.
+ public CaseSensitiveClaimsIdentity(IEnumerable claims) : base(claims)
+ {
+ }
+
+ ///
+ /// Initializes an instance of .
+ ///
+ /// associated with this instance.
+ /// The authentication method used to establish this identity.
+ public CaseSensitiveClaimsIdentity(IEnumerable claims, string authenticationType) : base(claims, authenticationType)
+ {
+ }
+
+ ///
+ /// Initializes an instance of .
+ ///
+ /// associated with this instance.
+ /// The authentication method used to establish this identity.
+ /// The used when obtaining the value of .
+ /// The used when performing logic for .
+ public CaseSensitiveClaimsIdentity(IEnumerable claims, string authenticationType, string nameType, string roleType) :
+ base(claims, authenticationType, nameType, roleType)
+ {
+ }
+
+ ///
+ /// Initializes an instance of .
+ ///
+ /// The authentication method used to establish this identity.
+ /// The used when obtaining the value of .
+ /// The used when performing logic for .
+ public CaseSensitiveClaimsIdentity(string authenticationType, string nameType, string roleType) :
+ base(authenticationType, nameType, roleType)
+ {
+ }
+
+ ///
+ /// Retrieves a where each equals .
+ ///
+ /// The type of the claim to match.
+ /// A of matched claims.
+ /// Comparison is .
+ /// if is null.
+ public override IEnumerable FindAll(string type)
+ {
+ return base.FindAll(claim => claim?.Type.Equals(type, StringComparison.Ordinal) == true);
+ }
+
+ ///
+ /// Retrieves the first where equals .
+ ///
+ /// The type of the claim to match.
+ /// A , if nothing matches.
+ /// Comparison is .
+ /// if is null.
+ public override Claim FindFirst(string type)
+ {
+ return base.FindFirst(claim => claim?.Type.Equals(type, StringComparison.Ordinal) == true);
+ }
+
+ ///
+ /// Determines if a claim with type AND value is contained within this claims identity.
+ ///
+ /// The type of the claim to match.
+ /// The value of the claim to match.
+ /// true if a claim is matched, false otherwise.
+ /// Comparison is for and .
+ /// if is null.
+ /// if is null.
+ public override bool HasClaim(string type, string value)
+ {
+ return base.HasClaim(claim => claim?.Type.Equals(type, StringComparison.Ordinal) == true
+ && claim?.Value.Equals(value, StringComparison.Ordinal) == true);
+ }
+ }
+}
diff --git a/src/Microsoft.IdentityModel.Tokens/ClaimsIdentityFactory.cs b/src/Microsoft.IdentityModel.Tokens/ClaimsIdentityFactory.cs
new file mode 100644
index 0000000000..1f6f56bc74
--- /dev/null
+++ b/src/Microsoft.IdentityModel.Tokens/ClaimsIdentityFactory.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System.Collections.Generic;
+using System.Security.Claims;
+
+namespace Microsoft.IdentityModel.Tokens
+{
+ ///
+ /// Facilitates the creation of and instances based on the .
+ ///
+ internal static class ClaimsIdentityFactory
+ {
+ internal static ClaimsIdentity Create(IEnumerable claims)
+ {
+ if (AppContextSwitches.UseCaseSensitiveClaimsIdentityType())
+ return new CaseSensitiveClaimsIdentity(claims);
+
+ return new ClaimsIdentity(claims);
+ }
+
+ internal static ClaimsIdentity Create(IEnumerable claims, string authenticationType)
+ {
+ if (AppContextSwitches.UseCaseSensitiveClaimsIdentityType())
+ return new CaseSensitiveClaimsIdentity(claims, authenticationType);
+
+ return new ClaimsIdentity(claims, authenticationType);
+ }
+
+ internal static ClaimsIdentity Create(string authenticationType, string nameType, string roleType, SecurityToken securityToken)
+ {
+ if (AppContextSwitches.UseCaseSensitiveClaimsIdentityType())
+ return new CaseSensitiveClaimsIdentity(authenticationType: authenticationType, nameType: nameType, roleType: roleType)
+ {
+ SecurityToken = securityToken,
+ };
+
+ return new ClaimsIdentity(authenticationType: authenticationType, nameType: nameType, roleType: roleType);
+ }
+ }
+}
diff --git a/src/Microsoft.IdentityModel.Tokens/TokenHandler.cs b/src/Microsoft.IdentityModel.Tokens/TokenHandler.cs
index bba4f7c69b..38843534f1 100644
--- a/src/Microsoft.IdentityModel.Tokens/TokenHandler.cs
+++ b/src/Microsoft.IdentityModel.Tokens/TokenHandler.cs
@@ -31,8 +31,8 @@ public abstract class TokenHandler
/// 'value' less than 1.
public virtual int MaximumTokenSizeInBytes
{
- get => _maximumTokenSizeInBytes;
- set => _maximumTokenSizeInBytes = (value < 1) ? throw LogExceptionMessage(new ArgumentOutOfRangeException(nameof(value), FormatInvariant(LogMessages.IDX10101, LogHelper.MarkAsNonPII(value)))) : value;
+ get => _maximumTokenSizeInBytes;
+ set => _maximumTokenSizeInBytes = (value < 1) ? throw LogExceptionMessage(new ArgumentOutOfRangeException(nameof(value), FormatInvariant(LogMessages.IDX10101, MarkAsNonPII(value)))) : value;
}
///
@@ -54,7 +54,6 @@ public int TokenLifetimeInMinutes
}
#region methods
-
///
/// Validates a token.
/// On a validation failure, no exception will be thrown; instead, the exception will be set in the returned TokenValidationResult.Exception property.
diff --git a/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs b/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs
index bb68764a6d..4be594cfde 100644
--- a/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs
+++ b/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs
@@ -255,7 +255,7 @@ public virtual ClaimsIdentity CreateClaimsIdentity(SecurityToken securityToken,
if (LogHelper.IsEnabled(EventLogLevel.Informational))
LogHelper.LogInformation(LogMessages.IDX10245, securityToken);
- return new ClaimsIdentity(authenticationType: AuthenticationType ?? DefaultAuthenticationType, nameType: nameClaimType ?? ClaimsIdentity.DefaultNameClaimType, roleType: roleClaimType ?? ClaimsIdentity.DefaultRoleClaimType);
+ return ClaimsIdentityFactory.Create(authenticationType: AuthenticationType ?? DefaultAuthenticationType, nameType: nameClaimType ?? ClaimsIdentity.DefaultNameClaimType, roleType: roleClaimType ?? ClaimsIdentity.DefaultRoleClaimType, securityToken);
}
///
diff --git a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerClaimsIdentityTests.cs b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerClaimsIdentityTests.cs
new file mode 100644
index 0000000000..e91c6a27b1
--- /dev/null
+++ b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerClaimsIdentityTests.cs
@@ -0,0 +1,74 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Security.Claims;
+using Microsoft.IdentityModel.TestUtils;
+using Microsoft.IdentityModel.Tokens;
+using Xunit;
+
+namespace Microsoft.IdentityModel.JsonWebTokens.Tests
+{
+ [Collection(nameof(JsonWebTokenHandlerClaimsIdentityTests))]
+ public class JsonWebTokenHandlerClaimsIdentityTests
+ {
+ [Fact]
+ public void CreateClaimsIdentity_ReturnsClaimsIdentity_ByDefault()
+ {
+ var handler = new DerivedJsonWebTokenHandler();
+ var jsonWebToken = new JsonWebToken(Default.Jwt(Default.SecurityTokenDescriptor()));
+ var tokenValidationParameters = new TokenValidationParameters();
+
+ var actualClaimsIdentity = handler.CreateClaimsIdentity(jsonWebToken, tokenValidationParameters);
+ Assert.IsType(actualClaimsIdentity);
+
+ actualClaimsIdentity = handler.CreateClaimsIdentity(jsonWebToken, tokenValidationParameters, Default.Issuer);
+ Assert.IsType(actualClaimsIdentity);
+
+ actualClaimsIdentity = handler.CreateClaimsIdentityInternal(jsonWebToken, tokenValidationParameters, Default.Issuer);
+ Assert.IsType(actualClaimsIdentity);
+
+ // This will also test mapped claims flow.
+ handler.MapInboundClaims = true;
+ actualClaimsIdentity = handler.CreateClaimsIdentityInternal(jsonWebToken, tokenValidationParameters, Default.Issuer);
+ Assert.IsType(actualClaimsIdentity);
+ }
+
+ [Fact]
+ public void CreateClaimsIdentity_ReturnsCaseSensitiveClaimsIdentity_WithAppContextSwitch()
+ {
+ AppContext.SetSwitch(AppContextSwitches.UseCaseSensitiveClaimsIdentityTypeSwitch, true);
+
+ var handler = new DerivedJsonWebTokenHandler();
+ var jsonWebToken = new JsonWebToken(Default.Jwt(Default.SecurityTokenDescriptor()));
+ var tokenValidationParameters = new TokenValidationParameters();
+
+ var actualClaimsIdentity = handler.CreateClaimsIdentity(jsonWebToken, tokenValidationParameters);
+ Assert.IsType(actualClaimsIdentity);
+ Assert.NotNull(((CaseSensitiveClaimsIdentity)actualClaimsIdentity).SecurityToken);
+
+ actualClaimsIdentity = handler.CreateClaimsIdentity(jsonWebToken, tokenValidationParameters, Default.Issuer);
+ Assert.IsType(actualClaimsIdentity);
+ Assert.NotNull(((CaseSensitiveClaimsIdentity)actualClaimsIdentity).SecurityToken);
+
+ actualClaimsIdentity = handler.CreateClaimsIdentityInternal(jsonWebToken, tokenValidationParameters, Default.Issuer);
+ Assert.IsType(actualClaimsIdentity);
+ Assert.NotNull(((CaseSensitiveClaimsIdentity)actualClaimsIdentity).SecurityToken);
+
+ // This will also test mapped claims flow.
+ handler.MapInboundClaims = true;
+ actualClaimsIdentity = handler.CreateClaimsIdentityInternal(jsonWebToken, tokenValidationParameters, Default.Issuer);
+ Assert.IsType(actualClaimsIdentity);
+ Assert.NotNull(((CaseSensitiveClaimsIdentity)actualClaimsIdentity).SecurityToken);
+
+ AppContext.SetSwitch(AppContextSwitches.UseCaseSensitiveClaimsIdentityTypeSwitch, false);
+ }
+
+ private class DerivedJsonWebTokenHandler : JsonWebTokenHandler
+ {
+ public new ClaimsIdentity CreateClaimsIdentity(JsonWebToken jwtToken, TokenValidationParameters validationParameters) => base.CreateClaimsIdentity(jwtToken, validationParameters);
+ public new ClaimsIdentity CreateClaimsIdentity(JsonWebToken jwtToken, TokenValidationParameters validationParameters, string issuer) => base.CreateClaimsIdentity(jwtToken, validationParameters, issuer);
+ public new ClaimsIdentity CreateClaimsIdentityInternal(SecurityToken securityToken, TokenValidationParameters tokenValidationParameters, string issuer) => base.CreateClaimsIdentityInternal(securityToken, tokenValidationParameters, issuer);
+ }
+ }
+}
diff --git a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs
index f7b1d7b843..210a2ebcc1 100644
--- a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs
+++ b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs
@@ -538,7 +538,7 @@ public static TheoryData CreateJWEWithAesGcmTheoryData
}
}
- // Tests checks to make sure that the token string created by the JsonWebTokenHandler is consistent with the
+ // Tests checks to make sure that the token string created by the JsonWebTokenHandler is consistent with the
// token string created by the JwtSecurityTokenHandler.
[Theory, MemberData(nameof(CreateJWETheoryData))]
public void CreateJWE(CreateTokenTheoryData theoryData)
@@ -793,7 +793,7 @@ public static TheoryData SecurityTokenDecryptionTheoryDat
}
}
- // Tests checks to make sure that the token string (JWE) created by calling
+ // Tests checks to make sure that the token string (JWE) created by calling
// CreateToken(string payload, SigningCredentials signingCredentials, EncryptingCredentials encryptingCredentials)
// is equivalent to the token string created by calling CreateToken(SecurityTokenDescriptor tokenDescriptor).
[Theory, MemberData(nameof(CreateJWEUsingSecurityTokenDescriptorTheoryData))]
@@ -1149,7 +1149,7 @@ public static TheoryData CreateJWEUsingSecurityTokenDescr
}
}
- // Tests checks to make sure that the token string created by the JsonWebTokenHandler is consistent with the
+ // Tests checks to make sure that the token string created by the JsonWebTokenHandler is consistent with the
// token string created by the JwtSecurityTokenHandler.
[Theory, MemberData(nameof(CreateJWSTheoryData))]
public void CreateJWS(CreateTokenTheoryData theoryData)
@@ -2007,7 +2007,7 @@ public static TheoryData CreateJWSUsingSecurityTokenDescr
{
// Test checks that the values in SecurityTokenDescriptor.Subject.Claims
// are properly combined with those specified in SecurityTokenDescriptor.Claims.
- // Duplicate values (if present with different case) should not be overridden.
+ // Duplicate values (if present with different case) should not be overridden.
// For example, the 'aud' claim on TokenDescriptor.Claims will not be overridden
// by the 'AUD' claim on TokenDescriptor.Subject.Claims, but the 'exp' claim will.
new CreateTokenTheoryData("TokenDescriptorWithBothSubjectAndClaims")
@@ -2476,7 +2476,7 @@ public async Task AdditionalHeaderValues()
// Test checks to make sure that the token payload retrieved from ValidateToken is the same as the payload
- // the token was initially created with.
+ // the token was initially created with.
[Fact]
public void RoundTripJWS()
{
@@ -3004,7 +3004,7 @@ public async Task ValidateJsonWebTokenClaimMapping()
TestUtilities.AssertFailIfErrors(context);
}
- // Test shows if the JwtSecurityTokenHandler has mapping OFF and
+ // Test shows if the JwtSecurityTokenHandler has mapping OFF and
// the JsonWebTokenHandler has mapping ON,the claims are different.
[Fact]
public async Task ValidateDifferentClaimsBetweenHandlers()
diff --git a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs
index 08644135d1..d1f6fd6ad7 100644
--- a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs
+++ b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTests.cs
@@ -116,7 +116,7 @@ public void JWETouchAllProperties()
TestUtilities.AssertFailIfErrors(context);
}
- // Test checks to make sure that the JsonWebToken.GetClaim() method is able to retrieve every Claim returned by the Claims property (with the exception
+ // Test checks to make sure that the JsonWebToken.GetClaim() method is able to retrieve every Claim returned by the Claims property (with the exception
// of Claims that are JObjects or arrays, as those are converted to strings by the GetClaim() method).
[Fact]
public void CompareGetClaimAndClaims()
diff --git a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JwtTokenUtilitiesTests.cs b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JwtTokenUtilitiesTests.cs
index e33b7d78d5..d8d764085e 100644
--- a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JwtTokenUtilitiesTests.cs
+++ b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JwtTokenUtilitiesTests.cs
@@ -19,7 +19,7 @@ public class JwtTokenUtilitiesTests
{
// Used for formatting a message for testing with one parameter.
private const string TestMessageOneParam = "This is the parameter: '{0}'.";
-
+
[Fact]
public void LogSecurityArtifactTest()
{
diff --git a/test/Microsoft.IdentityModel.Protocols.WsFederation.Tests/WsFederationMessageTests.cs b/test/Microsoft.IdentityModel.Protocols.WsFederation.Tests/WsFederationMessageTests.cs
index 56e528849f..b3b6aab8f4 100644
--- a/test/Microsoft.IdentityModel.Protocols.WsFederation.Tests/WsFederationMessageTests.cs
+++ b/test/Microsoft.IdentityModel.Protocols.WsFederation.Tests/WsFederationMessageTests.cs
@@ -474,7 +474,7 @@ public static TheoryData GetTokenParsingStringDat
TestId = nameof(ReferenceXml.WresultWsTrust14WithoutNamespaceUnusualSpacing)
},
// these tests show that one shouldn't rely on parsing the Wresult alone as
- // the following Wresult's should error. The correct pattern is to call GetToken() or GetTokenUsingXmlReader() to ensure
+ // the following Wresult's should error. The correct pattern is to call GetToken() or GetTokenUsingXmlReader() to ensure
// the Wresult is well formed.
new WsFederationMessageTheoryData
{
diff --git a/test/Microsoft.IdentityModel.TestUtils/ClaimSets.cs b/test/Microsoft.IdentityModel.TestUtils/ClaimSets.cs
index 703e9eabd7..6b5fd051bf 100644
--- a/test/Microsoft.IdentityModel.TestUtils/ClaimSets.cs
+++ b/test/Microsoft.IdentityModel.TestUtils/ClaimSets.cs
@@ -297,7 +297,7 @@ public static List Simple(string issuer, string originalIssuer)
public static IEnumerable SimpleShortClaimtypes(string issuer, string originalIssuer)
{
return new List()
- {
+ {
NewClaimWithShortType(ClaimTypes.Country, "USA", ClaimValueTypes.String, issuer ?? Default.Issuer, originalIssuer ?? Default.OriginalIssuer),
NewClaimWithShortType(ClaimTypes.Email, "user@contoso.com", ClaimValueTypes.String, issuer ?? Default.Issuer, originalIssuer ?? Default.OriginalIssuer),
NewClaimWithShortType(ClaimTypes.GivenName, "Tony", ClaimValueTypes.String, issuer ?? Default.Issuer, originalIssuer ?? Default.OriginalIssuer ),
@@ -376,7 +376,7 @@ public static List DuplicateTypes()
{
return DuplicateTypes(Default.Issuer, Default.Issuer);
}
-
+
///
/// Returns an enumeration containing duplicate claims. Used to test duplicates.
///
diff --git a/test/Microsoft.IdentityModel.TestUtils/IdentityComparer.cs b/test/Microsoft.IdentityModel.TestUtils/IdentityComparer.cs
index 753b97efad..a9fac40796 100644
--- a/test/Microsoft.IdentityModel.TestUtils/IdentityComparer.cs
+++ b/test/Microsoft.IdentityModel.TestUtils/IdentityComparer.cs
@@ -44,6 +44,7 @@ public class IdentityComparer
{ typeof(CanonicalizingTransfrom).ToString(), CompareAllPublicProperties },
{ typeof(Claim).ToString(), CompareAllPublicProperties },
{ typeof(ClaimsIdentity).ToString(), CompareAllPublicProperties },
+ { typeof(CaseSensitiveClaimsIdentity).ToString(), CompareAllPublicProperties },
{ typeof(ClaimsPrincipal).ToString(), CompareAllPublicProperties },
{ typeof(Collection).ToString(), ContinueCheckingEquality },
{ typeof(DateTime).ToString(), AreDateTimesEqual },
@@ -54,6 +55,7 @@ public class IdentityComparer
{ typeof(IDictionary).ToString(), AreStringDictionariesEqual},
{ typeof(IEnumerable).ToString(), AreClaimsEnumsEqual },
{ typeof(IEnumerable).ToString(), AreClaimsIdentitiesEnumsEqual },
+ { typeof(IEnumerable).ToString(), AreClaimsIdentitiesEnumsEqual },
{ typeof(IEnumerable