Socket
Socket
Sign inDemoInstall

@microsoft/vscode-azext-azureutils

Package Overview
Dependencies
Maintainers
10
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/vscode-azext-azureutils - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

9

index.d.ts

@@ -432,1 +432,10 @@ /*---------------------------------------------------------------------------------------------

export function setupAzureLogger(logOutputChannel: LogOutputChannel): Disposable;
/**
* Replaces the usage of BasicAuthenticationCredentials for ServiceClients imported from @azure/core-pipelines
*
* @param client - The service client. This will typically be a generalClient
* @param userName - Username to be used with basic authentication login
* @param password - Password. Gets encoded before being set in the header
*/
export function addBasicAuthenticationCredentialsToClient(client: ServiceClient, userName: string, password: string): void;

29

out/src/createAzureClient.js

@@ -16,3 +16,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.CorrelationIdPolicy = exports.createGenericClient = exports.sendRequestWithTimeout = exports.createAzureSubscriptionClient = exports.createAzureClient = exports.parseClientContext = void 0;
exports.CorrelationIdPolicy = exports.addBasicAuthenticationCredentialsToClient = exports.createGenericClient = exports.sendRequestWithTimeout = exports.createAzureSubscriptionClient = exports.createAzureClient = exports.parseClientContext = void 0;
const core_client_1 = require("@azure/core-client");

@@ -123,2 +123,6 @@ const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");

}
function addBasicAuthenticationCredentialsToClient(client, userName, password) {
client.pipeline.addPolicy(new BasicAuthenticationCredentialsPolicy(userName, password), { phase: 'Serialize' });
}
exports.addBasicAuthenticationCredentialsToClient = addBasicAuthenticationCredentialsToClient;
/**

@@ -247,2 +251,25 @@ * Automatically add id to correlate our telemetry with the platform team's telemetry

}
/**
* Encodes userName and password and signs a request with the Authentication header.
* Imitates BasicAuthenticationCredentials from ms-rest-js
*/
class BasicAuthenticationCredentialsPolicy {
constructor(userName, password) {
this.userName = userName;
this.password = password;
this.name = BasicAuthenticationCredentialsPolicy.Name;
}
sendRequest(request, next) {
return __awaiter(this, void 0, void 0, function* () {
const credentials = `${this.userName}:${this.password}`;
const DEFAULT_AUTHORIZATION_SCHEME = "Basic";
const encodedCredentials = `${DEFAULT_AUTHORIZATION_SCHEME} ${Buffer.from(credentials).toString("base64")}`;
if (!request.headers)
request.headers = (0, core_rest_pipeline_1.createHttpHeaders)();
request.headers.set("authorization", encodedCredentials);
return yield next(request);
});
}
}
BasicAuthenticationCredentialsPolicy.Name = 'BasicAuthenticationCredentialsPolicy';
//# sourceMappingURL=createAzureClient.js.map

2

package.json
{
"name": "@microsoft/vscode-azext-azureutils",
"author": "Microsoft Corporation",
"version": "1.1.2",
"version": "1.1.3",
"description": "Common Azure utils for developing Azure extensions for VS Code",

@@ -6,0 +6,0 @@ "tags": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc