public UsernamePasswordAuthenticationProvider(UsernamePasswordAuthenticationInfo userPassAuthenticationInfo, IDataAccessManager dataAccessManager, bool continueAsyncTasksOnCapturedContext = false) { _userPassAuthenticationInfo = userPassAuthenticationInfo; _dataAccessManager = dataAccessManager; _continueAsyncTasksOnCapturedContext = continueAsyncTasksOnCapturedContext; }
private async Task UsernamePasswordAuthenticationProviderTests() { // userpass auth var path = "userpass" + Guid.NewGuid(); var prefix = "auth/" + path; var username = "******"; var password = "******"; var authenticationInfo = new UsernamePasswordAuthenticationInfo(path, username, password); var userPassClient = VaultClientFactory.CreateVaultClient(_vaultUri, authenticationInfo); var authBackend = new AuthenticationBackend { BackendType = AuthenticationBackendType.UsernamePassword, AuthenticationPath = authenticationInfo.MountPoint }; await _authenticatedVaultClient.EnableAuthenticationBackendAsync(authBackend); await _authenticatedVaultClient.WriteSecretAsync(prefix + "/users/" + username, new Dictionary<string, object> { { "password", password }, { "policies", "root" } }); var authBackends = await userPassClient.GetAllEnabledAuthenticationBackendsAsync(); Assert.True(authBackends.Data.Any()); await _authenticatedVaultClient.DisableAuthenticationBackendAsync(authBackend.AuthenticationPath); }