public async Task Setup() { // Build Connection to Vault. _vault = await VaultServerRef.ConnectVault("AppRoleVault"); //_vault = new VaultAgentAPI ("AppRoleVault", VaultServerRef.ipAddress, VaultServerRef.ipPort, VaultServerRef.rootToken, true); _vaultSystemBackend = new VaultSystemBackend(_vault.TokenID, _vault); _ldapMountName = _uniqueKeys.GetKey("LDAP"); // Define the engine. _ldapAuthEngine = (LdapAuthEngine)_vault.ConnectAuthenticationBackend(EnumBackendTypes.A_LDAP, "ldap_test", _ldapMountName); // Now create the Mount point. AuthMethod authMethod = new AuthMethod(_ldapMountName, EnumAuthMethods.LDAP); authMethod.Description = "Ldap Test"; Assert.True(await _vaultSystemBackend.AuthEnable(authMethod), "A10: Expected the LDAP Backend to have been enabled."); // Now build the LDAP Backend. _origConfig = _ldapAuthEngine.GetLDAPConfigFromFile(@"C:\a_Dev\Configs\LDAP_Test.json"); SetLDAPConfig(_ldapMountName, _origConfig); // Save the Config. We do this here so the SetLDAPConfig can be used for multiple engines. Assert.True(await _ldapAuthEngine.ConfigureLDAPBackend(_origConfig), "A100: Expected the LDAP Configuration method to return True"); // Initialize the LDAP Login Connector. _ldapLoginConnector = new LDAPLoginConnector(_vault, _ldapAuthEngine.MountPoint, "Test LDAP Backend"); // Load the Test Data Object LoadTestData(); }
public InitiateVault(VaultAgentAPI vaultAgent) { _vault = vaultAgent; _vaultSystemBackend = new VaultSystemBackend(_vault.TokenID, _vault); _ldapAuthEngine = (LdapAuthEngine)_vault.ConnectAuthenticationBackend(EnumBackendTypes.A_LDAP, LDAP_MOUNTNAME, LDAP_MOUNTNAME); _authMethod = new AuthMethod(LDAP_MOUNTNAME, EnumAuthMethods.LDAP); _authMethod.Description = LDAP_MOUNTNAME; }