@azure/identity 2.0.0-beta.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @azure/identity might be problematic. Click here for more details.

Files changed (100) hide show
  1. package/CHANGELOG.md +131 -3
  2. package/README.md +51 -3
  3. package/dist/index.js +207 -218
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/client/identityClient.js +2 -2
  6. package/dist-esm/src/client/identityClient.js.map +1 -1
  7. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js +1 -1
  8. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  9. package/dist-esm/src/credentials/{applicationCredential.browser.js → azureApplicationCredential.browser.js} +9 -4
  10. package/dist-esm/src/credentials/azureApplicationCredential.browser.js.map +1 -0
  11. package/dist-esm/src/credentials/azureApplicationCredential.js +36 -0
  12. package/dist-esm/src/credentials/azureApplicationCredential.js.map +1 -0
  13. package/dist-esm/src/credentials/azureCliCredential.browser.js +7 -0
  14. package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
  15. package/dist-esm/src/credentials/azureCliCredential.js +9 -9
  16. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  17. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +3 -1
  18. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
  19. package/dist-esm/src/credentials/azurePowerShellCredential.js +13 -13
  20. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
  21. package/dist-esm/src/credentials/chainedTokenCredential.js +2 -2
  22. package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
  23. package/dist-esm/src/credentials/clientCertificateCredential.browser.js +7 -0
  24. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
  25. package/dist-esm/src/credentials/clientCertificateCredential.js +18 -15
  26. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  27. package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
  28. package/dist-esm/src/credentials/clientSecretCredential.browser.js +1 -1
  29. package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
  30. package/dist-esm/src/credentials/clientSecretCredential.js +1 -1
  31. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  32. package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
  33. package/dist-esm/src/credentials/defaultAzureCredential.js +16 -12
  34. package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
  35. package/dist-esm/src/credentials/deviceCodeCredential.browser.js +7 -0
  36. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
  37. package/dist-esm/src/credentials/deviceCodeCredential.js +14 -0
  38. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  39. package/dist-esm/src/credentials/environmentCredential.browser.js +7 -0
  40. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
  41. package/dist-esm/src/credentials/environmentCredential.js +5 -21
  42. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  43. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +7 -7
  44. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  45. package/dist-esm/src/credentials/interactiveBrowserCredential.js +7 -7
  46. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  47. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  48. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +1 -1
  49. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
  50. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +32 -23
  51. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  52. package/dist-esm/src/credentials/managedIdentityCredential/index.js +2 -2
  53. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  54. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +6 -0
  55. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -1
  56. package/dist-esm/src/credentials/onBehalfOfCredential.js +6 -11
  57. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
  58. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -1
  59. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +1 -1
  60. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
  61. package/dist-esm/src/credentials/usernamePasswordCredential.js +1 -3
  62. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  63. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +6 -0
  64. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  65. package/dist-esm/src/credentials/visualStudioCodeCredential.js +5 -7
  66. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  67. package/dist-esm/src/{client/errors.js → errors.js} +15 -0
  68. package/dist-esm/src/errors.js.map +1 -0
  69. package/dist-esm/src/index.js +1 -4
  70. package/dist-esm/src/index.js.map +1 -1
  71. package/dist-esm/src/msal/browserFlows/browserCommon.js +8 -7
  72. package/dist-esm/src/msal/browserFlows/browserCommon.js.map +1 -1
  73. package/dist-esm/src/msal/browserFlows/msalAuthCode.js +12 -4
  74. package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
  75. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +1 -1
  76. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -1
  77. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +6 -5
  78. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
  79. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +1 -1
  80. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -1
  81. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +1 -1
  82. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
  83. package/dist-esm/src/msal/nodeFlows/nodeCommon.js +13 -7
  84. package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
  85. package/dist-esm/src/msal/utils.js +7 -4
  86. package/dist-esm/src/msal/utils.js.map +1 -1
  87. package/dist-esm/src/util/tracing.js +1 -1
  88. package/dist-esm/src/util/tracing.js.map +1 -1
  89. package/dist-esm/src/util/validateMultiTenant.browser.js +22 -0
  90. package/dist-esm/src/util/validateMultiTenant.browser.js.map +1 -0
  91. package/dist-esm/src/util/validateMultiTenant.js +17 -12
  92. package/dist-esm/src/util/validateMultiTenant.js.map +1 -1
  93. package/package.json +7 -5
  94. package/types/identity.d.ts +133 -233
  95. package/dist-esm/src/client/errors.js.map +0 -1
  96. package/dist-esm/src/credentials/applicationCredential.browser.js.map +0 -1
  97. package/dist-esm/src/credentials/applicationCredential.js +0 -34
  98. package/dist-esm/src/credentials/applicationCredential.js.map +0 -1
  99. package/dist-esm/src/msal/errors.js +0 -22
  100. package/dist-esm/src/msal/errors.js.map +0 -1
@@ -3,6 +3,7 @@ import { AzureLogger } from '@azure/logger';
3
3
  import { CommonClientOptions } from '@azure/core-client';
4
4
  import { GetTokenOptions } from '@azure/core-auth';
5
5
  import { TokenCredential } from '@azure/core-auth';
6
+
6
7
  export { AccessToken }
7
8
 
8
9
  /**
@@ -23,38 +24,6 @@ export declare class AggregateAuthenticationError extends Error {
23
24
  */
24
25
  export declare const AggregateAuthenticationErrorName = "AggregateAuthenticationError";
25
26
 
