New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

azure-kusto-data

Package Overview
Dependencies
Maintainers
4
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azure-kusto-data - npm Package Compare versions

Comparing version

to
0.3.8

source/azLoginIdentityClient.js

13

package.json
{
"name": "azure-kusto-data",
"version": "0.3.7",
"version": "0.3.8",
"description": "Azure Data Explorer Query SDK",

@@ -27,12 +27,13 @@ "main": "index.js",

"dependencies": {
"@azure/ms-rest-nodeauth": "^3.0.3",
"adal-node": "^0.1.28",
"moment": "^2.22.2",
"request": "^2.88.0",
"uuid": "^3.3.2"
"moment": "^2.25.3",
"request": "^2.88.2",
"uuid": "^3.4.0"
},
"devDependencies": {
"eslint": "^6.0.1",
"mocha": "^5.2.0",
"eslint": "^6.8.0",
"mocha": "^7.1.2",
"sinon": "^7.2.3"
}
}

@@ -60,2 +60,6 @@ const KeywordMapping = Object.freeze({

if (connectionString.endsWith("/") || connectionString.endsWith("\\")) {
connectionString = connectionString.slice(0, -1);
}
if (!!connectionString && connectionString.split(";")[0].indexOf("=") === -1) {

@@ -125,3 +129,3 @@ connectionString = "Data Source=" + connectionString;

kcsb.msiEndpoint = msiEndpoint;
if (msiEndpoint == undefined) {

@@ -141,2 +145,18 @@ if (process && process.env && process.env.MSI_ENDPOINT) {

}
static withAzLoginIdentity(connectionString) {
const kcsb = new KustoConnectionStringBuilder(connectionString);
kcsb.azLoginIdentity = true;
return kcsb;
}
static withAccessToken(connectionString, accessToken) {
const kcsb = new KustoConnectionStringBuilder(connectionString);
kcsb.accessToken = accessToken;
return kcsb;
}
};

@@ -27,3 +27,3 @@ const { KustoResultTable, WellKnownDataSet } = require("./models");

getErrorsCount() {
getErrorsCount() {
if (!this.statusTable || this.statusTable.length == 0) return 0;

@@ -34,3 +34,3 @@

const errorColumn = this.constructor.getErrorColumn();
for (let row of this.statusTable.rows()) {
for (let row of this.statusTable.rows()) {
if (row[errorColumn] < 4) {

@@ -81,5 +81,5 @@ if (row[errorColumn] < minLevel) {

super(data.Tables);
if (this.tables.length <= 2) {
if (this.tables[0].kind === undefined){
if (this.tables[0].kind === undefined) {
this.tables[0].kind = WellKnownDataSet.PrimaryResult;

@@ -86,0 +86,0 @@ this.primaryResults.push(this.tables[0]);

const { AuthenticationContext } = require("adal-node");
const acquireManagedIdentityToken = require("./managedIdentitiesClient");
const azLoginIndentityToken = require("./azLoginIdentityClient");

@@ -10,3 +11,5 @@ const AuthenticationMethod = Object.freeze({

deviceLogin: 3,
managedIdentities: 4
managedIdentities: 4,
azLogin: 5,
accessToken: 6,
});

@@ -57,2 +60,7 @@

this.msiClientId = kcsb.msiClientId;
} else if (kcsb.azLoginIdentity) {
this.authMethod = AuthenticationMethod.azLogin;
} else if (kcsb.accessToken) {
this.authMethod = AuthenticationMethod.accessToken;
this.accessToken = kcsb.accessToken;
} else {

@@ -119,2 +127,12 @@ this.authMethod = AuthenticationMethod.deviceLogin;

);
case AuthenticationMethod.azLogin:
return azLoginIndentityToken(resource, (err, tokenResponse) => {
if(err) {
return cb(err);
}
return cb(err, tokenResponse && formatHeader(tokenResponse));
});
case AuthenticationMethod.accessToken:
return cb(undefined, `Bearer ${this.accessToken}`);
default:

@@ -121,0 +139,0 @@ return cb("Couldn't Authenticate, something went wrong trying to choose authentication method");