diff --git a/test/AspNetCore.Authentication.JwtBearer.Tests/DPoP/FreshnessTests.cs b/test/AspNetCore.Authentication.JwtBearer.Tests/DPoP/FreshnessTests.cs index 9a01436..ef7fbc0 100644 --- a/test/AspNetCore.Authentication.JwtBearer.Tests/DPoP/FreshnessTests.cs +++ b/test/AspNetCore.Authentication.JwtBearer.Tests/DPoP/FreshnessTests.cs @@ -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)); @@ -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));