forked from Azure/azure-sdk-for-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR Azure#7994 introduced a build break to rollup by referencing `process` inside `DefaultAzureCredential`. This fix adds a browser version of `DefaultAzureCredential` without the reference to `process`.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
sdk/identity/identity/src/credentials/defaultAzureCredential.browser.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { TokenCredentialOptions } from "../client/identityClient"; | ||
import { ChainedTokenCredential } from "./chainedTokenCredential"; | ||
import { EnvironmentCredential } from "./environmentCredential"; | ||
import { ManagedIdentityCredential } from "./managedIdentityCredential"; | ||
import { AzureCliCredential } from "./azureCliCredential"; | ||
import { VSCodeCredential } from "./vscodeCredential"; | ||
|
||
/** | ||
* Provides a default {@link ChainedTokenCredential} configuration for | ||
* applications that will be deployed to Azure. The following credential | ||
* types will be tried, in order: | ||
* | ||
* - {@link EnvironmentCredential} | ||
* - {@link ManagedIdentityCredential} | ||
* | ||
* Consult the documentation of these credential types for more information | ||
* on how they attempt authentication. | ||
*/ | ||
export class DefaultAzureCredential extends ChainedTokenCredential { | ||
/** | ||
* Creates an instance of the DefaultAzureCredential class. | ||
* | ||
* @param options Options for configuring the client which makes the authentication request. | ||
*/ | ||
constructor(tokenCredentialOptions?: TokenCredentialOptions) { | ||
let credentials = []; | ||
credentials.push(new EnvironmentCredential(tokenCredentialOptions)); | ||
credentials.push(new ManagedIdentityCredential(tokenCredentialOptions)); | ||
credentials.push(new AzureCliCredential()); | ||
credentials.push(new VSCodeCredential(tokenCredentialOptions)); | ||
|
||
super(...credentials); | ||
} | ||
} |