1import React from 'react';
2import { HttpSettingsBaseProps } from './types';
3import { Switch } from '../Forms/Legacy/Switch/Switch';
4
5export const HttpProxySettings: React.FC<HttpSettingsBaseProps> = ({
6  dataSourceConfig,
7  onChange,
8  showForwardOAuthIdentityOption = true,
9}) => {
10  return (
11    <>
12      <div className="gf-form-inline">
13        <Switch
14          label="TLS Client Auth"
15          labelClass="width-13"
16          checked={dataSourceConfig.jsonData.tlsAuth || false}
17          onChange={(event) => onChange({ ...dataSourceConfig.jsonData, tlsAuth: event!.currentTarget.checked })}
18        />
19
20        <Switch
21          label="With CA Cert"
22          labelClass="width-13"
23          checked={dataSourceConfig.jsonData.tlsAuthWithCACert || false}
24          onChange={(event) =>
25            onChange({ ...dataSourceConfig.jsonData, tlsAuthWithCACert: event!.currentTarget.checked })
26          }
27          tooltip="Needed for verifying self-signed TLS Certs"
28        />
29      </div>
30      <div className="gf-form-inline">
31        <Switch
32          label="Skip TLS Verify"
33          labelClass="width-13"
34          checked={dataSourceConfig.jsonData.tlsSkipVerify || false}
35          onChange={(event) => onChange({ ...dataSourceConfig.jsonData, tlsSkipVerify: event!.currentTarget.checked })}
36        />
37      </div>
38      {showForwardOAuthIdentityOption && (
39        <div className="gf-form-inline">
40          <Switch
41            label="Forward OAuth Identity"
42            labelClass="width-13"
43            checked={dataSourceConfig.jsonData.oauthPassThru || false}
44            onChange={(event) =>
45              onChange({ ...dataSourceConfig.jsonData, oauthPassThru: event!.currentTarget.checked })
46            }
47            tooltip="Forward the user's upstream OAuth identity to the data source (Their access token gets passed along)."
48          />
49        </div>
50      )}
51    </>
52  );
53};
54