Skip to content

Commit f61d4d5

Browse files
authored
[Identity] Fix undefined dereference (#25829)
1 parent 67cc638 commit f61d4d5

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

sdk/identity/identity/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 3.2.1 (2023-05-10)
4+
5+
### Bug Fixes
6+
- Fixed a bug in `WorkloadIdentity Credential`, to incorporate the case where the options can be `undefined` in a conditional check.
7+
Related issue [#25827](https://github.com/Azure/azure-sdk-for-js/issues/25827) with the fix [#25829](https://github.com/Azure/azure-sdk-for-js/pull/25829).
8+
39
## 3.2.0 (2023-05-09)
410

511
### Breaking Changes

sdk/identity/identity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@azure/identity",
33
"sdk-type": "client",
4-
"version": "3.2.0",
4+
"version": "3.2.1",
55
"description": "Provides credential implementations for Azure SDK libraries that can authenticate with Azure Active Directory",
66
"main": "dist/index.js",
77
"module": "dist-esm/src/index.js",

sdk/identity/identity/review/identity.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ export interface VisualStudioCodeCredentialOptions extends MultiTenantTokenCrede
394394

395395
// @public
396396
export class WorkloadIdentityCredential implements TokenCredential {
397-
constructor(options: WorkloadIdentityCredentialOptions);
397+
constructor(options?: WorkloadIdentityCredentialOptions);
398398
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
399399
}
400400

sdk/identity/identity/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Current version of the `@azure/identity` package.
66
*/
77

8-
export const SDK_VERSION = `3.2.0`;
8+
export const SDK_VERSION = `3.2.1`;
99

1010
/**
1111
* The default client ID for authentication

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ export class WorkloadIdentityCredential implements TokenCredential {
4848
*
4949
* @param options - The identity client options to use for authentication.
5050
*/
51-
constructor(options: WorkloadIdentityCredentialOptions) {
51+
constructor(options?: WorkloadIdentityCredentialOptions) {
5252
// Logging environment variables for error details
5353
const assignedEnv = processEnvVars(SupportedWorkloadEnvironmentVariables).assigned.join(", ");
5454
logger.info(`Found the following environment variables: ${assignedEnv}`);
5555

56-
const workloadIdentityCredentialOptions = options as WorkloadIdentityCredentialOptions;
56+
const workloadIdentityCredentialOptions = options ?? {};
5757
const tenantId = workloadIdentityCredentialOptions.tenantId || process.env.AZURE_TENANT_ID;
5858
const clientId = workloadIdentityCredentialOptions.clientId || process.env.AZURE_CLIENT_ID;
5959
this.federatedTokenFilePath =

0 commit comments

Comments
 (0)