public async Task ValidatorMemoryCacheExpirationExpired() { var config = Krb5Config.Default(); config.Defaults.ClockSkew = TimeSpan.Zero; using (var logger = new FakeExceptionLoggerFactory()) using (var replay = new TicketReplayValidator(config, logger)) { var entry = new TicketCacheEntry { Key = "blargh", Expires = DateTimeOffset.UtcNow.AddMilliseconds(100) }; var added = await replay.Add(entry); Assert.IsTrue(added); await Task.Delay(TimeSpan.FromSeconds(1)); added = await replay.Add(entry); Assert.IsTrue(added); Assert.IsTrue(logger.Logs.Count() > 1); } }
public async Task TestValidatorMemoryCacheExpiration() { var replay = new TicketReplayValidator(); var entry = new TicketCacheEntry { Key = "blargh", Expires = DateTimeOffset.UtcNow.AddHours(1) }; var added = await replay.Add(entry); Assert.IsTrue(added); added = await replay.Add(entry); Assert.IsFalse(added); }
public async Task TestValidatorMemoryCacheExpirationExpired() { var replay = new TicketReplayValidator(); var entry = new TicketCacheEntry { Key = "blargh", Expires = DateTimeOffset.UtcNow.AddSeconds(1) }; var added = await replay.Add(entry); Assert.IsTrue(added); await Task.Delay(TimeSpan.FromSeconds(3)); added = await replay.Add(entry); Assert.IsTrue(added); }
public async Task ValidatorMemoryCacheExpiration() { var logger = new FakeExceptionLoggerFactory(); var replay = new TicketReplayValidator(logger); var entry = new TicketCacheEntry { Key = "blargh", Expires = DateTimeOffset.UtcNow.AddHours(1) }; var added = await replay.Add(entry); Assert.IsTrue(added); Assert.AreEqual(1, logger.Logs.Count()); added = await replay.Add(entry); Assert.IsFalse(added); }
public async Task ValidatorMemoryCacheExpirationExpired_WithinSkew() { using (var logger = new FakeExceptionLoggerFactory()) using (var replay = new TicketReplayValidator(logger)) { var entry = new TicketCacheEntry { Key = "blargh", Expires = DateTimeOffset.UtcNow.AddMilliseconds(100) }; var added = await replay.Add(entry); Assert.IsTrue(added); await Task.Delay(TimeSpan.FromSeconds(1)); added = await replay.Add(entry); Assert.IsFalse(added); } }
public async Task ValidatorMemoryCacheExpirationExpired() { var logger = new FakeExceptionLoggerFactory(); var replay = new TicketReplayValidator(logger); var entry = new TicketCacheEntry { Key = "blargh", Expires = DateTimeOffset.UtcNow.AddMilliseconds(100) }; var added = await replay.Add(entry); Assert.IsTrue(added); await Task.Delay(TimeSpan.FromSeconds(5)); added = await replay.Add(entry); Assert.IsTrue(added); Assert.AreEqual(2, logger.Logs.Count()); }