Пример #1
0
 public KeyProviderFactory(ShepherdConfiguration configuration,
                           Func <TransitKeyProvider> transitKeyProviderFactory,
                           Func <SimpleKeyProvider> simpleKeyProviderFactory)
 {
     _configuration             = configuration;
     _transitKeyProviderFactory = transitKeyProviderFactory;
     _simpleKeyProviderFactory  = simpleKeyProviderFactory;
 }
Пример #2
0
        public SimpleKeyProvider(ShepherdConfiguration configuration)
        {
            _keys = configuration.Unsealing.Simple.Keys;

            if (!_keys.Any())
            {
                throw new ArgumentException("The configuration key 'Unsealing:Simple:Keys' is invalid.");
            }
        }
Пример #3
0
        public VaultOperator(ILogger <VaultOperator> logger,
                             IKeyProvider keyProvider,
                             VaultClientFactory vaultClientFactory,
                             ShepherdConfiguration configuration)
        {
            _logger             = logger;
            _keyProvider        = keyProvider;
            _vaultClientFactory = vaultClientFactory;

            _hostname = configuration.Unsealing.Hostname;
        }
Пример #4
0
        public ConsulDiscoveryProvider(ILogger <ConsulDiscoveryProvider> logger, ShepherdConfiguration configuration, ConsulClientFactory consulClientFactory)
        {
            _logger = logger;
            _consulClientFactory = consulClientFactory;

            _channel = Channel.CreateBounded <VaultEvent>(new BoundedChannelOptions(64)
            {
                FullMode = BoundedChannelFullMode.DropOldest
            });

            _consulServiceName = configuration.Discovery.Consul.ServiceName ?? throw new ArgumentException("Key 'Discovery:Consul:ServiceName' is invalid.");
            _consulAddress     = configuration.Discovery.Consul.Address ?? throw new ArgumentException("Key 'Discovery:Consul:Address' is invalid.");
            _consulToken       = configuration.Discovery.Consul.Token;
            _consulDatacenter  = configuration.Discovery.Consul.Datacenter;
        }
Пример #5
0
        public TransitKeyProvider(ILogger <TransitKeyProvider> logger, ShepherdConfiguration configuration, VaultClientFactory vaultClientFactory)
        {
            _logger             = logger;
            _vaultClientFactory = vaultClientFactory;

            var transit = configuration.Unsealing.Transit;

            _address     = transit.Address ?? throw new ArgumentException("Key 'Unsealing:Transit:Address' is invalid.");
            _keyName     = transit.KeyName ?? throw new ArgumentException("Key 'Unsealing:Transit:KeyName' is invalid.");
            _mountPath   = transit.MountPath ?? throw new ArgumentException("Key 'Unsealing:Transit:MountPath' is invalid.");
            _wrappedKeys = transit.WrappedKeys;
            _hostname    = transit.Hostname;

            _auth = transit.Auth;
            vaultClientFactory.AssertValidConfiguration(transit.Auth);

            if (!_wrappedKeys.Any())
            {
                throw new ArgumentException("Key 'Unsealing:Transit:WrappedKeys' is invalid.");
            }
        }
Пример #6
0
 public DiscoveryProviderFactory(ShepherdConfiguration configuration,
                                 Func <ConsulDiscoveryProvider> consulDiscoveryProviderFactory)
 {
     _configuration = configuration;
     _consulDiscoveryProviderFactory = consulDiscoveryProviderFactory;
 }