Skip to content

Commit

Permalink
[Identity] Fix undefined dereference (#25829)
Browse files Browse the repository at this point in the history
  • Loading branch information
orgads authored May 10, 2023
1 parent 67cc638 commit f61d4d5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions sdk/identity/identity/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## 3.2.1 (2023-05-10)

### Bug Fixes
- Fixed a bug in `WorkloadIdentity Credential`, to incorporate the case where the options can be `undefined` in a conditional check.
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).

## 3.2.0 (2023-05-09)

### Breaking Changes
Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/identity/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@azure/identity",
"sdk-type": "client",
"version": "3.2.0",
"version": "3.2.1",
"description": "Provides credential implementations for Azure SDK libraries that can authenticate with Azure Active Directory",
"main": "dist/index.js",
"module": "dist-esm/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/identity/review/identity.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export interface VisualStudioCodeCredentialOptions extends MultiTenantTokenCrede

// @public
export class WorkloadIdentityCredential implements TokenCredential {
constructor(options: WorkloadIdentityCredentialOptions);
constructor(options?: WorkloadIdentityCredentialOptions);
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/identity/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Current version of the `@azure/identity` package.
*/

export const SDK_VERSION = `3.2.0`;
export const SDK_VERSION = `3.2.1`;

/**
* The default client ID for authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export class WorkloadIdentityCredential implements TokenCredential {
*
* @param options - The identity client options to use for authentication.
*/
constructor(options: WorkloadIdentityCredentialOptions) {
constructor(options?: WorkloadIdentityCredentialOptions) {
// Logging environment variables for error details
const assignedEnv = processEnvVars(SupportedWorkloadEnvironmentVariables).assigned.join(", ");
logger.info(`Found the following environment variables: ${assignedEnv}`);

const workloadIdentityCredentialOptions = options as WorkloadIdentityCredentialOptions;
const workloadIdentityCredentialOptions = options ?? {};
const tenantId = workloadIdentityCredentialOptions.tenantId || process.env.AZURE_TENANT_ID;
const clientId = workloadIdentityCredentialOptions.clientId || process.env.AZURE_CLIENT_ID;
this.federatedTokenFilePath =
Expand Down

0 comments on commit f61d4d5

Please sign in to comment.