feat: Client Certificate Options Support (#1658)
* feat: support client certificate authentication options * docs: support client certificate authentication options * chore: update package.json * docs: move clientCertificate to it's own example
This commit is contained in:
parent
74020b1052
commit
136bf9e0f0
5 changed files with 52 additions and 15 deletions
7
core/index.d.ts
vendored
7
core/index.d.ts
vendored
|
|
@ -664,6 +664,13 @@ export interface RequestOptions {
|
|||
headers?: { [key: string]: string };
|
||||
extraBodyProperties?: { [key: string]: any };
|
||||
noProxy?: string[];
|
||||
clientCertificate?: ClientCertificateOptions;
|
||||
}
|
||||
|
||||
export interface ClientCertificateOptions {
|
||||
cert: string;
|
||||
key: string;
|
||||
passphrase?: string;
|
||||
}
|
||||
|
||||
export interface StepWithParams {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export function fetchwithRequestOptions(
|
|||
|
||||
const timeout = (requestOptions?.timeout ?? TIMEOUT) * 1000; // measured in ms
|
||||
|
||||
const agentOptions = {
|
||||
const agentOptions: {[key: string]: any} = {
|
||||
ca,
|
||||
rejectUnauthorized: requestOptions?.verifySsl,
|
||||
timeout,
|
||||
|
|
@ -51,6 +51,15 @@ export function fetchwithRequestOptions(
|
|||
keepAliveMsecs: timeout,
|
||||
};
|
||||
|
||||
// Handle ClientCertificateOptions
|
||||
if (requestOptions?.clientCertificate){
|
||||
agentOptions.cert = fs.readFileSync(requestOptions.clientCertificate.cert,"utf8");
|
||||
agentOptions.key = fs.readFileSync(requestOptions.clientCertificate.key,"utf8");
|
||||
if(requestOptions.clientCertificate.passphrase){
|
||||
agentOptions.passphrase = requestOptions.clientCertificate.passphrase;
|
||||
}
|
||||
}
|
||||
|
||||
const proxy = requestOptions?.proxy;
|
||||
|
||||
// Create agent
|
||||
|
|
|
|||
|
|
@ -135,18 +135,39 @@ If you need to send custom headers for authentication, you may use the `requestO
|
|||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"requestOptions": {
|
||||
"headers": {
|
||||
"X-Auth-Token": "xxx"
|
||||
}
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"requestOptions": {
|
||||
"headers": {
|
||||
"X-Auth-Token": "xxx"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Similarly if your model requires a Certificate for authentication, you may use the `requestOptions.clientCertificate` property like in the example below:
|
||||
|
||||
```json title="~/.continue/config.json"
|
||||
{
|
||||
"models": [
|
||||
{
|
||||
"title": "Ollama",
|
||||
"provider": "ollama",
|
||||
"model": "llama2-7b",
|
||||
"requestOptions": {
|
||||
"clientCertificate": {
|
||||
"cert": "C:\temp\ollama.pem",
|
||||
"key": "C:\temp\ollama.key",
|
||||
"passphrase": "c0nt!nu3"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
4
extensions/vscode/package-lock.json
generated
4
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.9.170",
|
||||
"version": "0.9.171",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.9.170",
|
||||
"version": "0.9.171",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"version": "0.9.170",
|
||||
"version": "0.9.171",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue