public IKeyService CreateService(KeyRackOptions options) { var timeKeeper = new TimeKeeper(options); var serializer = new DataProtectionKeySerializer(_dataProtectionProvider); var repository = new FileSystemKeyRepository(_keysDirectoryPath, _loggerFactory.CreateLogger <FileSystemKeyRepository>()); return(new KeyService(options, repository, serializer, timeKeeper, _loggerFactory.CreateLogger <KeyService>())); }
public IKeyService CreateService(KeyRackOptions options) { var timeKeeper = new TimeKeeper(options); var serializer = new DefaultKeySerializer(); _context = new KeyDbContext(_dbContextOptions); _context.Database.EnsureCreated(); var repository = new EntityFrameworkKeyRepository(_context, _loggerFactory.CreateLogger <EntityFrameworkKeyRepository>()); return(new KeyService(options, repository, serializer, timeKeeper, _loggerFactory.CreateLogger <KeyService>())); }
public KeyServiceTests() { _options = CreateTestOptions(); _timeKeeper = new TimeKeeper(_options); _repositoryMock = new Mock <IKeyRepository>(); _serializerMock = new Mock <IKeySerializer>(); _service = new KeyService( _options, _repositoryMock.Object, _serializerMock.Object, _timeKeeper, new Mock <ILogger <KeyService> >().Object); }
/// <summary> /// Enables key management add-on for IdentityServer /// </summary> /// <param name="optionsConfig">Custom configuration options</param> /// <returns><see cref="KeyRackBuilder" /> instance</returns> public static KeyRackBuilder AddKeyManagement(this IIdentityServerBuilder builder, Action <KeyRackOptions> optionsConfig = null) { var options = new KeyRackOptions(); if (optionsConfig != null) { optionsConfig(options); } builder.Services.AddSingleton(options); builder.Services.AddTransient <IKeySerializer, DefaultKeySerializer>(); builder.Services.AddTransient <ITimeKeeper, TimeKeeper>(); builder.Services.AddTransient <IKeyService, KeyService>(); builder.Services.AddTransient <ISigningCredentialStore, KeyStore>(); builder.Services.AddTransient <IValidationKeysStore, KeyStore>(); return(new KeyRackBuilder(builder)); }
public KeyServiceConcurrencyTests() { _options = CreateTestOptions(); _timeKeeper = new TimeKeeper(_options); _serializer = new DefaultKeySerializer(); }