public void expiration_should_be_greater_than_zero() { { var subject = new KeyManagementOptions { PropagationTime = TimeSpan.FromMinutes(1), RotationInterval = TimeSpan.FromMinutes(0), RetentionDuration = TimeSpan.FromMinutes(3) }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); } { var subject = new KeyManagementOptions { PropagationTime = TimeSpan.FromMinutes(1), RotationInterval = -TimeSpan.FromMinutes(1), RetentionDuration = TimeSpan.FromMinutes(2) }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); } }
public void expiration_should_be_greater_than_zero() { { var subject = new KeyManagementOptions { KeyActivationDelay = TimeSpan.FromMinutes(1), KeyExpiration = TimeSpan.FromMinutes(0), KeyRetirement = TimeSpan.FromMinutes(3) }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); } { var subject = new KeyManagementOptions { KeyActivationDelay = TimeSpan.FromMinutes(1), KeyExpiration = -TimeSpan.FromMinutes(1), KeyRetirement = TimeSpan.FromMinutes(3) }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); } }
public void keycacheduration_should_be_greater_than_or_equal_to_zero() { var subject = new KeyManagementOptions { KeyCacheDuration = -TimeSpan.FromMinutes(1), }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); }
public void InitializationSynchronizationDelay_should_be_greater_than_or_equal_to_zero() { var subject = new KeyManagementOptions { InitializationSynchronizationDelay = -TimeSpan.FromMinutes(1), }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); }
/// <summary> /// Constructor for KeyManager /// </summary> /// <param name="options"></param> /// <param name="store"></param> /// <param name="cache"></param> /// <param name="protector"></param> /// <param name="clock"></param> /// <param name="newKeyLock"></param> /// <param name="logger"></param> /// <param name="httpContextAccessor"></param> public KeyManager( KeyManagementOptions options, ISigningKeyStore store, ISigningKeyStoreCache cache, ISigningKeyProtector protector, ISystemClock clock, INewKeyLock newKeyLock, ILogger <KeyManager> logger, IHttpContextAccessor httpContextAccessor = null) { options.Validate(); _options = options; _store = store; _cache = cache; _protector = protector; _clock = clock; _newKeyLock = newKeyLock; _logger = logger; _httpContextAccessor = httpContextAccessor; }
/// <summary> /// Constructor for KeyManager /// </summary> /// <param name="options"></param> /// <param name="store"></param> /// <param name="cache"></param> /// <param name="protector"></param> /// <param name="clock"></param> /// <param name="newKeyLock"></param> /// <param name="logger"></param> /// <param name="issuerNameService"></param> public KeyManager( KeyManagementOptions options, ISigningKeyStore store, ISigningKeyStoreCache cache, ISigningKeyProtector protector, ISystemClock clock, INewKeyLock newKeyLock, ILogger <KeyManager> logger, IIssuerNameService issuerNameService) { options.Validate(); _options = options; _store = store; _cache = cache; _protector = protector; _clock = clock; _newKeyLock = newKeyLock; _logger = logger; _issuerNameService = issuerNameService; }
public void retirement_should_be_longer_than_expiration() { { var subject = new KeyManagementOptions { PropagationTime = TimeSpan.FromMinutes(1), RotationInterval = TimeSpan.FromMinutes(10), RetentionDuration = TimeSpan.FromMinutes(0), }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); } { var subject = new KeyManagementOptions { PropagationTime = TimeSpan.FromMinutes(1), RotationInterval = TimeSpan.FromMinutes(10), RetentionDuration = -TimeSpan.FromMinutes(1), }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); } { var subject = new KeyManagementOptions { PropagationTime = TimeSpan.FromMinutes(1), RotationInterval = TimeSpan.FromMinutes(10), RetentionDuration = TimeSpan.FromMinutes(20), }; Action a = () => subject.Validate(); a.Should().NotThrow <Exception>(); } }
public void retirement_should_be_longer_than_expiration() { { var subject = new KeyManagementOptions { KeyActivationDelay = TimeSpan.FromMinutes(1), KeyExpiration = TimeSpan.FromMinutes(10), KeyRetirement = TimeSpan.FromMinutes(10), }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); } { var subject = new KeyManagementOptions { KeyActivationDelay = TimeSpan.FromMinutes(1), KeyExpiration = TimeSpan.FromMinutes(10), KeyRetirement = TimeSpan.FromMinutes(9), }; Action a = () => subject.Validate(); a.Should().Throw <Exception>(); } { var subject = new KeyManagementOptions { KeyActivationDelay = TimeSpan.FromMinutes(1), KeyExpiration = TimeSpan.FromMinutes(10), KeyRetirement = TimeSpan.FromMinutes(20), }; Action a = () => subject.Validate(); a.Should().NotThrow <Exception>(); } }