public void Authenticate(IVaultClientUri vaultUri) { try { using (var client = vaultUri.ServiceClient) { var result = client.Post <AppIdLogin, AppIdLoginResult>($"v1/auth/app-id/login/{appId}", new AppIdLogin { UserId = userId }); if (result?.Auth != null) { AuthToken = result.Auth.ClientToken; } else { if (result?.Errors != null) { logger.LogError("Unable to authenticate client using AppId - Errors: {0}", result.Errors); } } } } catch (Exception exception) { logger.LogError("Unable to authenticate client using AppId", exception); throw new AuthenticationException("Unable to authenticate client using AppId", exception); } }
public void Authenticate(IVaultClientUri vaultUri) { try { using (var client = vaultUri.ServiceClient) { var result = client.Post <AppRoleLogin, AppRoleLoginResult>("v1/auth/approle/login", new AppRoleLogin { RoleId = roleId, SecretId = secretId }); if (result?.Auth != null) { AuthToken = result.Auth.ClientToken; } else { if (result?.Errors != null) { logger.LogError("Unable to authenticate client using AppRole - Errors: [{0}]", string.Join(",", result.Errors)); } } } } catch (Exception exception) { logger.LogError("Unable to authenticate client using AppRole", exception); throw new AuthenticationException("Unable to authenticate client using AppRole", exception); } }
internal VaultClient(IVaultAuth vaultAuth, IVaultClientUri vaultUri) { vaultUri.ThrowIfNull(nameof(vaultUri)); vaultAuth.ThrowIfNull(nameof(vaultAuth)); VaultUri = vaultUri; VaultAuth = vaultAuth; }
public void Authenticate(IVaultClientUri vaultUri) { try { using (var client = vaultUri.ServiceClient) { var result = client.Post <UserPassLogin, UserPassLoginResult>($"v1/userpass/login/{username}", new UserPassLogin { Password = password }); AuthToken = result.Auth.ClientToken; } } catch (Exception exception) { Logger.Log(LogLevel.Error, () => "Unable to authenticate client using AppId", exception); throw; } }
public void Authenticate(IVaultClientUri vaultUri) { try { using (var client = vaultUri.ServiceClient) { var result = client.Post(new UserPassLogin { Username = username, Password = password }); AuthToken = result.Auth.ClientToken; } } catch (Exception exception) { Log.Error("Unable to authenticate client using AppId", exception); throw; } }
public void Authenticate(IVaultClientUri vaultUri) { try { using (var client = vaultUri.ServiceClient) { var result = client.Post(new AppRoleLogin { RoleId = roleId, SecretId = secretId }); AuthToken = result.Auth.ClientToken; } } catch (Exception exception) { Log.Error("Unable to authenticate client using AppRole", exception); throw new AuthenticationException("Unable to authenticate client using AppRole", exception); } }
public void Authenticate(IVaultClientUri vaultUri) { try { using (var client = vaultUri.ServiceClient) { var result = client.Post <AppIdLogin, AppIdLoginResult>($"v1/auth/app-id/login/{appId}", new AppIdLogin { UserId = userId }); if (result?.Auth != null) { AuthToken = result.Auth.ClientToken; } } } catch (Exception exception) { Logger.Log(LogLevel.Error, () => "Unable to authenticate client using AppId", exception); throw; } }
public void Authenticate(IVaultClientUri vaultUri) { }
public VaultClient(IVaultClientUri vaultClientUri, IVaultAuth vaultAuth) { VaultUri = vaultClientUri.ThrowIfNull(nameof(vaultClientUri)); VaultAuth = vaultAuth.ThrowIfNull(nameof(vaultAuth)); }