Skip to content

Commit

Permalink
fix: correctly pass through the tokenCache option (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurschreiber committed Mar 26, 2021
1 parent c6b149d commit 4c17751
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 3.0.9 - Unreleased
- Pass user provided `tokenCache` option to `withUsernamePasswordWithAuthResponse` and `withServicePrincipalSecretWithAuthResponse` methods to the credentials being created.

## 3.0.8 - 2021/03/23
- Fix command injection in core function `execAz()` by replacing `exec()` with `execFile()` - CVE-2021-28458

Expand Down
4 changes: 2 additions & 2 deletions lib/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export async function withUsernamePasswordWithAuthResponse(username: string, pas
options.environment = Environment.AzureCloud;
}

const creds = new UserTokenCredentials(options.clientId, options.domain, username, password, options.tokenAudience, options.environment);
const creds = new UserTokenCredentials(options.clientId, options.domain, username, password, options.tokenAudience, options.environment, options.tokenCache);
const tokenResponse = await creds.getToken();

// The token cache gets propulated for all the tenants as a part of building the tenantList.
Expand Down Expand Up @@ -214,7 +214,7 @@ export async function withServicePrincipalSecretWithAuthResponse(clientId: strin
options.environment = Environment.AzureCloud;
}

const creds = new ApplicationTokenCredentials(clientId, domain, secret, options.tokenAudience, options.environment);
const creds = new ApplicationTokenCredentials(clientId, domain, secret, options.tokenAudience, options.environment, options.tokenCache);
await creds.getToken();

const subscriptionList = await _getSubscriptions(creds, [domain], options.tokenAudience);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"email": "azsdkteam@microsoft.com",
"url": "https://github.com/Azure/ms-rest-nodeauth"
},
"version": "3.0.8",
"version": "3.0.9",
"description": "Azure Authentication library in node.js with type definitions.",
"keywords": [
"node",
Expand Down Expand Up @@ -70,4 +70,4 @@
"test:unit": "mocha",
"check:packagejsonversion": "ts-node ./.scripts/checkPackageJsonVersion.ts"
}
}
}

0 comments on commit 4c17751

Please sign in to comment.