26
- /**
27
- * Provides a default {@link ChainedTokenCredential} configuration that should
28
- * work for most applications that use the Azure SDK. The following credential
29
- * types will be tried, in order:
30
- *
31
- * - {@link EnvironmentCredential}
32
- * - {@link ManagedIdentityCredential}
33
-
34
- *
35
- * Consult the documentation of these credential types for more information
36
- * on how they attempt authentication.
37
- */
38
- export declare class ApplicationCredential extends ChainedTokenCredential {
39
- /**
40
- * Creates an instance of the ApplicationCredential class.
41
- *
42
- * @param options - Optional parameters. See {@link ApplicationCredentialOptions}.
43
- */
44
- constructor(options?: ApplicationCredentialOptions);
45
- }
46
-
47
- /**
48
- * Provides options to configure the {@link ApplicationCredential} class.
49
- */
50
- export declare interface ApplicationCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
51
- /**
52
- * Optionally pass in a user assigned client ID to be used by the {@link ManagedIdentityCredential}.
53
- * This client ID can also be passed through to the {@link ManagedIdentityCredential} through the environment variable: AZURE_CLIENT_ID.
54
- */
55
- managedIdentityClientId?: string;
56
- }
57
-
58
27
  /**
59
28
  * Provides details about a failure to authenticate with Azure Active
60
29
  * Directory. The `errorResponse` field contains more details about
@@ -112,18 +81,32 @@ export declare class AuthenticationRequiredError extends Error {
112
81
  */
113
82
  scopes: string[];
114
83
  /**
115
- * The options used to configure the getToken request.
84
+ * The options passed to the getToken request.
116
85
  */
117
- getTokenOptions: GetTokenOptions;
86
+ getTokenOptions?: GetTokenOptions;
118
87
  constructor(
88
+ /**
89
+ * Optional parameters. A message can be specified. The {@link GetTokenOptions} of the request can also be specified to more easily associate the error with the received parameters.
90
+ */
91
+ options: AuthenticationRequiredErrorOptions);
92
+ }
93
+
94
+ /**
95
+ * Optional parameters to the {@link AuthenticationRequiredError}
96
+ */
97
+ export declare interface AuthenticationRequiredErrorOptions {
119
98
  /**
120
99
  * The list of scopes for which the token will have access.
121
100
  */
122
- scopes: string[],
101
+ scopes: string[];
123
102
  /**
124
- * The options used to configure the getToken request.
103
+ * The options passed to the getToken request.
125
104
  */
126
- getTokenOptions?: GetTokenOptions, message?: string);
105
+ getTokenOptions?: GetTokenOptions;
106
+ /**
107
+ * The message of the error.
108
+ */
109
+ message?: string;
127
110
  }
128
111
 
129
112
  /**
@@ -154,10 +137,10 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
154
137
  * @param clientId - The client (application) ID of an App Registration in the tenant.
155
138
  * @param clientSecret - A client secret that was generated for the App Registration
156
139
  * @param authorizationCode - An authorization code that was received from following the
157
- authorization code flow. This authorization code must not
158
- have already been used to obtain an access token.
140
+ authorization code flow. This authorization code must not
141
+ have already been used to obtain an access token.
159
142
  * @param redirectUri - The redirect URI that was used to request the authorization code.
160
- Must be the same URI that is configured for the App Registration.
143
+ Must be the same URI that is configured for the App Registration.
161
144
  * @param options - Options for configuring the client which makes the access token request.
162
145
  */
163
146
  constructor(tenantId: string | "common", clientId: string, clientSecret: string, authorizationCode: string, redirectUri: string, options?: TokenCredentialOptions);
@@ -176,10 +159,10 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
176
159
  * 'common' may be used when dealing with multi-tenant scenarios.
177
160
  * @param clientId - The client (application) ID of an App Registration in the tenant.
178
161
  * @param authorizationCode - An authorization code that was received from following the
179
- authorization code flow. This authorization code must not
180
- have already been used to obtain an access token.
162
+ authorization code flow. This authorization code must not
163
+ have already been used to obtain an access token.
181
164
  * @param redirectUri - The redirect URI that was used to request the authorization code.
182
- Must be the same URI that is configured for the App Registration.
165
+ Must be the same URI that is configured for the App Registration.
183
166
  * @param options - Options for configuring the client which makes the access token request.
184
167
  */
185
168
  constructor(tenantId: string | "common", clientId: string, authorizationCode: string, redirectUri: string, options?: TokenCredentialOptions);
