Exemplo n.º 1
0
 public IHashicorpVaultClient CreateClient(HashicorpVaultContext context)
 {
     return(_clients.GetOrCreate(context.GetHashCode(), e =>
     {
         e.Size = 1;
         e.SlidingExpiration = _vaultClientExpiration;
         return new HashicorpVaultClient(context);
     }));
 }
        public HashicorpVaultContextBuilder FromJson(string json)
        {
            json = json ?? throw new SecureStoreException(
                             SecureStoreException.Type.InvalidConfiguration,
                             nameof(Resource.HashicorpVaultJsonInvalidOrMissing));

            try
            {
                _context = JsonConvert.DeserializeObject <HashicorpVaultContext>(json);
            }
            catch (Exception)
            {
                // Ignore, we handle wrong json lower
            }

            _context = _context ?? throw new SecureStoreException(
                                 SecureStoreException.Type.InvalidConfiguration,
                                 nameof(Resource.HashicorpVaultJsonInvalidOrMissing));

            return(this);
        }
Exemplo n.º 3
0
 public HashicorpVaultClient(HashicorpVaultContext context)
 {
     _context = context;
 }