Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdecock committed Oct 24, 2024
1 parent 2a9f4d5 commit 14c45f1
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ public async Task validate_iat_when_option_is_set(ExpirationValidationMode mode)
Options.ProofTokenValidityDuration = TimeSpan.FromSeconds(ValidFor);
Options.ClientClockSkew = TimeSpan.FromSeconds(ClockSkew);
Result.IssuedAt = IssuedAt;
if (mode == ExpirationValidationMode.Both)
{
Options.ServerClockSkew = TimeSpan.FromSeconds(ClockSkew);
Result.Nonce = ProofValidator.TestDataProtector.Protect(IssuedAt.ToString());
}

// Adjust time to exactly on the expiration
ProofValidator.TestTimeProvider.SetUtcNow(DateTimeOffset.FromUnixTimeSeconds(IssuedAt + ValidFor + ClockSkew));
Expand All @@ -227,6 +232,10 @@ public async Task validate_nonce_when_option_is_set(ExpirationValidationMode mod
Options.ProofTokenValidityDuration = TimeSpan.FromSeconds(ValidFor);
Options.ServerClockSkew = TimeSpan.FromSeconds(ClockSkew);
Result.Nonce = ProofValidator.TestDataProtector.Protect(IssuedAt.ToString());
if (mode == ExpirationValidationMode.Both)
{
Result.IssuedAt = IssuedAt;
}

// Adjust time to exactly on the expiration
ProofValidator.TestTimeProvider.SetUtcNow(DateTimeOffset.FromUnixTimeSeconds(IssuedAt + ValidFor + ClockSkew));
Expand Down

0 comments on commit 14c45f1

Please sign in to comment.