public async Task <CredentialParams> LookupAsync(string correlationId, string key) { CredentialParams credential = null; lock (_lock) { _items.TryGetValue(key, out credential); } return(await Task.FromResult(credential)); }
private void ReadCredentials(ConfigParams credentials) { lock (_lock) { _items.Clear(); foreach (var entry in credentials) { _items[entry.Key] = CredentialParams.FromString(entry.Value); } } }
public async Task StoreAsync(string correlationId, string key, CredentialParams credential) { lock (_lock) { if (credential != null) { _items[key] = credential; } else { _items.Remove(key); } } await Task.Delay(0); }
private async Task <CredentialParams> LookupInStoresAsync(string correlationId, CredentialParams credential) { if (credential.UseCredentialStore == false) { return(null); } var key = credential.StoreKey; if (_references == null) { return(null); } var components = _references.GetOptional(new Descriptor("*", "credential_store", "*", "*", "*")); if (components.Count == 0) { throw new ReferenceException(correlationId, "Credential store wasn't found to make lookup"); } foreach (var component in components) { var store = component as ICredentialStore; if (store != null) { var resolvedCredential = await store.LookupAsync(correlationId, key); if (resolvedCredential != null) { return(resolvedCredential); } } } return(null); }
public void Add(CredentialParams connection) { _credentials.Add(connection); }
public void Configure(ConfigParams config, bool configAsDefault = true) { _credentials.AddRange(CredentialParams.ManyFromConfig(config, configAsDefault)); }