Skip to content

Commit 191296a

Browse files
[identity] fix workload identity bug (Azure#25119)
### Packages impacted by this PR @azure/identity ### Issues associated with this PR Fixes Azure#25089 ### Describe the problem that is addressed by this PR The options bag may not be defined. Fixed the conditional logic to reflect that otherwise it throws an error. ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [x] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [x] Added a changelog (if necessary)
1 parent bcb5ea5 commit 191296a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

sdk/identity/identity/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Bugs Fixed
1010

11+
- Fixed a bug in `WorkloadIdentity Credential`, to incorporate the case where the options can be `undefined` in a conditional check. Related issue [#25089](https://github.com/Azure/azure-sdk-for-js/issues/25089) with the fix [#25119](https://github.com/Azure/azure-sdk-for-js/pull/25119).
1112
### Other Changes
1213

1314
## 3.2.0-beta.1 (2023-02-28)

sdk/identity/identity/src/credentials/workloadIdentityCredential.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ export class WorkloadIdentityCredential implements TokenCredential {
6262
const workloadIdentityCredentialOptions = options as WorkloadIdentityCredentialOptions;
6363

6464
if (
65-
workloadIdentityCredentialOptions.clientId &&
66-
workloadIdentityCredentialOptions.tenantId &&
67-
workloadIdentityCredentialOptions.federatedTokenFilePath
65+
workloadIdentityCredentialOptions?.clientId &&
66+
workloadIdentityCredentialOptions?.tenantId &&
67+
workloadIdentityCredentialOptions?.federatedTokenFilePath
6868
) {
6969
const tenantId = workloadIdentityCredentialOptions.tenantId;
7070
if (tenantId) {

0 commit comments

Comments
 (0)