@@ -221,15 +204,15 @@ export declare enum AzureAuthorityHosts {
221
204
  * via the Azure CLI ('az') commandline tool.
222
205
  * To do so, it will read the user access token and expire time
223
206
  * with Azure CLI command "az account get-access-token".
224
- * To be able to use this credential, ensure that you have already logged
225
- * in via the 'az' tool using the command "az login" from the commandline.
226
207
  */
227
208
  export declare class AzureCliCredential implements TokenCredential {
228
209
  private tenantId?;
229
- private allowMultiTenantAuthentication?;
230
210
  /**
231
211
  * Creates an instance of the {@link AzureCliCredential}.
232
212
  *
213
+ * To use this credential, ensure that you have already logged
214
+ * in via the 'az' tool using the command "az login" from the commandline.
215
+ *
233
216
  * @param options - Options, to optionally allow multi-tenant requests.
234
217
  */
235
218
  constructor(options?: AzureCliCredentialOptions);
@@ -258,18 +241,17 @@ export declare interface AzureCliCredentialOptions extends TokenCredentialOption
258
241
  * This credential will use the currently logged-in user information from the
259
242
  * Azure PowerShell module. To do so, it will read the user access token and
260
243
  * expire time with Azure PowerShell command `Get-AzAccessToken -ResourceUrl {ResourceScope}`
261
- *
262
- * To be able to use this credential:
263
- * - Install the Azure Az PowerShell module with:
264
- * `Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force`.
265
- * - You have already logged in to Azure PowerShell using the command
266
- * `Connect-AzAccount` from the command line.
267
244
  */
268
245
  export declare class AzurePowerShellCredential implements TokenCredential {
269
246
  private tenantId?;
270
- private allowMultiTenantAuthentication?;
271
247
  /**
272
- * Creates an instance of the {@link AzurePowershellCredential}.
248
+ * Creates an instance of the {@link AzurePowerShellCredential}.
249
+ *
250
+ * To use this credential:
251
+ * - Install the Azure Az PowerShell module with:
252
+ * `Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force`.
253
+ * - You have already logged in to Azure PowerShell using the command
254
+ * `Connect-AzAccount` from the command line.
273
255
  *
274
256
  * @param options - Options, to optionally allow multi-tenant requests.
275
257
  */
@@ -286,7 +268,7 @@ export declare class AzurePowerShellCredential implements TokenCredential {
286
268
  * @param scopes - The list of scopes for which the token will have access.
287
269
  * @param options - The options used to configure any requests this TokenCredential implementation might make.
288
270
  */
289
- getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
271
+ getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
290
272
  }
291
273
 
292
274
  /**
@@ -369,6 +351,17 @@ export declare class ClientCertificateCredential implements TokenCredential {
369
351
  * @param options - Options for configuring the client which makes the authentication request.
370
352
  */
371
353
  constructor(tenantId: string, clientId: string, certificatePath: string, options?: ClientCertificateCredentialOptions);
354
+ /**
355
+ * Creates an instance of the ClientCertificateCredential with the details
356
+ * needed to authenticate against Azure Active Directory with a certificate.
357
+ *
358
+ * @param tenantId - The Azure Active Directory tenant (directory) ID.
359
+ * @param clientId - The client (application) ID of an App Registration in the tenant.
360
+ * @param configuration - Other parameters required, including the PEM-encoded certificate as a string, or as a path on the filesystem.
361
+ * If the type is ignored, we will throw if both the value of the PEM certificate and the path to a PEM certificate are provided at the same time.
362
+ * @param options - Options for configuring the client which makes the authentication request.
363
+ */
364
+ constructor(tenantId: string, clientId: string, configuration: ClientCertificateCredentialPEMConfiguration, options?: ClientCertificateCredentialOptions);
372
365
  /**
373
366
  * Authenticates with Azure Active Directory and returns an access token if successful.
374
367
  * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
@@ -389,13 +382,30 @@ export declare interface ClientCertificateCredentialOptions extends TokenCredent
389
382
  * Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
390
383
  */
391
384
  sendCertificateChain?: boolean;
385
+ }
386
+
387
+ /**
388
+ * Required configuration options for the {@link ClientCertificateCredential}, with either the string contents of a PEM certificate, or the path to a PEM certificate.
389
+ */
390
+ export declare type ClientCertificateCredentialPEMConfiguration = {
392
391
  /**
393
- * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.
394
- * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.
395
- * If the property is not specified, the credential uses the global authority endpoint.
392
+ * The PEM-encoded public/private key certificate on the filesystem.
396
393
  */
397
- regionalAuthority?: string;
398
- }
394
+ certificate: string;
395
+ /**
396
+ * The PEM-encoded public/private key certificate on the filesystem should not be provided if `certificate` is provided.
397
+ */
398
+ certificatePath?: never;
399
+ } | {
400
+ /**
401
+ * The PEM-encoded public/private key certificate on the filesystem should not be provided if `certificatePath` is provided.
402
+ */
403
+ certificate?: never;
404
+ /**
405
+ * The path to the PEM-encoded public/private key certificate on the filesystem.
406
+ */
407
+ certificatePath: string;
408
+ };
399
409
 
400
410
  /**
401
411
  * Enables authentication to Azure Active Directory using a client secret
@@ -433,12 +443,6 @@ export declare class ClientSecretCredential implements TokenCredential {
433
443
  * Optional parameters for the {@link ClientSecretCredential} class.
434
444
  */
435
445
  export declare interface ClientSecretCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
436
- /**
437
- * Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.
438
- * If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.
439
- * If the property is not specified, the credential uses the global authority endpoint.
440
- */
441
- regionalAuthority?: string;
442
446
  }
443
447
 
444
448
  /**
@@ -494,22 +498,26 @@ export declare const CredentialUnavailableErrorName = "CredentialUnavailableErro
494
498
 
495
499
  /**
496
500
  * Provides a default {@link ChainedTokenCredential} configuration that should
497
- * work for most applications that use the Azure SDK. The following credential
498
- * types will be tried, in order:
499
- *
500
- * - {@link EnvironmentCredential}
501
- * - {@link ManagedIdentityCredential}
502
- * - {@link VisualStudioCodeCredential}
503
- * - {@link AzureCliCredential}
504
- * - {@link AzurePowerShellCredential}
505
- *
506
- * Consult the documentation of these credential types for more information
507
- * on how they attempt authentication.
501
+ * work for most applications that use the Azure SDK.
508
502
  */
