Skip to content

Commit

Permalink
Merge pull request #1635 from SimonCropp/remove-redundant-list-and-ex…
Browse files Browse the repository at this point in the history
…pression-alloc-in-SecretValidator.ValidateAsync

remove redundant list and expression alloc in SecretValidator.ValidateAsync
  • Loading branch information
josephdecock authored Dec 10, 2024
2 parents f4f0478 + 0489e10 commit c5dbbf9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/IdentityServer/Validation/Default/SecretValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ public async Task<SecretValidationResult> ValidateAsync(IEnumerable<Secret> secr
{
var secretsArray = secrets as Secret[] ?? secrets.ToArray();

var expiredSecrets = secretsArray.Where(s => s.Expiration.HasExpired(_clock.UtcNow.UtcDateTime)).ToList();
if (expiredSecrets.Any())
foreach (var expired in secretsArray.Where(s => s.Expiration.HasExpired(_clock.UtcNow.UtcDateTime)))
{
expiredSecrets.ForEach(
ex => _logger.LogInformation("Secret [{description}] is expired", ex.Description ?? "no description"));
_logger.LogInformation("Secret [{description}] is expired", expired.Description ?? "no description");
}

var currentSecrets = secretsArray.Where(s => !s.Expiration.HasExpired(_clock.UtcNow.UtcDateTime)).ToArray();
Expand Down

0 comments on commit c5dbbf9

Please sign in to comment.