diff --git a/src/connection-treeview.ts b/src/connection-treeview.ts index fde0d59..4364032 100644 --- a/src/connection-treeview.ts +++ b/src/connection-treeview.ts @@ -26,7 +26,8 @@ export class ConnectionTreeViewProvider implements vscode.TreeDataProvider<vscod name: "Default", appToken: settings.appToken, url: settings.url, - allowInvalidCertificate: false + allowInvalidCertificate: false, + windowsAuth: false }, !connectionName || connectionName === 'Default')) } diff --git a/src/settings.ts b/src/settings.ts index cd34a6e..52651a2 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -14,6 +14,7 @@ export interface IConnection { appToken: string; url: string; allowInvalidCertificate: boolean; + windowsAuth: boolean; } export function load(): ISettings { diff --git a/src/universal.ts b/src/universal.ts index 95d1c1f..41e0164 100644 --- a/src/universal.ts +++ b/src/universal.ts @@ -39,6 +39,7 @@ export class Universal { appToken = connection.appToken; url = connection.url; rejectUnauthorized = !connection.allowInvalidCertificate; + windowsAuth = connection.windowsAuth; } } @@ -47,15 +48,23 @@ export class Universal { rejectUnauthorized }); + const headers = { + 'Content-Type': contentType + } as any; + + if (windowsAuth) { + headers['X-Windows-Auth'] = ''; + } else { + headers['Authorization'] = `Bearer ${appToken}`; + }; + return axios({ url: `${url}${path}`, method, - headers: { - authorization: windowsAuth ? null : `Bearer ${appToken}`, - 'Content-Type': contentType - }, + headers: headers, data: data, - httpsAgent: agent + httpsAgent: agent, + withCredentials: windowsAuth }); }