Skip to content

Commit

Permalink
formatting fixes/changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLozensky committed Jun 4, 2024
1 parent ca09af8 commit 66e0fd4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Uri> createUriList(SecurityTokenDescriptor tokenDescriptor)
private static List<Uri> CreateUriList(SecurityTokenDescriptor tokenDescriptor)
{
var uriList = new List<Uri>();
if (!tokenDescriptor.Audiences.IsNullOrEmpty())
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.IdentityModel.Tokens/Validators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 12 additions & 12 deletions src/System.IdentityModel.Tokens.Jwt/JwtSecurityTokenHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, object> claimCollection,
string tokenType,
IDictionary<string, object> additionalHeaderClaims,
IDictionary<string, object> additionalInnerHeaderClaims)
string issuer,
string audience,
ClaimsIdentity subject,
DateTime? notBefore,
DateTime? expires,
DateTime? issuedAt,
SigningCredentials signingCredentials,
EncryptingCredentials encryptingCredentials,
IDictionary<string, object> claimCollection,
string tokenType,
IDictionary<string, object> additionalHeaderClaims,
IDictionary<string, object> additionalInnerHeaderClaims)
{
return CreateJwtSecurityTokenPrivate(
issuer, audience, [], subject, notBefore, expires, issuedAt, signingCredentials, encryptingCredentials,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ public void TokenWithMissingIssuer_Deprecated()

/// <summary>
/// Tests how the class under test using JwtSecurityTokenHandler handles a token missing the
///
/// claim.
/// </summary>
[Fact]
Expand Down

0 comments on commit 66e0fd4

Please sign in to comment.