From d167ac83a62a13aa8b69d793da70c4a0fdebdf9c Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Mon, 28 Jun 2021 12:58:40 +0200 Subject: [PATCH] Add agentForward field in UI (issue #265) --- webview/src/ConfigEditor/fields.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/webview/src/ConfigEditor/fields.tsx b/webview/src/ConfigEditor/fields.tsx index fba0647..53a94b0 100644 --- a/webview/src/ConfigEditor/fields.tsx +++ b/webview/src/ConfigEditor/fields.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { FieldCheckbox } from '../FieldTypes/checkbox'; import { FieldDropdown } from '../FieldTypes/dropdown'; import { FieldDropdownWithInput } from '../FieldTypes/dropdownwithinput'; import { FieldNumber } from '../FieldTypes/number'; @@ -110,6 +111,16 @@ export function passphrase(config: FileSystemConfig, onChange: FSCChanged<'passp return } +export function agentForward(config: FileSystemConfig, onChange: FSCChanged<'agentForward'>): React.ReactElement { + const callback = (newValue?: boolean) => onChange('agentForward', newValue); + const description = 'Whether to enable to use OpenSSH agent forwarding (`auth-agent@openssh.com`) when authenticating using an agent'; + const postface = (config.agentForward && !config.agent) &&

+ Agent forwarding will be disabled if not authenticated with an agent! E.g. password authentication will disable agent forwarding! + In case of using PuTTY with the PuTTY using an agent, this will still work without having to explicitly specify the agent. +

; + return ; +} + export function sftpCommand(config: FileSystemConfig, onChange: FSCChanged<'sftpCommand'>): React.ReactElement { const callback = (newValue?: string) => onChange('sftpCommand', newValue); const description = 'A command to run on the remote SSH session to start a SFTP session (defaults to sftp subsystem)'; @@ -146,5 +157,5 @@ export type FieldFactory = (config: FileSystemConfig, onChange: FSCChanged, onCh export const FIELDS: FieldFactory[] = [ name, merge, label, group, putty, host, port, root, agent, username, password, privateKeyPath, passphrase, - sftpCommand, sftpSudo, terminalCommand, taskCommand, + agentForward, sftpCommand, sftpSudo, terminalCommand, taskCommand, PROXY_FIELD];