public SecretCache(string @namespace, Secret.UriNameConversion getTargetName = null) { Debug.Assert(!String.IsNullOrWhiteSpace(@namespace), "The namespace parameter is null or invalid"); _namespace = @namespace; _getTargetName = getTargetName ?? Secret.UriToSimpleName; }
public SecretCache(string @namespace, Secret.UriNameConversion getTargetName = null) { if (String.IsNullOrWhiteSpace(@namespace)) throw new ArgumentNullException(@namespace); _namespace = @namespace; _getTargetName = getTargetName ?? Secret.UriToName; }
public SecretCache(string cacheNamespace, Secret.UriNameConversion getTargetName = null) { if (string.IsNullOrWhiteSpace(cacheNamespace)) { throw new ArgumentNullException(nameof(cacheNamespace)); } _namespace = cacheNamespace; _getTargetName = getTargetName ?? Secret.UriToName; }
/// <summary> /// Creates a new <see cref="SecretStore"/> backed by the operating system keychain / /// secrets vault. /// </summary> /// <param name="namespace">The namespace of the secrets written and read by this store.</param> /// <param name="credentialCache"> /// (optional) Write-through, read-first cache. Default cache is used if a custom cache is /// not provided. /// </param> /// <param name="tokenCache"> /// (optional) Write-through, read-first cache. Default cache is used if a custom cache is /// not provided. /// </param> public SecretStore(string @namespace, ICredentialStore credentialCache = null, ITokenStore tokenCache = null, Secret.UriNameConversion getTargetName = null) { if (String.IsNullOrWhiteSpace(@namespace) || @namespace.IndexOfAny(IllegalCharacters) != -1) throw new ArgumentNullException("prefix", "The `prefix` parameter is null or invalid."); _getTargetName = getTargetName ?? Secret.UriToSimpleName; _namespace = @namespace; _credentialCache = credentialCache ?? new SecretCache(@namespace, _getTargetName); _tokenCache = tokenCache ?? new SecretCache(@namespace, _getTargetName); }
/// <summary> /// Creates a new <see cref="SecretStore"/> backed by the operating system keychain / /// secrets vault. /// </summary> /// <param name="namespace">The namespace of the secrets written and read by this store.</param> /// <param name="credentialCache"> /// (optional) Write-through, read-first cache. Default cache is used if a custom cache is /// not provided. /// </param> /// <param name="tokenCache"> /// (optional) Write-through, read-first cache. Default cache is used if a custom cache is /// not provided. /// </param> public SecretStore(string @namespace, ICredentialStore credentialCache = null, ITokenStore tokenCache = null, Secret.UriNameConversion getTargetName = null) { if (String.IsNullOrWhiteSpace(@namespace)) throw new ArgumentNullException(nameof(@namespace)); if (@namespace.IndexOfAny(IllegalCharacters) != -1) throw new ArgumentException(nameof(@namespace)); _getTargetName = getTargetName ?? Secret.UriToName; _namespace = @namespace; _credentialCache = credentialCache ?? new SecretCache(@namespace, _getTargetName); _tokenCache = tokenCache ?? new SecretCache(@namespace, _getTargetName); }
/// <summary> /// Creates a new <see cref="SecretStore"/> backed by the operating system keychain / /// secrets vault. /// </summary> /// <param name="storeNamespace">The namespace of the secrets written and read by this store.</param> /// <param name="credentialCache"> /// (optional) Write-through, read-first cache. Default cache is used if a custom cache is /// not provided. /// </param> /// <param name="tokenCache"> /// (optional) Write-through, read-first cache. Default cache is used if a custom cache is /// not provided. /// </param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="storeNamespace"/> has <see cref="BaseSecureStore.IllegalCharacters"/></exception> public SecretStore(string storeNamespace, ITokenStore tokenCache = null, Secret.UriNameConversion getTargetName = null) { if (String.IsNullOrWhiteSpace(storeNamespace)) { throw new ArgumentNullException(nameof(storeNamespace)); } if (storeNamespace.IndexOfAny(IllegalCharacters) != -1) { throw new ArgumentOutOfRangeException(nameof(storeNamespace)); } _getTargetName = getTargetName ?? Secret.UriToName; _namespace = storeNamespace; _tokenCache = tokenCache ?? new SecretCache(storeNamespace, _getTargetName); }
public NamedSecret(string name, Secret secret) { _name = name; _secret = secret; }