diff --git a/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlSecurityTokenHandler.cs b/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlSecurityTokenHandler.cs index f3c83b35d1..7eba14fac1 100644 --- a/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlSecurityTokenHandler.cs +++ b/src/Microsoft.IdentityModel.Tokens.Saml/Saml/SamlSecurityTokenHandler.cs @@ -367,14 +367,14 @@ protected virtual SamlConditions CreateConditions(SecurityTokenDescriptor tokenD else if (SetDefaultTimesOnTokenCreation) conditions.NotOnOrAfter = DateTime.UtcNow + TimeSpan.FromMinutes(TokenLifetimeInMinutes); - var uriList = createUriList(tokenDescriptor); + var uriList = CreateUriList(tokenDescriptor); if (!uriList.IsNullOrEmpty()) conditions.Conditions.Add(new SamlAudienceRestrictionCondition(uriList)); return conditions; } - private static List createUriList(SecurityTokenDescriptor tokenDescriptor) + private static List CreateUriList(SecurityTokenDescriptor tokenDescriptor) { var uriList = new List(); if (!tokenDescriptor.Audiences.IsNullOrEmpty()) diff --git a/src/Microsoft.IdentityModel.Tokens/Validators.cs b/src/Microsoft.IdentityModel.Tokens/Validators.cs index 3b841bd2e7..5a5c42171b 100644 --- a/src/Microsoft.IdentityModel.Tokens/Validators.cs +++ b/src/Microsoft.IdentityModel.Tokens/Validators.cs @@ -154,8 +154,8 @@ private static bool AudiencesMatch(TokenValidationParameters validationParameter { if (validAudience.Length == tokenAudience.Length) return string.Equals(validAudience, tokenAudience); - else - return (validationParameters.IgnoreTrailingSlashWhenValidatingAudience && AudiencesMatchIgnoringTrailingSlash(tokenAudience, validAudience)); + + return (validationParameters.IgnoreTrailingSlashWhenValidatingAudience && AudiencesMatchIgnoringTrailingSlash(tokenAudience, validAudience)); } private static bool AudiencesMatchIgnoringTrailingSlash(string tokenAudience, string validAudience) diff --git a/src/System.IdentityModel.Tokens.Jwt/JwtSecurityTokenHandler.cs b/src/System.IdentityModel.Tokens.Jwt/JwtSecurityTokenHandler.cs index 6c4e5d87e2..9c315c7da6 100644 --- a/src/System.IdentityModel.Tokens.Jwt/JwtSecurityTokenHandler.cs +++ b/src/System.IdentityModel.Tokens.Jwt/JwtSecurityTokenHandler.cs @@ -618,18 +618,18 @@ public override SecurityToken CreateToken(SecurityTokenDescriptor tokenDescripto } private JwtSecurityToken CreateJwtSecurityTokenPrivate( - string issuer, - string audience, - ClaimsIdentity subject, - DateTime? notBefore, - DateTime? expires, - DateTime? issuedAt, - SigningCredentials signingCredentials, - EncryptingCredentials encryptingCredentials, - IDictionary claimCollection, - string tokenType, - IDictionary additionalHeaderClaims, - IDictionary additionalInnerHeaderClaims) + string issuer, + string audience, + ClaimsIdentity subject, + DateTime? notBefore, + DateTime? expires, + DateTime? issuedAt, + SigningCredentials signingCredentials, + EncryptingCredentials encryptingCredentials, + IDictionary claimCollection, + string tokenType, + IDictionary additionalHeaderClaims, + IDictionary additionalInnerHeaderClaims) { return CreateJwtSecurityTokenPrivate( issuer, audience, [], subject, notBefore, expires, issuedAt, signingCredentials, encryptingCredentials, diff --git a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/json/JsonWebTokenHandler.cs b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/json/JsonWebTokenHandler.cs index 62947c7ad2..6a6339f5ac 100644 --- a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/json/JsonWebTokenHandler.cs +++ b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/json/JsonWebTokenHandler.cs @@ -359,7 +359,6 @@ public virtual string CreateToken(SecurityTokenDescriptor tokenDescriptor) if (tokenDescriptor.Claims != null && tokenDescriptor.Claims.Count > 0) payload.Merge(JObject.FromObject(tokenDescriptor.Claims), new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Replace }); - // TODO at next major version (8.0) use only Audiences as SecurityTokenDescriptor.Audience will be removed. if (!tokenDescriptor.Audiences.IsNullOrEmpty()) { if (payload.ContainsKey(JwtRegisteredClaimNames.Aud)) diff --git a/test/Microsoft.IdentityModel.SampleTests/SampleTokenValidationClassTests.cs b/test/Microsoft.IdentityModel.SampleTests/SampleTokenValidationClassTests.cs index cd93bb5d97..da2ab2e470 100644 --- a/test/Microsoft.IdentityModel.SampleTests/SampleTokenValidationClassTests.cs +++ b/test/Microsoft.IdentityModel.SampleTests/SampleTokenValidationClassTests.cs @@ -343,7 +343,6 @@ public void TokenWithMissingIssuer_Deprecated() /// /// Tests how the class under test using JwtSecurityTokenHandler handles a token missing the - /// /// claim. /// [Fact]