@azure/identity 2.0.0-beta.4 → 2.0.1-alpha.20211025.3
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.
- package/CHANGELOG.md +215 -4
- package/README.md +78 -25
- package/dist/index.js +888 -477
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +75 -62
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.browser.js +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.js +12 -74
- package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureApplicationCredential.browser.js +34 -0
- package/dist-esm/src/credentials/azureApplicationCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/azureApplicationCredential.js +36 -0
- package/dist-esm/src/credentials/azureApplicationCredential.js.map +1 -0
- package/dist-esm/src/credentials/azureCliCredential.browser.js +7 -0
- package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.js +10 -10
- package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +3 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azurePowerShellCredential.js +13 -13
- package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
- package/dist-esm/src/credentials/chainedTokenCredential.js +3 -3
- package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js +7 -0
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js +19 -13
- package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.browser.js +17 -19
- package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.js +3 -0
- package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/credentialPersistenceOptions.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.browser.js +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.js +22 -21
- package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js +7 -0
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.js +14 -0
- package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.browser.js +7 -0
- package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.js +5 -21
- package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +7 -7
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.js +7 -7
- package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +31 -12
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +45 -23
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +29 -13
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/constants.js +2 -1
- package/dist-esm/src/credentials/managedIdentityCredential/constants.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +36 -11
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +69 -47
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +19 -17
- package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js +82 -0
- package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -0
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js +16 -4
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +23 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.js +57 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -0
- package/dist-esm/src/credentials/{visualStudioCodeCredentialExtension.js → onBehalfOfCredentialOptions.js} +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +17 -19
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.js +3 -2
- package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +7 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.js +16 -8
- package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js +4 -0
- package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js.map +1 -0
- package/dist-esm/src/{client/errors.js → errors.js} +16 -1
- package/dist-esm/src/errors.js.map +1 -0
- package/dist-esm/src/index.js +3 -4
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/browserCommon.js +8 -7
- package/dist-esm/src/msal/browserFlows/browserCommon.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js +12 -4
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +41 -0
- package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -0
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +49 -29
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +56 -0
- package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -0
- package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +2 -2
- package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/nodeCommon.js +32 -13
- package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js.map +1 -1
- package/dist-esm/src/msal/utils.js +15 -8
- package/dist-esm/src/msal/utils.js.map +1 -1
- package/dist-esm/src/plugins/consumer.browser.js +7 -0
- package/dist-esm/src/plugins/consumer.browser.js.map +1 -0
- package/dist-esm/src/{extensions → plugins}/consumer.js +12 -12
- package/dist-esm/src/plugins/consumer.js.map +1 -0
- package/dist-esm/src/{extensions → plugins}/provider.js +0 -0
- package/dist-esm/src/plugins/provider.js.map +1 -0
- package/dist-esm/src/util/tracing.js +2 -2
- package/dist-esm/src/util/tracing.js.map +1 -1
- package/dist-esm/src/util/validateMultiTenant.browser.js +22 -0
- package/dist-esm/src/util/validateMultiTenant.browser.js.map +1 -0
- package/dist-esm/src/util/validateMultiTenant.js +17 -12
- package/dist-esm/src/util/validateMultiTenant.js.map +1 -1
- package/package.json +38 -21
- package/types/identity.d.ts +250 -225
- package/dist-esm/src/client/errors.js.map +0 -1
- package/dist-esm/src/credentials/visualStudioCodeCredentialExtension.js.map +0 -1
- package/dist-esm/src/extensions/consumer.browser.js +0 -7
- package/dist-esm/src/extensions/consumer.browser.js.map +0 -1
- package/dist-esm/src/extensions/consumer.js.map +0 -1
- package/dist-esm/src/extensions/provider.js.map +0 -1
- package/dist-esm/src/msal/errors.js +0 -22
- package/dist-esm/src/msal/errors.js.map +0 -1
package/types/identity.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AccessToken } from '@azure/core-auth';
|
|
2
2
|
import { AzureLogger } from '@azure/logger';
|
|
3
|
+
import { CommonClientOptions } from '@azure/core-client';
|
|
3
4
|
import { GetTokenOptions } from '@azure/core-auth';
|
|
4
|
-
import { PipelineOptions } from '@azure/core-http';
|
|
5
5
|
import { TokenCredential } from '@azure/core-auth';
|
|
6
|
+
|
|
6
7
|
export { AccessToken }
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -80,18 +81,32 @@ export declare class AuthenticationRequiredError extends Error {
|
|
|
80
81
|
*/
|
|
81
82
|
scopes: string[];
|
|
82
83
|
/**
|
|
83
|
-
* The options
|
|
84
|
+
* The options passed to the getToken request.
|
|
84
85
|
*/
|
|
85
|
-
getTokenOptions
|
|
86
|
+
getTokenOptions?: GetTokenOptions;
|
|
86
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 {
|
|
87
98
|
/**
|
|
88
99
|
* The list of scopes for which the token will have access.
|
|
89
100
|
*/
|
|
90
|
-
scopes: string[]
|
|
101
|
+
scopes: string[];
|
|
91
102
|
/**
|
|
92
|
-
* The options
|
|
103
|
+
* The options passed to the getToken request.
|
|
93
104
|
*/
|
|
94
|
-
getTokenOptions?: GetTokenOptions
|
|
105
|
+
getTokenOptions?: GetTokenOptions;
|
|
106
|
+
/**
|
|
107
|
+
* The message of the error.
|
|
108
|
+
*/
|
|
109
|
+
message?: string;
|
|
95
110
|
}
|
|
96
111
|
|
|
97
112
|
/**
|
|
@@ -102,14 +117,10 @@ export declare class AuthenticationRequiredError extends Error {
|
|
|
102
117
|
* https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
|
|
103
118
|
*/
|
|
104
119
|
export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
105
|
-
private
|
|
106
|
-
private
|
|
107
|
-
private clientId;
|
|
108
|
-
private clientSecret;
|
|
120
|
+
private msalFlow;
|
|
121
|
+
private disableAutomaticAuthentication?;
|
|
109
122
|
private authorizationCode;
|
|
110
123
|
private redirectUri;
|
|
111
|
-
private lastTokenResponse;
|
|
112
|
-
private allowMultiTenantAuthentication?;
|
|
113
124
|
/**
|
|
114
125
|
* Creates an instance of CodeFlowCredential with the details needed
|
|
115
126
|
* to request an access token using an authentication that was obtained
|
|
@@ -126,10 +137,10 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
|
126
137
|
* @param clientId - The client (application) ID of an App Registration in the tenant.
|
|
127
138
|
* @param clientSecret - A client secret that was generated for the App Registration
|
|
128
139
|
* @param authorizationCode - An authorization code that was received from following the
|
|
129
|
-
|
|
130
|
-
|
|
140
|
+
authorization code flow. This authorization code must not
|
|
141
|
+
have already been used to obtain an access token.
|
|
131
142
|
* @param redirectUri - The redirect URI that was used to request the authorization code.
|
|
132
|
-
|
|
143
|
+
Must be the same URI that is configured for the App Registration.
|
|
133
144
|
* @param options - Options for configuring the client which makes the access token request.
|
|
134
145
|
*/
|
|
135
146
|
constructor(tenantId: string | "common", clientId: string, clientSecret: string, authorizationCode: string, redirectUri: string, options?: TokenCredentialOptions);
|
|
@@ -148,10 +159,10 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
|
148
159
|
* 'common' may be used when dealing with multi-tenant scenarios.
|
|
149
160
|
* @param clientId - The client (application) ID of an App Registration in the tenant.
|
|
150
161
|
* @param authorizationCode - An authorization code that was received from following the
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
authorization code flow. This authorization code must not
|
|
163
|
+
have already been used to obtain an access token.
|
|
153
164
|
* @param redirectUri - The redirect URI that was used to request the authorization code.
|
|
154
|
-
|
|
165
|
+
Must be the same URI that is configured for the App Registration.
|
|
155
166
|
* @param options - Options for configuring the client which makes the access token request.
|
|
156
167
|
*/
|
|
157
168
|
constructor(tenantId: string | "common", clientId: string, authorizationCode: string, redirectUri: string, options?: TokenCredentialOptions);
|
|
@@ -193,15 +204,15 @@ export declare enum AzureAuthorityHosts {
|
|
|
193
204
|
* via the Azure CLI ('az') commandline tool.
|
|
194
205
|
* To do so, it will read the user access token and expire time
|
|
195
206
|
* with Azure CLI command "az account get-access-token".
|
|
196
|
-
* To be able to use this credential, ensure that you have already logged
|
|
197
|
-
* in via the 'az' tool using the command "az login" from the commandline.
|
|
198
207
|
*/
|
|
199
208
|
export declare class AzureCliCredential implements TokenCredential {
|
|
200
209
|
private tenantId?;
|
|
201
|
-
private allowMultiTenantAuthentication?;
|
|
202
210
|
/**
|
|
203
211
|
* Creates an instance of the {@link AzureCliCredential}.
|
|
204
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
|
+
*
|
|
205
216
|
* @param options - Options, to optionally allow multi-tenant requests.
|
|
206
217
|
*/
|
|
207
218
|
constructor(options?: AzureCliCredentialOptions);
|
|
@@ -230,18 +241,17 @@ export declare interface AzureCliCredentialOptions extends TokenCredentialOption
|
|
|
230
241
|
* This credential will use the currently logged-in user information from the
|
|
231
242
|
* Azure PowerShell module. To do so, it will read the user access token and
|
|
232
243
|
* expire time with Azure PowerShell command `Get-AzAccessToken -ResourceUrl {ResourceScope}`
|
|
233
|
-
*
|
|
234
|
-
* To be able to use this credential:
|
|
235
|
-
* - Install the Azure Az PowerShell module with:
|
|
236
|
-
* `Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force`.
|
|
237
|
-
* - You have already logged in to Azure PowerShell using the command
|
|
238
|
-
* `Connect-AzAccount` from the command line.
|
|
239
244
|
*/
|
|
240
245
|
export declare class AzurePowerShellCredential implements TokenCredential {
|
|
241
246
|
private tenantId?;
|
|
242
|
-
private allowMultiTenantAuthentication?;
|
|
243
247
|
/**
|
|
244
|
-
* Creates an instance of the {@link
|
|
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.
|
|
245
255
|
*
|
|
246
256
|
* @param options - Options, to optionally allow multi-tenant requests.
|
|
247
257
|
*/
|
|
@@ -258,7 +268,7 @@ export declare class AzurePowerShellCredential implements TokenCredential {
|
|
|
258
268
|
* @param scopes - The list of scopes for which the token will have access.
|
|
259
269
|
* @param options - The options used to configure any requests this TokenCredential implementation might make.
|
|
260
270
|
*/
|
|
261
|
-
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken
|
|
271
|
+
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
262
272
|
}
|
|
263
273
|
|
|
264
274
|
/**
|
|
@@ -341,6 +351,17 @@ export declare class ClientCertificateCredential implements TokenCredential {
|
|
|
341
351
|
* @param options - Options for configuring the client which makes the authentication request.
|
|
342
352
|
*/
|
|
343
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);
|
|
344
365
|
/**
|
|
345
366
|
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
346
367
|
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
@@ -361,13 +382,30 @@ export declare interface ClientCertificateCredentialOptions extends TokenCredent
|
|
|
361
382
|
* Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
|
|
362
383
|
*/
|
|
363
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 = {
|
|
364
391
|
/**
|
|
365
|
-
*
|
|
366
|
-
* If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.
|
|
367
|
-
* If the property is not specified, the credential uses the global authority endpoint.
|
|
392
|
+
* The PEM-encoded public/private key certificate on the filesystem.
|
|
368
393
|
*/
|
|
369
|
-
|
|
370
|
-
|
|
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
|
+
};
|
|
371
409
|
|
|
372
410
|
/**
|
|
373
411
|
* Enables authentication to Azure Active Directory using a client secret
|
|
@@ -405,12 +443,6 @@ export declare class ClientSecretCredential implements TokenCredential {
|
|
|
405
443
|
* Optional parameters for the {@link ClientSecretCredential} class.
|
|
406
444
|
*/
|
|
407
445
|
export declare interface ClientSecretCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
|
|
408
|
-
/**
|
|
409
|
-
* Specifies a regional authority. Please refer to the {@link RegionalAuthority} type for the accepted values.
|
|
410
|
-
* If {@link RegionalAuthority.AutoDiscoverRegion} is specified, we will try to discover the regional authority endpoint.
|
|
411
|
-
* If the property is not specified, the credential uses the global authority endpoint.
|
|
412
|
-
*/
|
|
413
|
-
regionalAuthority?: string;
|
|
414
446
|
}
|
|
415
447
|
|
|
416
448
|
/**
|
|
@@ -422,21 +454,21 @@ export declare interface CredentialPersistenceOptions {
|
|
|
422
454
|
* Options to provide to the persistence layer (if one is available) when
|
|
423
455
|
* storing credentials.
|
|
424
456
|
*
|
|
425
|
-
* You must first register a persistence provider
|
|
457
|
+
* You must first register a persistence provider plugin. See the
|
|
426
458
|
* `@azure/identity-cache-persistence` package on NPM.
|
|
427
459
|
*
|
|
428
460
|
* Example:
|
|
429
461
|
*
|
|
430
|
-
* ```
|
|
431
|
-
* import
|
|
432
|
-
* import {
|
|
462
|
+
* ```javascript
|
|
463
|
+
* import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
464
|
+
* import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
|
|
433
465
|
*
|
|
434
|
-
*
|
|
466
|
+
* useIdentityPlugin(cachePersistencePlugin);
|
|
435
467
|
*
|
|
436
468
|
* async function main() {
|
|
437
469
|
* const credential = new DeviceCodeCredential({
|
|
438
470
|
* tokenCachePersistenceOptions: {
|
|
439
|
-
*
|
|
471
|
+
* enabled: true
|
|
440
472
|
* }
|
|
441
473
|
* });
|
|
442
474
|
* }
|
|
@@ -446,7 +478,7 @@ export declare interface CredentialPersistenceOptions {
|
|
|
446
478
|
* process.exit(1);
|
|
447
479
|
* });
|
|
448
480
|
* ```
|
|
449
|
-
|
|
481
|
+
*/
|
|
450
482
|
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
|
|
451
483
|
}
|
|
452
484
|
|
|
@@ -466,30 +498,31 @@ export declare const CredentialUnavailableErrorName = "CredentialUnavailableErro
|
|
|
466
498
|
|
|
467
499
|
/**
|
|
468
500
|
* Provides a default {@link ChainedTokenCredential} configuration that should
|
|
469
|
-
* work for most applications that use the Azure SDK.
|
|
470
|
-
* types will be tried, in order:
|
|
471
|
-
*
|
|
472
|
-
* - {@link EnvironmentCredential}
|
|
473
|
-
* - {@link ManagedIdentityCredential}
|
|
474
|
-
* - {@link VisualStudioCodeCredential}
|
|
475
|
-
* - {@link AzureCliCredential}
|
|
476
|
-
* - {@link AzurePowerShellCredential}
|
|
477
|
-
*
|
|
478
|
-
* Consult the documentation of these credential types for more information
|
|
479
|
-
* on how they attempt authentication.
|
|
480
|
-
*
|
|
481
|
-
* **Note**: `VisualStudioCodeCredential` is provided by an extension package:
|
|
482
|
-
* `@azure/identity-vscode`. If this package is not installed and registered
|
|
483
|
-
* using the extension API (`useIdentityExtension`), then authentication using
|
|
484
|
-
* `VisualStudioCodeCredential` will not be available.
|
|
485
|
-
*
|
|
486
|
-
* Azure Identity extensions may add credential types to the default credential
|
|
487
|
-
* stack.
|
|
501
|
+
* work for most applications that use the Azure SDK.
|
|
488
502
|
*/
|
|
489
503
|
export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
490
504
|
/**
|
|
491
505
|
* Creates an instance of the DefaultAzureCredential class.
|
|
492
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
|
+
*
|
|
521
|
+
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
|
|
522
|
+
* `@azure/identity-vscode`. If this package is not installed and registered
|
|
523
|
+
* using the plugin API (`useIdentityPlugin`), then authentication using
|
|
524
|
+
* `VisualStudioCodeCredential` will not be available.
|
|
525
|
+
*
|
|
493
526
|
* @param options - Optional parameters. See {@link DefaultAzureCredentialOptions}.
|
|
494
527
|
*/
|
|
495
528
|
constructor(options?: DefaultAzureCredentialOptions);
|
|
@@ -498,7 +531,7 @@ export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
|
498
531
|
/**
|
|
499
532
|
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
500
533
|
*/
|
|
501
|
-
export declare interface DefaultAzureCredentialOptions extends TokenCredentialOptions
|
|
534
|
+
export declare interface DefaultAzureCredentialOptions extends TokenCredentialOptions {
|
|
502
535
|
/**
|
|
503
536
|
* Optionally pass in a Tenant ID to be used as part of the credential.
|
|
504
537
|
* By default it may use a generic tenant ID depending on the underlying credential.
|
|
@@ -543,6 +576,20 @@ export declare class DeviceCodeCredential implements TokenCredential {
|
|
|
543
576
|
* Creates an instance of DeviceCodeCredential with the details needed
|
|
544
577
|
* to initiate the device code authorization flow with Azure Active Directory.
|
|
545
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
|
+
*
|
|
546
593
|
* @param options - Options for configuring the client which makes the authentication requests.
|
|
547
594
|
*/
|
|
548
595
|
constructor(options?: DeviceCodeCredentialOptions);
|
|
@@ -573,7 +620,7 @@ export declare class DeviceCodeCredential implements TokenCredential {
|
|
|
573
620
|
}
|
|
574
621
|
|
|
575
622
|
/**
|
|
576
|
-
* Defines options for the InteractiveBrowserCredential class for
|
|
623
|
+
* Defines options for the InteractiveBrowserCredential class for Node.js.
|
|
577
624
|
*/
|
|
578
625
|
export declare interface DeviceCodeCredentialOptions extends InteractiveCredentialOptions, CredentialPersistenceOptions {
|
|
579
626
|
/**
|
|
@@ -623,23 +670,7 @@ export declare type DeviceCodePromptCallback = (deviceCodeInfo: DeviceCodeInfo)
|
|
|
623
670
|
|
|
624
671
|
/**
|
|
625
672
|
* Enables authentication to Azure Active Directory using client secret
|
|
626
|
-
* details configured in
|
|
627
|
-
*
|
|
628
|
-
* Required environment variables:
|
|
629
|
-
* - `AZURE_TENANT_ID`: The Azure Active Directory tenant (directory) ID.
|
|
630
|
-
* - `AZURE_CLIENT_ID`: The client (application) ID of an App Registration in the tenant.
|
|
631
|
-
*
|
|
632
|
-
* Environment variables used for client credential authentication:
|
|
633
|
-
* - `AZURE_CLIENT_SECRET`: A client secret that was generated for the App Registration.
|
|
634
|
-
* - `AZURE_CLIENT_CERTIFICATE_PATH`: The path to a PEM certificate to use during the authentication, instead of the client secret.
|
|
635
|
-
*
|
|
636
|
-
* Alternatively, users can provide environment variables for username and password authentication:
|
|
637
|
-
* - `AZURE_USERNAME`: Username to authenticate with.
|
|
638
|
-
* - `AZURE_PASSWORD`: Password to authenticate with.
|
|
639
|
-
*
|
|
640
|
-
* This credential ultimately uses a {@link ClientSecretCredential} to
|
|
641
|
-
* perform the authentication using these details. Please consult the
|
|
642
|
-
* documentation of that class for more details.
|
|
673
|
+
* details configured in environment variables
|
|
643
674
|
*/
|
|
644
675
|
export declare class EnvironmentCredential implements TokenCredential {
|
|
645
676
|
private _credential?;
|
|
@@ -677,7 +708,7 @@ export declare class EnvironmentCredential implements TokenCredential {
|
|
|
677
708
|
* Enables authentication to Azure Active Directory depending on the available environment variables.
|
|
678
709
|
* Defines options for the EnvironmentCredential class.
|
|
679
710
|
*/
|
|
680
|
-
export declare interface EnvironmentCredentialOptions extends TokenCredentialOptions
|
|
711
|
+
export declare interface EnvironmentCredentialOptions extends TokenCredentialOptions {
|
|
681
712
|
}
|
|
682
713
|
|
|
683
714
|
/**
|
|
@@ -719,24 +750,18 @@ export declare interface ErrorResponse {
|
|
|
719
750
|
* Returns a new instance of the {@link DefaultAzureCredential}.
|
|
720
751
|
*/
|
|
721
752
|
export declare function getDefaultAzureCredential(): TokenCredential;
|
|
753
|
+
|
|
722
754
|
export { GetTokenOptions }
|
|
723
755
|
|
|
724
756
|
/**
|
|
725
|
-
* The type of an Azure Identity
|
|
757
|
+
* The type of an Azure Identity plugin, a function accepting a plugin
|
|
726
758
|
* context.
|
|
727
759
|
*/
|
|
728
|
-
export declare type
|
|
760
|
+
export declare type IdentityPlugin = (context: unknown) => void;
|
|
729
761
|
|
|
730
762
|
/**
|
|
731
763
|
* Enables authentication to Azure Active Directory inside of the web browser
|
|
732
764
|
* using the interactive login flow.
|
|
733
|
-
*
|
|
734
|
-
* This credential uses the [Authorization Code Flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow).
|
|
735
|
-
* On NodeJS, it will open a browser window while it listens for a redirect response from the authentication service.
|
|
736
|
-
* 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.
|
|
737
|
-
*
|
|
738
|
-
* 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.
|
|
739
|
-
* 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).
|
|
740
765
|
*/
|
|
741
766
|
export declare class InteractiveBrowserCredential implements TokenCredential {
|
|
742
767
|
private msalFlow;
|
|
@@ -744,9 +769,16 @@ export declare class InteractiveBrowserCredential implements TokenCredential {
|
|
|
744
769
|
/**
|
|
745
770
|
* Creates an instance of InteractiveBrowserCredential with the details needed.
|
|
746
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
|
+
*
|
|
747
779
|
* @param options - Options for configuring the client which makes the authentication requests.
|
|
748
780
|
*/
|
|
749
|
-
constructor(options?:
|
|
781
|
+
constructor(options?: InteractiveBrowserCredentialNodeOptions | InteractiveBrowserCredentialInBrowserOptions);
|
|
750
782
|
/**
|
|
751
783
|
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
752
784
|
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
@@ -779,7 +811,7 @@ export declare class InteractiveBrowserCredential implements TokenCredential {
|
|
|
779
811
|
/**
|
|
780
812
|
* Defines the common options for the InteractiveBrowserCredential class.
|
|
781
813
|
*/
|
|
782
|
-
export declare interface
|
|
814
|
+
export declare interface InteractiveBrowserCredentialInBrowserOptions extends InteractiveCredentialOptions {
|
|
783
815
|
/**
|
|
784
816
|
* Gets the redirect URI of the application. This should be same as the value
|
|
785
817
|
* in the application registration portal. Defaults to `window.location.href`.
|
|
@@ -811,7 +843,7 @@ export declare interface InteractiveBrowserCredentialBrowserOptions extends Inte
|
|
|
811
843
|
/**
|
|
812
844
|
* Defines the common options for the InteractiveBrowserCredential class.
|
|
813
845
|
*/
|
|
814
|
-
export declare interface
|
|
846
|
+
export declare interface InteractiveBrowserCredentialNodeOptions extends InteractiveCredentialOptions, CredentialPersistenceOptions {
|
|
815
847
|
/**
|
|
816
848
|
* Gets the redirect URI of the application. This should be same as the value
|
|
817
849
|
* in the application registration portal. Defaults to `window.location.href`.
|
|
@@ -902,115 +934,107 @@ export declare class ManagedIdentityCredential implements TokenCredential {
|
|
|
902
934
|
}
|
|
903
935
|
|
|
904
936
|
/**
|
|
905
|
-
*
|
|
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).
|
|
938
|
+
*/
|
|
939
|
+
export declare class OnBehalfOfCredential implements TokenCredential {
|
|
940
|
+
private options;
|
|
941
|
+
private msalFlow;
|
|
942
|
+
/**
|
|
943
|
+
* Creates an instance of the {@link OnBehalfOfCredential} with the details
|
|
944
|
+
* needed to authenticate against Azure Active Directory with a client
|
|
945
|
+
* secret or a path to a PEM certificate, and an user assertion.
|
|
946
|
+
*
|
|
947
|
+
* Example using the `KeyClient` from [\@azure/keyvault-keys](https://www.npmjs.com/package/\@azure/keyvault-keys):
|
|
948
|
+
*
|
|
949
|
+
* ```ts
|
|
950
|
+
* const tokenCredential = new OnBehalfOfCredential({
|
|
951
|
+
* tenantId,
|
|
952
|
+
* clientId,
|
|
953
|
+
* clientSecret, // or `certificatePath: "/path/to/certificate.pem"
|
|
954
|
+
* userAssertionToken: "access-token"
|
|
955
|
+
* });
|
|
956
|
+
* const client = new KeyClient("vault-url", tokenCredential);
|
|
957
|
+
*
|
|
958
|
+
* await client.getKey("key-name");
|
|
959
|
+
* ```
|
|
960
|
+
*
|
|
961
|
+
* @param options - Optional parameters, generally common across credentials.
|
|
962
|
+
*/
|
|
963
|
+
constructor(options: OnBehalfOfCredentialOptions);
|
|
964
|
+
/**
|
|
965
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
966
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
967
|
+
*
|
|
968
|
+
* @param scopes - The list of scopes for which the token will have access.
|
|
969
|
+
* @param options - The options used to configure the underlying network requests.
|
|
970
|
+
*/
|
|
971
|
+
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Defines the parameters to authenticate the {@link OnBehalfOfCredential} with a certificate.
|
|
976
|
+
*/
|
|
977
|
+
export declare interface OnBehalfOfCredentialCertificateOptions {
|
|
978
|
+
/**
|
|
979
|
+
* The Azure Active Directory tenant (directory) ID.
|
|
980
|
+
*/
|
|
981
|
+
tenantId: string;
|
|
982
|
+
/**
|
|
983
|
+
* The client (application) ID of an App Registration in the tenant.
|
|
984
|
+
*/
|
|
985
|
+
clientId: string;
|
|
986
|
+
/**
|
|
987
|
+
* The path to a PEM-encoded public/private key certificate on the filesystem.
|
|
988
|
+
*/
|
|
989
|
+
certificatePath: string;
|
|
990
|
+
/**
|
|
991
|
+
* Option to include x5c header for SubjectName and Issuer name authorization.
|
|
992
|
+
* Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
|
|
993
|
+
*/
|
|
994
|
+
sendCertificateChain?: boolean;
|
|
995
|
+
/**
|
|
996
|
+
* The user assertion for the On-Behalf-Of flow.
|
|
997
|
+
*/
|
|
998
|
+
userAssertionToken: string;
|
|
999
|
+
/**
|
|
1000
|
+
* Client secret should not be provided when certificate options are provided.
|
|
1001
|
+
*/
|
|
1002
|
+
clientSecret?: never;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Optional parameters for the {@link OnBehalfOfCredential} class.
|
|
1007
|
+
*/
|
|
1008
|
+
export declare type OnBehalfOfCredentialOptions = (OnBehalfOfCredentialSecretOptions | OnBehalfOfCredentialCertificateOptions) & TokenCredentialOptions & CredentialPersistenceOptions;
|
|
1009
|
+
|
|
1010
|
+
/**
|
|
1011
|
+
* Defines the parameters to authenticate the {@link OnBehalfOfCredential} with a secret.
|
|
906
1012
|
*/
|
|
907
|
-
export declare
|
|
908
|
-
/**
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
/**
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
/**
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
/**
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
/**
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'northeurope' region. */
|
|
933
|
-
EuropeNorth = "northeurope",
|
|
934
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'westeurope' region. */
|
|
935
|
-
EuropeWest = "westeurope",
|
|
936
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'uksouth' region. */
|
|
937
|
-
UKSouth = "uksouth",
|
|
938
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'ukwest' region. */
|
|
939
|
-
UKWest = "ukwest",
|
|
940
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'francecentral' region. */
|
|
941
|
-
FranceCentral = "francecentral",
|
|
942
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'francesouth' region. */
|
|
943
|
-
FranceSouth = "francesouth",
|
|
944
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'switzerlandnorth' region. */
|
|
945
|
-
SwitzerlandNorth = "switzerlandnorth",
|
|
946
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'switzerlandwest' region. */
|
|
947
|
-
SwitzerlandWest = "switzerlandwest",
|
|
948
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'germanynorth' region. */
|
|
949
|
-
GermanyNorth = "germanynorth",
|
|
950
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'germanywestcentral' region. */
|
|
951
|
-
GermanyWestCentral = "germanywestcentral",
|
|
952
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'norwaywest' region. */
|
|
953
|
-
NorwayWest = "norwaywest",
|
|
954
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'norwayeast' region. */
|
|
955
|
-
NorwayEast = "norwayeast",
|
|
956
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'eastasia' region. */
|
|
957
|
-
AsiaEast = "eastasia",
|
|
958
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'southeastasia' region. */
|
|
959
|
-
AsiaSouthEast = "southeastasia",
|
|
960
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'japaneast' region. */
|
|
961
|
-
JapanEast = "japaneast",
|
|
962
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'japanwest' region. */
|
|
963
|
-
JapanWest = "japanwest",
|
|
964
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'australiaeast' region. */
|
|
965
|
-
AustraliaEast = "australiaeast",
|
|
966
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'australiasoutheast' region. */
|
|
967
|
-
AustraliaSouthEast = "australiasoutheast",
|
|
968
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'australiacentral' region. */
|
|
969
|
-
AustraliaCentral = "australiacentral",
|
|
970
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'australiacentral2' region. */
|
|
971
|
-
AustraliaCentral2 = "australiacentral2",
|
|
972
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'centralindia' region. */
|
|
973
|
-
IndiaCentral = "centralindia",
|
|
974
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'southindia' region. */
|
|
975
|
-
IndiaSouth = "southindia",
|
|
976
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'westindia' region. */
|
|
977
|
-
IndiaWest = "westindia",
|
|
978
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'koreasouth' region. */
|
|
979
|
-
KoreaSouth = "koreasouth",
|
|
980
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'koreacentral' region. */
|
|
981
|
-
KoreaCentral = "koreacentral",
|
|
982
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'uaecentral' region. */
|
|
983
|
-
UAECentral = "uaecentral",
|
|
984
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'uaenorth' region. */
|
|
985
|
-
UAENorth = "uaenorth",
|
|
986
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'southafricanorth' region. */
|
|
987
|
-
SouthAfricaNorth = "southafricanorth",
|
|
988
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'southafricawest' region. */
|
|
989
|
-
SouthAfricaWest = "southafricawest",
|
|
990
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'chinanorth' region. */
|
|
991
|
-
ChinaNorth = "chinanorth",
|
|
992
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'chinaeast' region. */
|
|
993
|
-
ChinaEast = "chinaeast",
|
|
994
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'chinanorth2' region. */
|
|
995
|
-
ChinaNorth2 = "chinanorth2",
|
|
996
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'chinaeast2' region. */
|
|
997
|
-
ChinaEast2 = "chinaeast2",
|
|
998
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'germanycentral' region. */
|
|
999
|
-
GermanyCentral = "germanycentral",
|
|
1000
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'germanynortheast' region. */
|
|
1001
|
-
GermanyNorthEast = "germanynortheast",
|
|
1002
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'usgovvirginia' region. */
|
|
1003
|
-
GovernmentUSVirginia = "usgovvirginia",
|
|
1004
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'usgoviowa' region. */
|
|
1005
|
-
GovernmentUSIowa = "usgoviowa",
|
|
1006
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'usgovarizona' region. */
|
|
1007
|
-
GovernmentUSArizona = "usgovarizona",
|
|
1008
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'usgovtexas' region. */
|
|
1009
|
-
GovernmentUSTexas = "usgovtexas",
|
|
1010
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'usdodeast' region. */
|
|
1011
|
-
GovernmentUSDodEast = "usdodeast",
|
|
1012
|
-
/** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */
|
|
1013
|
-
GovernmentUSDodCentral = "usdodcentral"
|
|
1013
|
+
export declare interface OnBehalfOfCredentialSecretOptions {
|
|
1014
|
+
/**
|
|
1015
|
+
* The Azure Active Directory tenant (directory) ID.
|
|
1016
|
+
*/
|
|
1017
|
+
tenantId: string;
|
|
1018
|
+
/**
|
|
1019
|
+
* The client (application) ID of an App Registration in the tenant.
|
|
1020
|
+
*/
|
|
1021
|
+
clientId: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* A client secret that was generated for the App Registration.
|
|
1024
|
+
*/
|
|
1025
|
+
clientSecret: string;
|
|
1026
|
+
/**
|
|
1027
|
+
* The user assertion for the On-Behalf-Of flow.
|
|
1028
|
+
*/
|
|
1029
|
+
userAssertionToken: string;
|
|
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;
|
|
1014
1038
|
}
|
|
1015
1039
|
|
|
1016
1040
|
/**
|
|
@@ -1042,8 +1066,7 @@ export declare interface TokenCachePersistenceOptions {
|
|
|
1042
1066
|
*
|
|
1043
1067
|
* Based on this identifier, the persistence file will be located in any of the following places:
|
|
1044
1068
|
* - Darwin: '/Users/user/.IdentityService/<name>'
|
|
1045
|
-
* - Windows 8
|
|
1046
|
-
* - Windows XP: 'C:\\Documents and Settings\\user\\Application Data\\Local\\.IdentityService\\<name>'
|
|
1069
|
+
* - Windows 8+: 'C:\\Users\\user\\AppData\\Local\\.IdentityService\\<name>'
|
|
1047
1070
|
* - Linux: '/home/user/.IdentityService/<name>'
|
|
1048
1071
|
*/
|
|
1049
1072
|
name?: string;
|
|
@@ -1051,29 +1074,27 @@ export declare interface TokenCachePersistenceOptions {
|
|
|
1051
1074
|
* If set to true, the cache will be stored without encryption if no OS level user encryption is available.
|
|
1052
1075
|
* When set to false, the PersistentTokenCache will throw an error if no OS level user encryption is available.
|
|
1053
1076
|
*/
|
|
1054
|
-
|
|
1077
|
+
unsafeAllowUnencryptedStorage?: boolean;
|
|
1055
1078
|
}
|
|
1079
|
+
|
|
1056
1080
|
export { TokenCredential }
|
|
1057
1081
|
|
|
1058
1082
|
/**
|
|
1059
1083
|
* Provides options to configure how the Identity library makes authentication
|
|
1060
1084
|
* requests to Azure Active Directory.
|
|
1061
1085
|
*/
|
|
1062
|
-
export declare interface TokenCredentialOptions extends
|
|
1086
|
+
export declare interface TokenCredentialOptions extends CommonClientOptions {
|
|
1063
1087
|
/**
|
|
1064
1088
|
* The authority host to use for authentication requests.
|
|
1089
|
+
* Possible values are available through {@link AzureAuthorityHosts}.
|
|
1065
1090
|
* The default is "https://login.microsoftonline.com".
|
|
1066
1091
|
*/
|
|
1067
1092
|
authorityHost?: string;
|
|
1068
|
-
/**
|
|
1069
|
-
* 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.
|
|
1070
|
-
*/
|
|
1071
|
-
allowMultiTenantAuthentication?: boolean;
|
|
1072
1093
|
}
|
|
1073
1094
|
|
|
1074
1095
|
/**
|
|
1075
|
-
* Extend Azure Identity with additional functionality. Pass
|
|
1076
|
-
*
|
|
1096
|
+
* Extend Azure Identity with additional functionality. Pass a plugin from
|
|
1097
|
+
* a plugin package, such as:
|
|
1077
1098
|
*
|
|
1078
1099
|
* - `@azure/identity-cache-persistence`: provides persistent token caching
|
|
1079
1100
|
* - `@azure/identity-vscode`: provides the dependencies of
|
|
@@ -1082,12 +1103,12 @@ export declare interface TokenCredentialOptions extends PipelineOptions {
|
|
|
1082
1103
|
* Example:
|
|
1083
1104
|
*
|
|
1084
1105
|
* ```javascript
|
|
1085
|
-
* import {
|
|
1106
|
+
* import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
1086
1107
|
*
|
|
1087
|
-
* import {
|
|
1088
|
-
*
|
|
1108
|
+
* import { useIdentityPlugin, DefaultAzureCredential } from "@azure/identity";
|
|
1109
|
+
* useIdentityPlugin(cachePersistencePlugin);
|
|
1089
1110
|
*
|
|
1090
|
-
* // The
|
|
1111
|
+
* // The plugin has the capability to extend `DefaultAzureCredential` and to
|
|
1091
1112
|
* // add middleware to the underlying credentials, such as persistence.
|
|
1092
1113
|
* const credential = new DefaultAzureCredential({
|
|
1093
1114
|
* tokenCachePersistenceOptions: {
|
|
@@ -1096,9 +1117,9 @@ export declare interface TokenCredentialOptions extends PipelineOptions {
|
|
|
1096
1117
|
* });
|
|
1097
1118
|
* ```
|
|
1098
1119
|
*
|
|
1099
|
-
* @param
|
|
1120
|
+
* @param plugin - the plugin to register
|
|
1100
1121
|
*/
|
|
1101
|
-
export declare function
|
|
1122
|
+
export declare function useIdentityPlugin(plugin: IdentityPlugin): void;
|
|
1102
1123
|
|
|
1103
1124
|
/**
|
|
1104
1125
|
* Enables authentication to Azure Active Directory with a user's
|
|
@@ -1142,7 +1163,7 @@ export declare interface UsernamePasswordCredentialOptions extends TokenCredenti
|
|
|
1142
1163
|
}
|
|
1143
1164
|
|
|
1144
1165
|
/**
|
|
1145
|
-
*
|
|
1166
|
+
* Connects to Azure using the credential provided by the VSCode extension 'Azure Account'.
|
|
1146
1167
|
* Once the user has logged in via the extension, this credential can share the same refresh token
|
|
1147
1168
|
* that is cached by the extension.
|
|
1148
1169
|
*/
|
|
@@ -1150,10 +1171,14 @@ export declare class VisualStudioCodeCredential implements TokenCredential {
|
|
|
1150
1171
|
private identityClient;
|
|
1151
1172
|
private tenantId;
|
|
1152
1173
|
private cloudName;
|
|
1153
|
-
private allowMultiTenantAuthentication?;
|
|
1154
1174
|
/**
|
|
1155
1175
|
* Creates an instance of VisualStudioCodeCredential to use for automatically authenticating via VSCode.
|
|
1156
1176
|
*
|
|
1177
|
+
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
|
|
1178
|
+
* `@azure/identity-vscode`. If this package is not installed and registered
|
|
1179
|
+
* using the plugin API (`useIdentityPlugin`), then authentication using
|
|
1180
|
+
* `VisualStudioCodeCredential` will not be available.
|
|
1181
|
+
*
|
|
1157
1182
|
* @param options - Options for configuring the client which makes the authentication request.
|
|
1158
1183
|
*/
|
|
1159
1184
|
constructor(options?: VisualStudioCodeCredentialOptions);
|