509
503
  export declare class DefaultAzureCredential extends ChainedTokenCredential {
510
504
  /**
511
505
  * Creates an instance of the DefaultAzureCredential class.
512
506
  *
507
+ * This credential provides a default {@link ChainedTokenCredential} configuration that should
508
+ * work for most applications that use the Azure SDK.
509
+ *
510
+ * The following credential types will be tried, in order:
511
+ *
512
+ * - {@link EnvironmentCredential}
513
+ * - {@link ManagedIdentityCredential}
514
+ * - {@link VisualStudioCodeCredential}
515
+ * - {@link AzureCliCredential}
516
+ * - {@link AzurePowerShellCredential}
517
+ *
518
+ * Consult the documentation of these credential types for more information
519
+ * on how they attempt authentication.
520
+ *
513
521
  * **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
514
522
  * `@azure/identity-vscode`. If this package is not installed and registered
515
523
  * using the plugin API (`useIdentityPlugin`), then authentication using
@@ -523,7 +531,7 @@ export declare class DefaultAzureCredential extends ChainedTokenCredential {
523
531
  /**
524
532
  * Provides options to configure the {@link DefaultAzureCredential} class.
525
533
  */
526
- export declare interface DefaultAzureCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
534
+ export declare interface DefaultAzureCredentialOptions extends TokenCredentialOptions {
527
535
  /**
528
536
  * Optionally pass in a Tenant ID to be used as part of the credential.
529
537
  * By default it may use a generic tenant ID depending on the underlying credential.
@@ -568,6 +576,20 @@ export declare class DeviceCodeCredential implements TokenCredential {
568
576
  * Creates an instance of DeviceCodeCredential with the details needed
569
577
  * to initiate the device code authorization flow with Azure Active Directory.
570
578
  *
579
+ * A message will be logged, giving users a code that they can use to authenticate once they go to https://microsoft.com/devicelogin
580
+ *
581
+ * Developers can configure how this message is shown by passing a custom `userPromptCallback`:
582
+ *
583
+ * ```js
584
+ * const credential = new DeviceCodeCredential({
585
+ * tenantId: env.AZURE_TENANT_ID,
586
+ * clientId: env.AZURE_CLIENT_ID,
587
+ * userPromptCallback: (info) => {
588
+ * console.log("CUSTOMIZED PROMPT CALLBACK", info.message);
589
+ * }
590
+ * });
591
+ * ```
592
+ *
571
593
  * @param options - Options for configuring the client which makes the authentication requests.
572
594
  */
573
595
  constructor(options?: DeviceCodeCredentialOptions);
@@ -648,23 +670,7 @@ export declare type DeviceCodePromptCallback = (deviceCodeInfo: DeviceCodeInfo)
648
670
 
649
671
  /**
650
672
  * Enables authentication to Azure Active Directory using client secret
651
- * details configured in the following environment variables:
652
- *
653
- * Required environment variables:
654
- * - `AZURE_TENANT_ID`: The Azure Active Directory tenant (directory) ID.
655
- * - `AZURE_CLIENT_ID`: The client (application) ID of an App Registration in the tenant.
656
- *
657
- * Environment variables used for client credential authentication:
658
- * - `AZURE_CLIENT_SECRET`: A client secret that was generated for the App Registration.
659
- * - `AZURE_CLIENT_CERTIFICATE_PATH`: The path to a PEM certificate to use during the authentication, instead of the client secret.
660
- *
661
- * Alternatively, users can provide environment variables for username and password authentication:
662
- * - `AZURE_USERNAME`: Username to authenticate with.
663
- * - `AZURE_PASSWORD`: Password to authenticate with.
664
- *
665
- * This credential ultimately uses a {@link ClientSecretCredential} to
666
- * perform the authentication using these details. Please consult the
667
- * documentation of that class for more details.
673
+ * details configured in environment variables
668
674
  */
669
675
  export declare class EnvironmentCredential implements TokenCredential {
670
676
  private _credential?;
@@ -702,7 +708,7 @@ export declare class EnvironmentCredential implements TokenCredential {
702
708
  * Enables authentication to Azure Active Directory depending on the available environment variables.
703
709
  * Defines options for the EnvironmentCredential class.
704
710
  */
705
- export declare interface EnvironmentCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
711
+ export declare interface EnvironmentCredentialOptions extends TokenCredentialOptions {
706
712
  }
707
713
 
708
714
  /**
@@ -744,6 +750,7 @@ export declare interface ErrorResponse {
744
750
  * Returns a new instance of the {@link DefaultAzureCredential}.
745
751
  */
746
752
  export declare function getDefaultAzureCredential(): TokenCredential;
753
+
747
754
  export { GetTokenOptions }
748
755
 
749
756
  /**
@@ -755,13 +762,6 @@ export declare type IdentityPlugin = (context: unknown) => void;
755
762
  /**
756
763
  * Enables authentication to Azure Active Directory inside of the web browser
757
764
  * using the interactive login flow.
758
- *
759
- * This credential uses the [Authorization Code Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow).
760
- * On Node.js, it will open a browser window while it listens for a redirect response from the authentication service.
761
- * On browsers, it authenticates via popups. The `loginStyle` optional parameter can be set to `redirect` to authenticate by redirecting the user to an Azure secure login page, which then will redirect the user back to the web application where the authentication started.
762
- *
763
- * For Node.js, if a `clientId` is provided, the Azure Active Directory application will need to be configured to have a "Mobile and desktop applications" redirect endpoint.
764
- * Follow our guide on [setting up Redirect URIs for Desktop apps that calls to web APIs](https://docs.microsoft.com/azure/active-directory/develop/scenario-desktop-app-registration#redirect-uris).
765
765
  */
766
766
  export declare class InteractiveBrowserCredential implements TokenCredential {
767
767
  private msalFlow;
@@ -769,9 +769,16 @@ export declare class InteractiveBrowserCredential implements TokenCredential {
769
769
  /**
770
770
  * Creates an instance of InteractiveBrowserCredential with the details needed.
771
771
  *
772
+ * This credential uses the [Authorization Code Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow).
773
+ * On Node.js, it will open a browser window while it listens for a redirect response from the authentication service.
774
+ * On browsers, it authenticates via popups. The `loginStyle` optional parameter can be set to `redirect` to authenticate by redirecting the user to an Azure secure login page, which then will redirect the user back to the web application where the authentication started.
775
+ *
776
+ * For Node.js, if a `clientId` is provided, the Azure Active Directory application will need to be configured to have a "Mobile and desktop applications" redirect endpoint.
777
+ * Follow our guide on [setting up Redirect URIs for Desktop apps that calls to web APIs](https://docs.microsoft.com/azure/active-directory/develop/scenario-desktop-app-registration#redirect-uris).
778
+ *
772
779
  * @param options - Options for configuring the client which makes the authentication requests.
773
780
  */
774
- constructor(options?: InteractiveBrowserCredentialOptions | InteractiveBrowserCredentialBrowserOptions);
781
+ constructor(options?: InteractiveBrowserCredentialNodeOptions | InteractiveBrowserCredentialInBrowserOptions);
775
782
  /**
776
783
  * Authenticates with Azure Active Directory and returns an access token if successful.
777
784
  * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
@@ -804,7 +811,7 @@ export declare class InteractiveBrowserCredential implements TokenCredential {
804
811
  /**
805
812
  * Defines the common options for the InteractiveBrowserCredential class.
806
813
  */
807
- export declare interface InteractiveBrowserCredentialBrowserOptions extends InteractiveCredentialOptions {
814
+ export declare interface InteractiveBrowserCredentialInBrowserOptions extends InteractiveCredentialOptions {
808
815
  /**
809
816
  * Gets the redirect URI of the application. This should be same as the value
810
817
  * in the application registration portal. Defaults to `window.location.href`.
@@ -836,7 +843,7 @@ export declare interface InteractiveBrowserCredentialBrowserOptions extends Inte
836
843
  /**
837
844
  * Defines the common options for the InteractiveBrowserCredential class.
838
845
  */
839
- export declare interface InteractiveBrowserCredentialOptions extends InteractiveCredentialOptions, CredentialPersistenceOptions {
846
+ export declare interface InteractiveBrowserCredentialNodeOptions extends InteractiveCredentialOptions, CredentialPersistenceOptions {
840
847
  /**
841
848
  * Gets the redirect URI of the application. This should be same as the value
842
849
  * in the application registration portal. Defaults to `window.location.href`.
@@ -930,7 +937,6 @@ export declare class ManagedIdentityCredential implements TokenCredential {
930
937
  * Enables authentication to Azure Active Directory using the [On Behalf Of flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow).
931
938
  */
932
939
  export declare class OnBehalfOfCredential implements TokenCredential {
933
- private configuration;
934
940
  private options;
935
941
  private msalFlow;
936
942
  /**
@@ -952,10 +958,9 @@ export declare class OnBehalfOfCredential implements TokenCredential {
952
958
  * await client.getKey("key-name");
953
959
  * ```
954
960
  *
955
- * @param configuration - Configuration specific to this credential.
956
961
  * @param options - Optional parameters, generally common across credentials.
957
962
  */
958
- constructor(configuration: OnBehalfOfCredentialSecretConfiguration | OnBehalfOfCredentialCertificateConfiguration, options?: OnBehalfOfCredentialOptions);
963
+ constructor(options: OnBehalfOfCredentialOptions);
959
964
  /**
960
965
  * Authenticates with Azure Active Directory and returns an access token if successful.
961
966
  * If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
@@ -967,9 +972,9 @@ export declare class OnBehalfOfCredential implements TokenCredential {
967
972
  }
968
973
 
969
974
  /**
970
- * Defines the configuration parameters to authenticate the {@link OnBehalfOfCredential} with a certificate.
975
+ * Defines the parameters to authenticate the {@link OnBehalfOfCredential} with a certificate.
971
976
  */
972
- export declare interface OnBehalfOfCredentialCertificateConfiguration {
977
+ export declare interface OnBehalfOfCredentialCertificateOptions {
973
978
  /**
974
979
  * The Azure Active Directory tenant (directory) ID.
975
980
  */
@@ -991,18 +996,21 @@ export declare interface OnBehalfOfCredentialCertificateConfiguration {
991
996
  * The user assertion for the On-Behalf-Of flow.
992
997
  */
993
998
  userAssertionToken: string;
999
+ /**
1000
+ * Client secret should not be provided when certificate options are provided.
1001
+ */
1002
+ clientSecret?: never;
994
1003
  }
995
1004
 
996
1005
  /**
997
1006
  * Optional parameters for the {@link OnBehalfOfCredential} class.
998
1007
  */
999
- export declare interface OnBehalfOfCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
1000
- }
1008
+ export declare type OnBehalfOfCredentialOptions = (OnBehalfOfCredentialSecretOptions | OnBehalfOfCredentialCertificateOptions) & TokenCredentialOptions & CredentialPersistenceOptions;
1001
1009
 
1002
1010
  /**
1003
- * Defines the configuration parameters to authenticate the {@link OnBehalfOfCredential} with a secret.
1011
+ * Defines the parameters to authenticate the {@link OnBehalfOfCredential} with a secret.
1004
1012
  */
1005
- export declare interface OnBehalfOfCredentialSecretConfiguration {
1013
+ export declare interface OnBehalfOfCredentialSecretOptions {
1006
1014
  /**
1007
1015
  * The Azure Active Directory tenant (directory) ID.
1008
1016
  */
@@ -1019,118 +1027,14 @@ export declare interface OnBehalfOfCredentialSecretConfiguration {
1019
1027
  * The user assertion for the On-Behalf-Of flow.
1020
1028
  */
1021
1029
  userAssertionToken: string;
1022
- }
1023
-
1024
- /**
1025
- * Helps specify a regional authority, or "AutoDiscoverRegion" to auto-detect the region.
1026
- */
1027
- export declare enum RegionalAuthority {
1028
- /** Instructs MSAL to attempt to discover the region */
1029
- AutoDiscoverRegion = "AutoDiscoverRegion",
1030
- /** Uses the {@link RegionalAuthority} for the Azure 'westus' region. */
1031
- USWest = "westus",
1032
- /** Uses the {@link RegionalAuthority} for the Azure 'westus2' region. */
1033
- USWest2 = "westus2",
1034
- /** Uses the {@link RegionalAuthority} for the Azure 'centralus' region. */
1035
- USCentral = "centralus",
1036
- /** Uses the {@link RegionalAuthority} for the Azure 'eastus' region. */
1037
- USEast = "eastus",
1038
- /** Uses the {@link RegionalAuthority} for the Azure 'eastus2' region. */
1039
- USEast2 = "eastus2",
1040
- /** Uses the {@link RegionalAuthority} for the Azure 'northcentralus' region. */
1041
- USNorthCentral = "northcentralus",
1042
- /** Uses the {@link RegionalAuthority} for the Azure 'southcentralus' region. */
1043
- USSouthCentral = "southcentralus",
1044
- /** Uses the {@link RegionalAuthority} for the Azure 'westcentralus' region. */
1045
- USWestCentral = "westcentralus",
1046
- /** Uses the {@link RegionalAuthority} for the Azure 'canadacentral' region. */
1047
- CanadaCentral = "canadacentral",
1048
- /** Uses the {@link RegionalAuthority} for the Azure 'canadaeast' region. */
1049
- CanadaEast = "canadaeast",
1050
- /** Uses the {@link RegionalAuthority} for the Azure 'brazilsouth' region. */
1051
- BrazilSouth = "brazilsouth",
1052
- /** Uses the {@link RegionalAuthority} for the Azure 'northeurope' region. */
1053
- EuropeNorth = "northeurope",
1054
- /** Uses the {@link RegionalAuthority} for the Azure 'westeurope' region. */
1055
- EuropeWest = "westeurope",
1056
- /** Uses the {@link RegionalAuthority} for the Azure 'uksouth' region. */
1057
- UKSouth = "uksouth",
1058
- /** Uses the {@link RegionalAuthority} for the Azure 'ukwest' region. */
1059
- UKWest = "ukwest",
1060
- /** Uses the {@link RegionalAuthority} for the Azure 'francecentral' region. */
1061
- FranceCentral = "francecentral",
1062
- /** Uses the {@link RegionalAuthority} for the Azure 'francesouth' region. */
1063
- FranceSouth = "francesouth",
1064
- /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandnorth' region. */
1065
- SwitzerlandNorth = "switzerlandnorth",
1066
- /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandwest' region. */
1067
- SwitzerlandWest = "switzerlandwest",
1068
- /** Uses the {@link RegionalAuthority} for the Azure 'germanynorth' region. */
1069
- GermanyNorth = "germanynorth",
1070
- /** Uses the {@link RegionalAuthority} for the Azure 'germanywestcentral' region. */
1071
- GermanyWestCentral = "germanywestcentral",
1072
- /** Uses the {@link RegionalAuthority} for the Azure 'norwaywest' region. */
1073
- NorwayWest = "norwaywest",
1074
- /** Uses the {@link RegionalAuthority} for the Azure 'norwayeast' region. */
1075
- NorwayEast = "norwayeast",
1076
- /** Uses the {@link RegionalAuthority} for the Azure 'eastasia' region. */
1077
- AsiaEast = "eastasia",
1078
- /** Uses the {@link RegionalAuthority} for the Azure 'southeastasia' region. */
1079
- AsiaSouthEast = "southeastasia",
1080
- /** Uses the {@link RegionalAuthority} for the Azure 'japaneast' region. */
1081
- JapanEast = "japaneast",
1082
- /** Uses the {@link RegionalAuthority} for the Azure 'japanwest' region. */
1083
- JapanWest = "japanwest",
1084
- /** Uses the {@link RegionalAuthority} for the Azure 'australiaeast' region. */
1085
- AustraliaEast = "australiaeast",
1086
- /** Uses the {@link RegionalAuthority} for the Azure 'australiasoutheast' region. */
1087
- AustraliaSouthEast = "australiasoutheast",
1088
- /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral' region. */
1089
- AustraliaCentral = "australiacentral",
1090
- /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral2' region. */
1091
- AustraliaCentral2 = "australiacentral2",
1092
- /** Uses the {@link RegionalAuthority} for the Azure 'centralindia' region. */
1093
- IndiaCentral = "centralindia",
1094
- /** Uses the {@link RegionalAuthority} for the Azure 'southindia' region. */
1095
- IndiaSouth = "southindia",
1096
- /** Uses the {@link RegionalAuthority} for the Azure 'westindia' region. */
1097
- IndiaWest = "westindia",
1098
- /** Uses the {@link RegionalAuthority} for the Azure 'koreasouth' region. */
1099
- KoreaSouth = "koreasouth",
1100
- /** Uses the {@link RegionalAuthority} for the Azure 'koreacentral' region. */
1101
- KoreaCentral = "koreacentral",
1102
- /** Uses the {@link RegionalAuthority} for the Azure 'uaecentral' region. */
1103
- UAECentral = "uaecentral",
1104
- /** Uses the {@link RegionalAuthority} for the Azure 'uaenorth' region. */
1105
- UAENorth = "uaenorth",
1106
- /** Uses the {@link RegionalAuthority} for the Azure 'southafricanorth' region. */
1107
- SouthAfricaNorth = "southafricanorth",
1108
- /** Uses the {@link RegionalAuthority} for the Azure 'southafricawest' region. */
1109
- SouthAfricaWest = "southafricawest",
1110
- /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth' region. */
1111
- ChinaNorth = "chinanorth",
1112
- /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast' region. */
1113
- ChinaEast = "chinaeast",
1114
- /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth2' region. */
1115
- ChinaNorth2 = "chinanorth2",
1116
- /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast2' region. */
1117
- ChinaEast2 = "chinaeast2",
1118
- /** Uses the {@link RegionalAuthority} for the Azure 'germanycentral' region. */
1119
- GermanyCentral = "germanycentral",
1120
- /** Uses the {@link RegionalAuthority} for the Azure 'germanynortheast' region. */
1121
- GermanyNorthEast = "germanynortheast",
1122
- /** Uses the {@link RegionalAuthority} for the Azure 'usgovvirginia' region. */
1123
- GovernmentUSVirginia = "usgovvirginia",
1124
- /** Uses the {@link RegionalAuthority} for the Azure 'usgoviowa' region. */
1125
- GovernmentUSIowa = "usgoviowa",
1126
- /** Uses the {@link RegionalAuthority} for the Azure 'usgovarizona' region. */
1127
- GovernmentUSArizona = "usgovarizona",
1128
- /** Uses the {@link RegionalAuthority} for the Azure 'usgovtexas' region. */
1129
- GovernmentUSTexas = "usgovtexas",
1130
- /** Uses the {@link RegionalAuthority} for the Azure 'usdodeast' region. */
1131
- GovernmentUSDodEast = "usdodeast",
1132
- /** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */
1133
- GovernmentUSDodCentral = "usdodcentral"
1030
+ /**
1031
+ * The path to a PEM-encoded certificate should not be provided when the secret options are provided.
1032
+ */
1033
+ certificatePath?: never;
1034
+ /**
1035
+ * Option to include x5c header should not be provided when the secret options are provided.
1036
+ */
1037
+ sendCertificateChain?: never;
1134
1038
  }
1135
1039
 
1136
1040
  /**
@@ -1172,6 +1076,7 @@ export declare interface TokenCachePersistenceOptions {
1172
1076
  */
1173
1077
  unsafeAllowUnencryptedStorage?: boolean;
1174
1078
  }
1079
+
1175
1080
  export { TokenCredential }
1176
1081
 
1177
1082
  /**
@@ -1185,10 +1090,6 @@ export declare interface TokenCredentialOptions extends CommonClientOptions {
1185
1090
  * The default is "https://login.microsoftonline.com".
1186
1091
  */
1187
1092
  authorityHost?: string;
1188
- /**
1189
- * If set to true, allows authentication flows to change the tenantId of the request if a different tenantId is received from a challenge or through a direct getToken call.
1190
- */
1191
- allowMultiTenantAuthentication?: boolean;
1192
1093
  }
1193
1094
 
1194
1095
  /**
@@ -1262,7 +1163,7 @@ export declare interface UsernamePasswordCredentialOptions extends TokenCredenti
1262
1163
  }
1263
1164
 
1264
1165
  /**
1265
- * Connect to Azure using the credential provided by the VSCode extension 'Azure Account'.
1166
+ * Connects to Azure using the credential provided by the VSCode extension 'Azure Account'.
1266
1167
  * Once the user has logged in via the extension, this credential can share the same refresh token
1267
1168
  * that is cached by the extension.
1268
1169
  */
@@ -1270,7 +1171,6 @@ export declare class VisualStudioCodeCredential implements TokenCredential {
1270
1171
  private identityClient;
1271
1172
  private tenantId;
1272
1173
  private cloudName;
1273
- private allowMultiTenantAuthentication?;
1274
1174
  /**
1275
1175
  * Creates an instance of VisualStudioCodeCredential to use for automatically authenticating via VSCode.
1276
1176
  *
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/client/errors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAuDlC,SAAS,eAAe,CAAC,aAAkB;IACzC,OAAO,CACL,aAAa;QACb,OAAO,aAAa,CAAC,KAAK,KAAK,QAAQ;QACvC,OAAO,aAAa,CAAC,iBAAiB,KAAK,QAAQ,CACpD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAE3E;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IACnD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC7C,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAW5C,wDAAwD;IACxD,YAAY,UAAkB,EAAE,SAA6C;QAC3E,IAAI,aAAa,GAAkB;YACjC,KAAK,EAAE,SAAS;YAChB,gBAAgB,EAAE,oEAAoE;SACvF,CAAC;QAEF,IAAI,eAAe,CAAC,SAAS,CAAC,EAAE;YAC9B,aAAa,GAAG,wCAAwC,CAAC,SAAS,CAAC,CAAC;SACrE;aAAM,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACxC,IAAI;gBACF,iEAAiE;gBACjE,uBAAuB;gBACvB,MAAM,kBAAkB,GAAuB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBACrE,aAAa,GAAG,wCAAwC,CAAC,kBAAkB,CAAC,CAAC;aAC9E;YAAC,OAAO,CAAC,EAAE;gBACV,IAAI,UAAU,KAAK,GAAG,EAAE;oBACtB,aAAa,GAAG;wBACd,KAAK,EAAE,qBAAqB;wBAC5B,gBAAgB,EAAE,4CAA4C;qBAC/D,CAAC;iBACH;qBAAM;oBACL,aAAa,GAAG;wBACd,KAAK,EAAE,eAAe;wBACtB,gBAAgB,EAAE,oDAAoD,SAAS,EAAE;qBAClF,CAAC;iBACH;aACF;SACF;aAAM;YACL,aAAa,GAAG;gBACd,KAAK,EAAE,eAAe;gBACtB,gBAAgB,EAAE,oEAAoE;aACvF,CAAC;SACH;QAED,KAAK,CACH,GAAG,aAAa,CAAC,KAAK,gBAAgB,UAAU,sBAAsB,aAAa,CAAC,gBAAgB,EAAE,CACvG,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QAEnC,iDAAiD;QACjD,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,8BAA8B,CAAC;AAE/E;;;GAGG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IAOrD,YAAY,MAAa,EAAE,YAAqB;QAC9C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,KAAK,CAAC,GAAG,YAAY,KAAK,WAAW,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,iDAAiD;QACjD,IAAI,CAAC,IAAI,GAAG,gCAAgC,CAAC;IAC/C,CAAC;CACF;AAED,SAAS,wCAAwC,CAAC,SAA6B;IAC7E,OAAO;QACL,KAAK,EAAE,SAAS,CAAC,KAAK;QACtB,gBAAgB,EAAE,SAAS,CAAC,iBAAiB;QAC7C,aAAa,EAAE,SAAS,CAAC,cAAc;QACvC,UAAU,EAAE,SAAS,CAAC,WAAW;QACjC,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,OAAO,EAAE,SAAS,CAAC,QAAQ;KAC5B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * See the official documentation for more details:\n *\n * https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code#error-response-1\n *\n * NOTE: This documentation is for v1 OAuth support but the same error\n * response details still apply to v2.\n */\nexport interface ErrorResponse {\n /**\n * The string identifier for the error.\n */\n error: string;\n\n /**\n * The error's description.\n */\n errorDescription: string;\n\n /**\n * An array of codes pertaining to the error(s) that occurred.\n */\n errorCodes?: number[];\n\n /**\n * The timestamp at which the error occurred.\n */\n timestamp?: string;\n\n /**\n * The trace identifier for this error occurrence.\n */\n traceId?: string;\n\n /**\n * The correlation ID to be used for tracking the source of the error.\n */\n correlationId?: string;\n}\n\n/**\n * Used for internal deserialization of OAuth responses. Public model is ErrorResponse\n * @internal\n */\nexport interface OAuthErrorResponse {\n error: string;\n error_description: string;\n error_codes?: number[];\n timestamp?: string;\n trace_id?: string;\n correlation_id?: string;\n}\n\nfunction isErrorResponse(errorResponse: any): errorResponse is OAuthErrorResponse {\n return (\n errorResponse &&\n typeof errorResponse.error === \"string\" &&\n typeof errorResponse.error_description === \"string\"\n );\n}\n\n/**\n * The Error.name value of an CredentialUnavailable\n */\nexport const CredentialUnavailableErrorName = \"CredentialUnavailableError\";\n\n/**\n * This signifies that the credential that was tried in a chained credential\n * was not available to be used as the credential. Rather than treating this as\n * an error that should halt the chain, it's caught and the chain continues\n */\nexport class CredentialUnavailableError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = CredentialUnavailableErrorName;\n }\n}\n\n/**\n * The Error.name value of an AuthenticationError\n */\nexport const AuthenticationErrorName = \"AuthenticationError\";\n\n/**\n * Provides details about a failure to authenticate with Azure Active\n * Directory. The `errorResponse` field contains more details about\n * the specific failure.\n */\nexport class AuthenticationError extends Error {\n /**\n * The HTTP status code returned from the authentication request.\n */\n public readonly statusCode: number;\n\n /**\n * The error response details.\n */\n public readonly errorResponse: ErrorResponse;\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n constructor(statusCode: number, errorBody: object | string | undefined | null) {\n let errorResponse: ErrorResponse = {\n error: \"unknown\",\n errorDescription: \"An unknown error occurred and no additional details are available.\"\n };\n\n if (isErrorResponse(errorBody)) {\n errorResponse = convertOAuthErrorResponseToErrorResponse(errorBody);\n } else if (typeof errorBody === \"string\") {\n try {\n // Most error responses will contain JSON-formatted error details\n // in the response body\n const oauthErrorResponse: OAuthErrorResponse = JSON.parse(errorBody);\n errorResponse = convertOAuthErrorResponseToErrorResponse(oauthErrorResponse);\n } catch (e) {\n if (statusCode === 400) {\n errorResponse = {\n error: \"authority_not_found\",\n errorDescription: \"The specified authority URL was not found.\"\n };\n } else {\n errorResponse = {\n error: \"unknown_error\",\n errorDescription: `An unknown error has occurred. Response body:\\n\\n${errorBody}`\n };\n }\n }\n } else {\n errorResponse = {\n error: \"unknown_error\",\n errorDescription: \"An unknown error occurred and no additional details are available.\"\n };\n }\n\n super(\n `${errorResponse.error}(status code ${statusCode}).\\nMore details:\\n${errorResponse.errorDescription}`\n );\n this.statusCode = statusCode;\n this.errorResponse = errorResponse;\n\n // Ensure that this type reports the correct name\n this.name = AuthenticationErrorName;\n }\n}\n\n/**\n * The Error.name value of an AggregateAuthenticationError\n */\nexport const AggregateAuthenticationErrorName = \"AggregateAuthenticationError\";\n\n/**\n * Provides an `errors` array containing {@link AuthenticationError} instance\n * for authentication failures from credentials in a {@link ChainedTokenCredential}.\n */\nexport class AggregateAuthenticationError extends Error {\n /**\n * The array of error objects that were thrown while trying to authenticate\n * with the credentials in a {@link ChainedTokenCredential}.\n */\n public errors: any[];\n\n constructor(errors: any[], errorMessage?: string) {\n const errorDetail = errors.join(\"\\n\");\n super(`${errorMessage}\\n${errorDetail}`);\n this.errors = errors;\n\n // Ensure that this type reports the correct name\n this.name = AggregateAuthenticationErrorName;\n }\n}\n\nfunction convertOAuthErrorResponseToErrorResponse(errorBody: OAuthErrorResponse): ErrorResponse {\n return {\n error: errorBody.error,\n errorDescription: errorBody.error_description,\n correlationId: errorBody.correlation_id,\n errorCodes: errorBody.error_codes,\n timestamp: errorBody.timestamp,\n traceId: errorBody.trace_id\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"applicationCredential.browser.js","sourceRoot":"","sources":["../../../src/credentials/applicationCredential.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,wBAAwB,GAAG,IAAI,KAAK,CACxC,kGAAkG,CACnG,CAAC;AACF,MAAM,MAAM,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,sBAAsB;IAC/D;;;;OAIG;IACH,YAAY,uBAAgD;QAC1D,KAAK,EAAE,CAAC;QACR,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC;QACvD,MAAM,wBAAwB,CAAC;IACjC,CAAC;IAEM,QAAQ;QACb,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC;QAChE,MAAM,wBAAwB,CAAC;IACjC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AccessToken } from \"@azure/core-auth\";\n\nimport { TokenCredentialOptions } from \"../client/identityClient\";\nimport { credentialLogger, formatError } from \"../util/logging\";\nimport { ChainedTokenCredential } from \"./chainedTokenCredential\";\n\nconst BrowserNotSupportedError = new Error(\n \"ApplicationCredential is not supported in the browser. Use InteractiveBrowserCredential instead.\"\n);\nconst logger = credentialLogger(\"ApplicationCredential\");\n\n/**\n * Provides a default {@link ChainedTokenCredential} configuration for\n * applications that will be deployed to Azure.\n *\n * Only available in NodeJS.\n */\nexport class ApplicationCredential extends ChainedTokenCredential {\n /**\n * Creates an instance of the ApplicationCredential class.\n *\n * @param options - Options for configuring the client which makes the authentication request.\n */\n constructor(_tokenCredentialOptions?: TokenCredentialOptions) {\n super();\n logger.info(formatError(\"\", BrowserNotSupportedError));\n throw BrowserNotSupportedError;\n }\n\n public getToken(): Promise<AccessToken> {\n logger.getToken.info(formatError(\"\", BrowserNotSupportedError));\n throw BrowserNotSupportedError;\n }\n}\n"]}