Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure/ms-rest-nodeauth

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/ms-rest-nodeauth - npm Package Compare versions

Comparing version 3.0.5 to 3.0.6

19

Changelog.md
# Changelog
## 3.0.5 - (unreleased)
## 3.0.6 - 2020/09/25
- Fixed a bug where `buildTenantsList` will throw an error when it can't list tenants
- Added instructions for authenticating with an existing token
## 3.0.5 - 2020/06/16
- The helper method `buildTenantList` is made public. This is helpful if one needs to get the Ids of all the tenants in the account programmatically.

@@ -12,8 +15,7 @@ - A new method `setDomain()` which takes the Id of a tenant is now available on all credentials. Use this to change the domain i.e. the tenant against which tokens are created.

## 3.0.4 - 2020/05/19 (deprecated)
- Through a mistake of release automation, a CI job from PR #91 got shipped by accident.
## 3.0.2 - 2019/08/22
## 3.0.3 - 2019/08/22
- Fixed a bug where the callback to `loginWithServicePrincipalSecretWithAuthResponse` is sometimes not called.
For more details, see [PR 77](https://github.com/Azure/ms-rest-nodeauth/pull/77)

@@ -30,2 +32,11 @@ ## 3.0.2 - 2019/08/16

## 2.0.6 - 2020/09/24
- Fixed a bug where `buildTenantsList` will throw an error when it can't list tenants
- Added instructions for authenticating with an existing token
## 2.0.5 - 2019/08/22
- Fixed a bug where the callback to `loginWithServicePrincipalSecretWithAuthResponse` is sometimes not called.
- Fix bug prevent tenant IDs from being discovered on auth
- Reduce number of `Promise` object allocations inside `async` functions.
## 2.0.4 - 2019/08/02

@@ -32,0 +43,0 @@ - Rolled back the min version of dependency `@azure/ms-rest-js` from `^2.0.3` to `^1.8.13` thereby fixing [#69](https://github.com/Azure/ms-rest-nodeauth/issues/69).

@@ -93,5 +93,8 @@ "use strict";

const creds = new userTokenCredentials_1.UserTokenCredentials(options.clientId, options.domain, username, password, options.tokenAudience, options.environment);
yield creds.getToken();
// The token cache gets populated for all the tenants as a part of building the tenantList.
const tenantList = yield subscriptionUtils_1.buildTenantList(creds);
const tokenResponse = yield creds.getToken();
// The token cache gets propulated for all the tenants as a part of building the tenantList.
let tenantList = yield subscriptionUtils_1.buildTenantList(creds);
if (tenantList.length === 0 && tokenResponse.tenantId) {
tenantList = [tokenResponse.tenantId];
}
const subscriptionList = yield _getSubscriptions(creds, tenantList, options.tokenAudience);

@@ -98,0 +101,0 @@ return { credentials: creds, subscriptions: subscriptionList };

@@ -36,5 +36,7 @@ "use strict";

const result = [];
const tenants = res.parsedBody;
for (const tenant of tenants.value) {
result.push(tenant.tenantId);
if (res.status < 300) {
const tenants = res.parsedBody;
for (const tenant of tenants.value) {
result.push(tenant.tenantId);
}
}

@@ -41,0 +43,0 @@ return result;

@@ -178,6 +178,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

const creds = new UserTokenCredentials(options.clientId, options.domain, username, password, options.tokenAudience, options.environment);
await creds.getToken();
const tokenResponse = await creds.getToken();
// The token cache gets populated for all the tenants as a part of building the tenantList.
const tenantList = await buildTenantList(creds);
// The token cache gets propulated for all the tenants as a part of building the tenantList.
let tenantList = await buildTenantList(creds);
if (tenantList.length === 0 && tokenResponse.tenantId) {
tenantList = [tokenResponse.tenantId];
}
const subscriptionList: LinkedSubscription[] = await _getSubscriptions(creds, tenantList, options.tokenAudience);

@@ -184,0 +188,0 @@

@@ -93,6 +93,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

const result: string[] = [];
const tenants: any = res.parsedBody;
for (const tenant of tenants.value) {
result.push(tenant.tenantId);
if (res.status < 300) {
const tenants: any = res.parsedBody;
for (const tenant of tenants.value) {
result.push(tenant.tenantId);
}
}
return result;

@@ -99,0 +103,0 @@ }

@@ -8,3 +8,3 @@ {

},
"version": "3.0.5",
"version": "3.0.6",
"description": "Azure Authentication library in node.js with type definitions.",

@@ -11,0 +11,0 @@ "keywords": [

@@ -241,2 +241,22 @@ # ms-rest-nodeauth [![Build Status](https://dev.azure.com/azure-public/adx/_apis/build/status/public.Azure.ms-rest-nodeauth)](https://dev.azure.com/azure-public/adx/_build/latest?definitionId=9)

### Authenticating with an existing token
If you have acquired a valid Azure Active Directory token from another source, you can use it to authenticate with Azure SDK libraries using the following code snippet:
```js
const { HttpHeaders } = require("@azure/ms-rest-js");
function getCredentialForToken(accessToken) {
return {
signRequest: (request) => {
if (!request.headers) request.headers = new HttpHeaders();
request.headers.set("Authorization", `Bearer ${accessToken}`);
return Promise.resolve(request);
}
};
}
const creds = getCredentialForToken("your existing token");
```
### Contributing

@@ -243,0 +263,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc