@azure/identity 2.0.0-beta.2 → 2.0.0-beta.6
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 +127 -8
- package/README.md +88 -45
- package/dist/index.js +2237 -1675
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/errors.js +1 -1
- package/dist-esm/src/client/errors.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +146 -132
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/constants.js +1 -1
- package/dist-esm/src/constants.js.map +1 -1
- package/dist-esm/src/credentials/applicationCredential.browser.js +29 -0
- package/dist-esm/src/credentials/applicationCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/applicationCredential.js +34 -0
- package/dist-esm/src/credentials/applicationCredential.js.map +1 -0
- package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.js +13 -76
- package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredential.js +104 -81
- package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
- package/dist-esm/src/credentials/azureCliCredentialOptions.js +4 -0
- package/dist-esm/src/credentials/azureCliCredentialOptions.js.map +1 -0
- package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +20 -0
- package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/azurePowerShellCredential.js +173 -0
- package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -0
- package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js +4 -0
- package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js.map +1 -0
- package/dist-esm/src/credentials/chainedTokenCredential.js +37 -34
- package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js +9 -11
- 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 +87 -0
- package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/clientSecretCredential.js +9 -11
- 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 +4 -0
- package/dist-esm/src/credentials/credentialPersistenceOptions.js.map +1 -0
- 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 +38 -19
- package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/deviceCodeCredential.js +13 -22
- 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.map +1 -1
- package/dist-esm/src/credentials/environmentCredential.js +47 -30
- package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +14 -23
- package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/interactiveBrowserCredential.js +20 -26
- 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/interactiveCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +36 -18
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +61 -42
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +33 -18
- 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 +42 -23
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +108 -73
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js +3 -6
- package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +119 -124
- 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 +14 -8
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +17 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.js +62 -0
- package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -0
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js +4 -0
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +87 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.js +9 -33
- package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +5 -0
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.js +70 -68
- 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/index.js +6 -1
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/browserCommon.js +30 -29
- package/dist-esm/src/msal/browserFlows/browserCommon.js.map +1 -1
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js +103 -113
- package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
- package/dist-esm/src/msal/credentials.js.map +1 -1
- package/dist-esm/src/msal/errors.js +1 -2
- package/dist-esm/src/msal/errors.js.map +1 -1
- package/dist-esm/src/msal/flows.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 +64 -46
- package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClientSecret.js +15 -16
- package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js +20 -22
- package/dist-esm/src/msal/nodeFlows/msalDeviceCode.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 +43 -32
- package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js +15 -17
- package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/nodeCommon.js +133 -110
- package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js +4 -0
- package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js.map +1 -0
- package/dist-esm/src/msal/utils.js +31 -22
- 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/plugins/consumer.js +44 -0
- package/dist-esm/src/plugins/consumer.js.map +1 -0
- package/dist-esm/src/{tokenCache/types.js → plugins/provider.js} +1 -1
- package/dist-esm/src/plugins/provider.js.map +1 -0
- package/dist-esm/src/regionalAuthority.js +115 -0
- package/dist-esm/src/regionalAuthority.js.map +1 -0
- package/dist-esm/src/util/logging.js +1 -1
- package/dist-esm/src/util/logging.js.map +1 -1
- package/dist-esm/src/util/processUtils.js +32 -0
- package/dist-esm/src/util/processUtils.js.map +1 -0
- package/dist-esm/src/util/scopeUtils.js +22 -0
- package/dist-esm/src/util/scopeUtils.js.map +1 -0
- package/dist-esm/src/util/tracing.js +23 -26
- package/dist-esm/src/util/tracing.js.map +1 -1
- package/dist-esm/src/util/validateMultiTenant.js +24 -0
- package/dist-esm/src/util/validateMultiTenant.js.map +1 -0
- package/package.json +43 -41
- package/types/identity.d.ts +500 -131
- package/dist-esm/src/tokenCache/TokenCachePersistence.browser.js +0 -23
- package/dist-esm/src/tokenCache/TokenCachePersistence.browser.js.map +0 -1
- package/dist-esm/src/tokenCache/TokenCachePersistence.js +0 -51
- package/dist-esm/src/tokenCache/TokenCachePersistence.js.map +0 -1
- package/dist-esm/src/tokenCache/nodeVersion.js +0 -10
- package/dist-esm/src/tokenCache/nodeVersion.js.map +0 -1
- package/dist-esm/src/tokenCache/persistencePlatforms.js +0 -150
- package/dist-esm/src/tokenCache/persistencePlatforms.js.map +0 -1
- package/dist-esm/src/tokenCache/types.js.map +0 -1
- package/dist-esm/src/util/authHostEnv.js +0 -13
- package/dist-esm/src/util/authHostEnv.js.map +0 -1
package/types/identity.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AccessToken } from '@azure/core-
|
|
1
|
+
import { AccessToken } from '@azure/core-auth';
|
|
2
2
|
import { AzureLogger } from '@azure/logger';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { TokenCredential } from '@azure/core-
|
|
3
|
+
import { CommonClientOptions } from '@azure/core-client';
|
|
4
|
+
import { GetTokenOptions } from '@azure/core-auth';
|
|
5
|
+
import { TokenCredential } from '@azure/core-auth';
|
|
6
6
|
export { AccessToken }
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -23,6 +23,38 @@ export declare class AggregateAuthenticationError extends Error {
|
|
|
23
23
|
*/
|
|
24
24
|
export declare const AggregateAuthenticationErrorName = "AggregateAuthenticationError";
|
|
25
25
|
|
|
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
|
+
|
|
26
58
|
/**
|
|
27
59
|
* Provides details about a failure to authenticate with Azure Active
|
|
28
60
|
* Directory. The `errorResponse` field contains more details about
|
|
@@ -74,7 +106,7 @@ export declare interface AuthenticationRecord {
|
|
|
74
106
|
/**
|
|
75
107
|
* Error used to enforce authentication after trying to retrieve a token silently.
|
|
76
108
|
*/
|
|
77
|
-
export declare class AuthenticationRequiredError extends
|
|
109
|
+
export declare class AuthenticationRequiredError extends Error {
|
|
78
110
|
/**
|
|
79
111
|
* The list of scopes for which the token will have access.
|
|
80
112
|
*/
|
|
@@ -102,13 +134,10 @@ export declare class AuthenticationRequiredError extends CredentialUnavailableEr
|
|
|
102
134
|
* https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
|
|
103
135
|
*/
|
|
104
136
|
export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
105
|
-
private
|
|
106
|
-
private
|
|
107
|
-
private clientId;
|
|
108
|
-
private clientSecret;
|
|
137
|
+
private msalFlow;
|
|
138
|
+
private disableAutomaticAuthentication?;
|
|
109
139
|
private authorizationCode;
|
|
110
140
|
private redirectUri;
|
|
111
|
-
private lastTokenResponse;
|
|
112
141
|
/**
|
|
113
142
|
* Creates an instance of CodeFlowCredential with the details needed
|
|
114
143
|
* to request an access token using an authentication that was obtained
|
|
@@ -118,7 +147,7 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
|
118
147
|
* the authorization code flow to obtain an authorization code to be used
|
|
119
148
|
* with this credential. A full example of this flow is provided here:
|
|
120
149
|
*
|
|
121
|
-
* https://github.com/Azure/azure-sdk-for-js/blob/
|
|
150
|
+
* https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/manual/authorizationCodeSample.ts
|
|
122
151
|
*
|
|
123
152
|
* @param tenantId - The Azure Active Directory tenant (directory) ID or name.
|
|
124
153
|
* 'common' may be used when dealing with multi-tenant scenarios.
|
|
@@ -141,7 +170,7 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
|
141
170
|
* the authorization code flow to obtain an authorization code to be used
|
|
142
171
|
* with this credential. A full example of this flow is provided here:
|
|
143
172
|
*
|
|
144
|
-
* https://github.com/Azure/azure-sdk-for-js/blob/
|
|
173
|
+
* https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/manual/authorizationCodeSample.ts
|
|
145
174
|
*
|
|
146
175
|
* @param tenantId - The Azure Active Directory tenant (directory) ID or name.
|
|
147
176
|
* 'common' may be used when dealing with multi-tenant scenarios.
|
|
@@ -155,10 +184,8 @@ export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
|
155
184
|
*/
|
|
156
185
|
constructor(tenantId: string | "common", clientId: string, authorizationCode: string, redirectUri: string, options?: TokenCredentialOptions);
|
|
157
186
|
/**
|
|
158
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
159
|
-
*
|
|
160
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
161
|
-
* containing failure details will be thrown.
|
|
187
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
188
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
162
189
|
*
|
|
163
190
|
* @param scopes - The list of scopes for which the token will have access.
|
|
164
191
|
* @param options - The options used to configure any requests this
|
|
@@ -198,20 +225,17 @@ export declare enum AzureAuthorityHosts {
|
|
|
198
225
|
* in via the 'az' tool using the command "az login" from the commandline.
|
|
199
226
|
*/
|
|
200
227
|
export declare class AzureCliCredential implements TokenCredential {
|
|
228
|
+
private tenantId?;
|
|
229
|
+
private allowMultiTenantAuthentication?;
|
|
201
230
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
231
|
+
* Creates an instance of the {@link AzureCliCredential}.
|
|
232
|
+
*
|
|
233
|
+
* @param options - Options, to optionally allow multi-tenant requests.
|
|
204
234
|
*/
|
|
205
|
-
|
|
206
|
-
stdout: string;
|
|
207
|
-
stderr: string;
|
|
208
|
-
error: Error | null;
|
|
209
|
-
}>;
|
|
235
|
+
constructor(options?: AzureCliCredentialOptions);
|
|
210
236
|
/**
|
|
211
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
212
|
-
*
|
|
213
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
214
|
-
* containing failure details will be thrown.
|
|
237
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
238
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
215
239
|
*
|
|
216
240
|
* @param scopes - The list of scopes for which the token will have access.
|
|
217
241
|
* @param options - The options used to configure any requests this
|
|
@@ -220,6 +244,61 @@ export declare class AzureCliCredential implements TokenCredential {
|
|
|
220
244
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
221
245
|
}
|
|
222
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Options for the {@link AzureCliCredential}
|
|
249
|
+
*/
|
|
250
|
+
export declare interface AzureCliCredentialOptions extends TokenCredentialOptions {
|
|
251
|
+
/**
|
|
252
|
+
* Allows specifying a tenant ID
|
|
253
|
+
*/
|
|
254
|
+
tenantId?: string;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* This credential will use the currently logged-in user information from the
|
|
259
|
+
* Azure PowerShell module. To do so, it will read the user access token and
|
|
260
|
+
* 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
|
+
*/
|
|
268
|
+
export declare class AzurePowerShellCredential implements TokenCredential {
|
|
269
|
+
private tenantId?;
|
|
270
|
+
private allowMultiTenantAuthentication?;
|
|
271
|
+
/**
|
|
272
|
+
* Creates an instance of the {@link AzurePowershellCredential}.
|
|
273
|
+
*
|
|
274
|
+
* @param options - Options, to optionally allow multi-tenant requests.
|
|
275
|
+
*/
|
|
276
|
+
constructor(options?: AzurePowerShellCredentialOptions);
|
|
277
|
+
/**
|
|
278
|
+
* Gets the access token from Azure PowerShell
|
|
279
|
+
* @param resource - The resource to use when getting the token
|
|
280
|
+
*/
|
|
281
|
+
private getAzurePowerShellAccessToken;
|
|
282
|
+
/**
|
|
283
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
284
|
+
* If the authentication cannot be performed through PowerShell, a {@link CredentialUnavailableError} will be thrown.
|
|
285
|
+
*
|
|
286
|
+
* @param scopes - The list of scopes for which the token will have access.
|
|
287
|
+
* @param options - The options used to configure any requests this TokenCredential implementation might make.
|
|
288
|
+
*/
|
|
289
|
+
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken | null>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Options for the {@link AzurePowerShellCredential}
|
|
294
|
+
*/
|
|
295
|
+
export declare interface AzurePowerShellCredentialOptions extends TokenCredentialOptions {
|
|
296
|
+
/**
|
|
297
|
+
* Allows specifying a tenant ID
|
|
298
|
+
*/
|
|
299
|
+
tenantId?: string;
|
|
300
|
+
}
|
|
301
|
+
|
|
223
302
|
/**
|
|
224
303
|
* (Browser-only feature)
|
|
225
304
|
* The "login style" to use in the authentication flow:
|
|
@@ -291,10 +370,8 @@ export declare class ClientCertificateCredential implements TokenCredential {
|
|
|
291
370
|
*/
|
|
292
371
|
constructor(tenantId: string, clientId: string, certificatePath: string, options?: ClientCertificateCredentialOptions);
|
|
293
372
|
/**
|
|
294
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
295
|
-
*
|
|
296
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
297
|
-
* containing failure details will be thrown.
|
|
373
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
374
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
298
375
|
*
|
|
299
376
|
* @param scopes - The list of scopes for which the token will have access.
|
|
300
377
|
* @param options - The options used to configure any requests this
|
|
@@ -306,23 +383,18 @@ export declare class ClientCertificateCredential implements TokenCredential {
|
|
|
306
383
|
/**
|
|
307
384
|
* Optional parameters for the {@link ClientCertificateCredential} class.
|
|
308
385
|
*/
|
|
309
|
-
export declare interface ClientCertificateCredentialOptions extends TokenCredentialOptions {
|
|
386
|
+
export declare interface ClientCertificateCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
|
|
310
387
|
/**
|
|
311
388
|
* Option to include x5c header for SubjectName and Issuer name authorization.
|
|
312
389
|
* Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
|
|
313
390
|
*/
|
|
314
391
|
sendCertificateChain?: boolean;
|
|
315
392
|
/**
|
|
316
|
-
*
|
|
317
|
-
* we
|
|
318
|
-
*
|
|
319
|
-
* This feature is not currently available on Node 8 or earlier versions of Node JS.
|
|
320
|
-
*
|
|
321
|
-
* This persistence layer uses DPAPI on Windows.
|
|
322
|
-
* On OSX (Darwin) it tries to use the system's Keychain, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
|
|
323
|
-
* On Linux it tries to use the system's Keyring, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
|
|
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.
|
|
324
396
|
*/
|
|
325
|
-
|
|
397
|
+
regionalAuthority?: string;
|
|
326
398
|
}
|
|
327
399
|
|
|
328
400
|
/**
|
|
@@ -347,10 +419,8 @@ export declare class ClientSecretCredential implements TokenCredential {
|
|
|
347
419
|
*/
|
|
348
420
|
constructor(tenantId: string, clientId: string, clientSecret: string, options?: ClientSecretCredentialOptions);
|
|
349
421
|
/**
|
|
350
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
351
|
-
*
|
|
352
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
353
|
-
* containing failure details will be thrown.
|
|
422
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
423
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
354
424
|
*
|
|
355
425
|
* @param scopes - The list of scopes for which the token will have access.
|
|
356
426
|
* @param options - The options used to configure any requests this
|
|
@@ -362,16 +432,48 @@ export declare class ClientSecretCredential implements TokenCredential {
|
|
|
362
432
|
/**
|
|
363
433
|
* Optional parameters for the {@link ClientSecretCredential} class.
|
|
364
434
|
*/
|
|
365
|
-
export declare interface ClientSecretCredentialOptions extends TokenCredentialOptions {
|
|
435
|
+
export declare interface ClientSecretCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
|
|
366
436
|
/**
|
|
367
|
-
*
|
|
368
|
-
* we
|
|
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
|
+
}
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Shared configuration options for credentials that support persistent token
|
|
446
|
+
* caching.
|
|
447
|
+
*/
|
|
448
|
+
export declare interface CredentialPersistenceOptions {
|
|
449
|
+
/**
|
|
450
|
+
* Options to provide to the persistence layer (if one is available) when
|
|
451
|
+
* storing credentials.
|
|
452
|
+
*
|
|
453
|
+
* You must first register a persistence provider plugin. See the
|
|
454
|
+
* `@azure/identity-cache-persistence` package on NPM.
|
|
455
|
+
*
|
|
456
|
+
* Example:
|
|
457
|
+
*
|
|
458
|
+
* ```javascript
|
|
459
|
+
* import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
460
|
+
* import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
|
|
369
461
|
*
|
|
370
|
-
*
|
|
462
|
+
* useIdentityPlugin(cachePersistencePlugin);
|
|
371
463
|
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
464
|
+
* async function main() {
|
|
465
|
+
* const credential = new DeviceCodeCredential({
|
|
466
|
+
* tokenCachePersistenceOptions: {
|
|
467
|
+
* enabled: true
|
|
468
|
+
* }
|
|
469
|
+
* });
|
|
470
|
+
* }
|
|
471
|
+
*
|
|
472
|
+
* main().catch((error) => {
|
|
473
|
+
* console.error("An error occured:", error);
|
|
474
|
+
* process.exit(1);
|
|
475
|
+
* });
|
|
476
|
+
* ```
|
|
375
477
|
*/
|
|
376
478
|
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
|
|
377
479
|
}
|
|
@@ -391,13 +493,15 @@ export declare class CredentialUnavailableError extends Error {
|
|
|
391
493
|
export declare const CredentialUnavailableErrorName = "CredentialUnavailableError";
|
|
392
494
|
|
|
393
495
|
/**
|
|
394
|
-
* Provides a default {@link ChainedTokenCredential} configuration that should
|
|
395
|
-
*
|
|
496
|
+
* 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:
|
|
396
499
|
*
|
|
397
500
|
* - {@link EnvironmentCredential}
|
|
398
501
|
* - {@link ManagedIdentityCredential}
|
|
399
|
-
* - {@link AzureCliCredential}
|
|
400
502
|
* - {@link VisualStudioCodeCredential}
|
|
503
|
+
* - {@link AzureCliCredential}
|
|
504
|
+
* - {@link AzurePowerShellCredential}
|
|
401
505
|
*
|
|
402
506
|
* Consult the documentation of these credential types for more information
|
|
403
507
|
* on how they attempt authentication.
|
|
@@ -406,6 +510,11 @@ export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
|
406
510
|
/**
|
|
407
511
|
* Creates an instance of the DefaultAzureCredential class.
|
|
408
512
|
*
|
|
513
|
+
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
|
|
514
|
+
* `@azure/identity-vscode`. If this package is not installed and registered
|
|
515
|
+
* using the plugin API (`useIdentityPlugin`), then authentication using
|
|
516
|
+
* `VisualStudioCodeCredential` will not be available.
|
|
517
|
+
*
|
|
409
518
|
* @param options - Optional parameters. See {@link DefaultAzureCredentialOptions}.
|
|
410
519
|
*/
|
|
411
520
|
constructor(options?: DefaultAzureCredentialOptions);
|
|
@@ -414,7 +523,7 @@ export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
|
414
523
|
/**
|
|
415
524
|
* Provides options to configure the {@link DefaultAzureCredential} class.
|
|
416
525
|
*/
|
|
417
|
-
export declare interface DefaultAzureCredentialOptions extends TokenCredentialOptions {
|
|
526
|
+
export declare interface DefaultAzureCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
|
|
418
527
|
/**
|
|
419
528
|
* Optionally pass in a Tenant ID to be used as part of the credential.
|
|
420
529
|
* By default it may use a generic tenant ID depending on the underlying credential.
|
|
@@ -463,10 +572,8 @@ export declare class DeviceCodeCredential implements TokenCredential {
|
|
|
463
572
|
*/
|
|
464
573
|
constructor(options?: DeviceCodeCredentialOptions);
|
|
465
574
|
/**
|
|
466
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
467
|
-
*
|
|
468
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
469
|
-
* containing failure details will be thrown.
|
|
575
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
576
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
470
577
|
*
|
|
471
578
|
* If the user provided the option `disableAutomaticAuthentication`,
|
|
472
579
|
* once the token can't be retrieved silently,
|
|
@@ -478,10 +585,8 @@ export declare class DeviceCodeCredential implements TokenCredential {
|
|
|
478
585
|
*/
|
|
479
586
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
480
587
|
/**
|
|
481
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
482
|
-
*
|
|
483
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
484
|
-
* containing failure details will be thrown.
|
|
588
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
589
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
485
590
|
*
|
|
486
591
|
* If the token can't be retrieved silently, this method will require user interaction to retrieve the token.
|
|
487
592
|
*
|
|
@@ -493,9 +598,9 @@ export declare class DeviceCodeCredential implements TokenCredential {
|
|
|
493
598
|
}
|
|
494
599
|
|
|
495
600
|
/**
|
|
496
|
-
* Defines options for the InteractiveBrowserCredential class for
|
|
601
|
+
* Defines options for the InteractiveBrowserCredential class for Node.js.
|
|
497
602
|
*/
|
|
498
|
-
export declare interface DeviceCodeCredentialOptions extends InteractiveCredentialOptions {
|
|
603
|
+
export declare interface DeviceCodeCredentialOptions extends InteractiveCredentialOptions, CredentialPersistenceOptions {
|
|
499
604
|
/**
|
|
500
605
|
* The Azure Active Directory tenant (directory) ID.
|
|
501
606
|
*/
|
|
@@ -545,9 +650,17 @@ export declare type DeviceCodePromptCallback = (deviceCodeInfo: DeviceCodeInfo)
|
|
|
545
650
|
* Enables authentication to Azure Active Directory using client secret
|
|
546
651
|
* details configured in the following environment variables:
|
|
547
652
|
*
|
|
548
|
-
*
|
|
549
|
-
* -
|
|
550
|
-
* -
|
|
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.
|
|
551
664
|
*
|
|
552
665
|
* This credential ultimately uses a {@link ClientSecretCredential} to
|
|
553
666
|
* perform the authentication using these details. Please consult the
|
|
@@ -556,14 +669,26 @@ export declare type DeviceCodePromptCallback = (deviceCodeInfo: DeviceCodeInfo)
|
|
|
556
669
|
export declare class EnvironmentCredential implements TokenCredential {
|
|
557
670
|
private _credential?;
|
|
558
671
|
/**
|
|
559
|
-
* Creates an instance of the EnvironmentCredential class and
|
|
560
|
-
*
|
|
561
|
-
* environment variables
|
|
562
|
-
*
|
|
672
|
+
* Creates an instance of the EnvironmentCredential class and decides what credential to use depending on the available environment variables.
|
|
673
|
+
*
|
|
674
|
+
* Required environment variables:
|
|
675
|
+
* - `AZURE_TENANT_ID`: The Azure Active Directory tenant (directory) ID.
|
|
676
|
+
* - `AZURE_CLIENT_ID`: The client (application) ID of an App Registration in the tenant.
|
|
677
|
+
*
|
|
678
|
+
* Environment variables used for client credential authentication:
|
|
679
|
+
* - `AZURE_CLIENT_SECRET`: A client secret that was generated for the App Registration.
|
|
680
|
+
* - `AZURE_CLIENT_CERTIFICATE_PATH`: The path to a PEM certificate to use during the authentication, instead of the client secret.
|
|
681
|
+
*
|
|
682
|
+
* Alternatively, users can provide environment variables for username and password authentication:
|
|
683
|
+
* - `AZURE_USERNAME`: Username to authenticate with.
|
|
684
|
+
* - `AZURE_PASSWORD`: Password to authenticate with.
|
|
685
|
+
*
|
|
686
|
+
* If the environment variables required to perform the authentication are missing, a {@link CredentialUnavailableError} will be thrown.
|
|
687
|
+
* If the authentication fails, or if there's an unknown error, an {@link AuthenticationError} will be thrown.
|
|
563
688
|
*
|
|
564
689
|
* @param options - Options for configuring the client which makes the authentication request.
|
|
565
690
|
*/
|
|
566
|
-
constructor(options?:
|
|
691
|
+
constructor(options?: EnvironmentCredentialOptions);
|
|
567
692
|
/**
|
|
568
693
|
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
569
694
|
*
|
|
@@ -573,6 +698,13 @@ export declare class EnvironmentCredential implements TokenCredential {
|
|
|
573
698
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
574
699
|
}
|
|
575
700
|
|
|
701
|
+
/**
|
|
702
|
+
* Enables authentication to Azure Active Directory depending on the available environment variables.
|
|
703
|
+
* Defines options for the EnvironmentCredential class.
|
|
704
|
+
*/
|
|
705
|
+
export declare interface EnvironmentCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
|
|
706
|
+
}
|
|
707
|
+
|
|
576
708
|
/**
|
|
577
709
|
* See the official documentation for more details:
|
|
578
710
|
*
|
|
@@ -614,16 +746,22 @@ export declare interface ErrorResponse {
|
|
|
614
746
|
export declare function getDefaultAzureCredential(): TokenCredential;
|
|
615
747
|
export { GetTokenOptions }
|
|
616
748
|
|
|
749
|
+
/**
|
|
750
|
+
* The type of an Azure Identity plugin, a function accepting a plugin
|
|
751
|
+
* context.
|
|
752
|
+
*/
|
|
753
|
+
export declare type IdentityPlugin = (context: unknown) => void;
|
|
754
|
+
|
|
617
755
|
/**
|
|
618
756
|
* Enables authentication to Azure Active Directory inside of the web browser
|
|
619
757
|
* using the interactive login flow.
|
|
620
758
|
*
|
|
621
|
-
* This credential uses the [Authorization Code Flow](https://docs.microsoft.com/
|
|
622
|
-
* On
|
|
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.
|
|
623
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.
|
|
624
762
|
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
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).
|
|
627
765
|
*/
|
|
628
766
|
export declare class InteractiveBrowserCredential implements TokenCredential {
|
|
629
767
|
private msalFlow;
|
|
@@ -635,10 +773,8 @@ export declare class InteractiveBrowserCredential implements TokenCredential {
|
|
|
635
773
|
*/
|
|
636
774
|
constructor(options?: InteractiveBrowserCredentialOptions | InteractiveBrowserCredentialBrowserOptions);
|
|
637
775
|
/**
|
|
638
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
639
|
-
*
|
|
640
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
641
|
-
* containing failure details will be thrown.
|
|
776
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
777
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
642
778
|
*
|
|
643
779
|
* If the user provided the option `disableAutomaticAuthentication`,
|
|
644
780
|
* once the token can't be retrieved silently,
|
|
@@ -650,13 +786,14 @@ export declare class InteractiveBrowserCredential implements TokenCredential {
|
|
|
650
786
|
*/
|
|
651
787
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
652
788
|
/**
|
|
653
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
654
|
-
*
|
|
655
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
656
|
-
* containing failure details will be thrown.
|
|
789
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
790
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
657
791
|
*
|
|
658
792
|
* If the token can't be retrieved silently, this method will require user interaction to retrieve the token.
|
|
659
793
|
*
|
|
794
|
+
* On Node.js, this credential has [Proof Key for Code Exchange (PKCE)](https://datatracker.ietf.org/doc/html/rfc7636) enabled by default.
|
|
795
|
+
* PKCE is a security feature that mitigates authentication code interception attacks.
|
|
796
|
+
*
|
|
660
797
|
* @param scopes - The list of scopes for which the token will have access.
|
|
661
798
|
* @param options - The options used to configure any requests this
|
|
662
799
|
* TokenCredential implementation might make.
|
|
@@ -667,7 +804,7 @@ export declare class InteractiveBrowserCredential implements TokenCredential {
|
|
|
667
804
|
/**
|
|
668
805
|
* Defines the common options for the InteractiveBrowserCredential class.
|
|
669
806
|
*/
|
|
670
|
-
export declare
|
|
807
|
+
export declare interface InteractiveBrowserCredentialBrowserOptions extends InteractiveCredentialOptions {
|
|
671
808
|
/**
|
|
672
809
|
* Gets the redirect URI of the application. This should be same as the value
|
|
673
810
|
* in the application registration portal. Defaults to `window.location.href`.
|
|
@@ -689,12 +826,17 @@ export declare type InteractiveBrowserCredentialBrowserOptions = TokenCredential
|
|
|
689
826
|
*
|
|
690
827
|
*/
|
|
691
828
|
loginStyle?: BrowserLoginStyle;
|
|
692
|
-
|
|
829
|
+
/**
|
|
830
|
+
* loginHint allows a user name to be pre-selected for interactive logins.
|
|
831
|
+
* Setting this option skips the account selection prompt and immediately attempts to login with the specified account.
|
|
832
|
+
*/
|
|
833
|
+
loginHint?: string;
|
|
834
|
+
}
|
|
693
835
|
|
|
694
836
|
/**
|
|
695
837
|
* Defines the common options for the InteractiveBrowserCredential class.
|
|
696
838
|
*/
|
|
697
|
-
export declare
|
|
839
|
+
export declare interface InteractiveBrowserCredentialOptions extends InteractiveCredentialOptions, CredentialPersistenceOptions {
|
|
698
840
|
/**
|
|
699
841
|
* Gets the redirect URI of the application. This should be same as the value
|
|
700
842
|
* in the application registration portal. Defaults to `window.location.href`.
|
|
@@ -708,7 +850,12 @@ export declare type InteractiveBrowserCredentialOptions = TokenCredentialOptions
|
|
|
708
850
|
* The client (application) ID of an App Registration in the tenant.
|
|
709
851
|
*/
|
|
710
852
|
clientId?: string;
|
|
711
|
-
|
|
853
|
+
/**
|
|
854
|
+
* loginHint allows a user name to be pre-selected for interactive logins.
|
|
855
|
+
* Setting this option skips the account selection prompt and immediately attempts to login with the specified account.
|
|
856
|
+
*/
|
|
857
|
+
loginHint?: string;
|
|
858
|
+
}
|
|
712
859
|
|
|
713
860
|
/**
|
|
714
861
|
* Common constructor options for the Identity credentials that requires user interaction.
|
|
@@ -730,17 +877,6 @@ export declare interface InteractiveCredentialOptions extends TokenCredentialOpt
|
|
|
730
877
|
* Developers will need to call to `authenticate()` to control when to manually authenticate.
|
|
731
878
|
*/
|
|
732
879
|
disableAutomaticAuthentication?: boolean;
|
|
733
|
-
/**
|
|
734
|
-
* To provide a persistence layer to store the credentials,
|
|
735
|
-
* we allow users to optionally specify {@link TokenCachePersistenceOptions} for their credential.
|
|
736
|
-
*
|
|
737
|
-
* This feature is not currently available on Node 8 or earlier versions of Node JS.
|
|
738
|
-
*
|
|
739
|
-
* This persistence layer uses DPAPI on Windows.
|
|
740
|
-
* On OSX (Darwin) it tries to use the system's Keychain, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
|
|
741
|
-
* On Linux it tries to use the system's Keyring, otherwise if the property `allowUnencryptedStorage` is set to true, it uses an unencrypted file.
|
|
742
|
-
*/
|
|
743
|
-
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
|
|
744
880
|
}
|
|
745
881
|
|
|
746
882
|
/**
|
|
@@ -763,9 +899,9 @@ export declare class ManagedIdentityCredential implements TokenCredential {
|
|
|
763
899
|
private isEndpointUnavailable;
|
|
764
900
|
/**
|
|
765
901
|
* Creates an instance of ManagedIdentityCredential with the client ID of a
|
|
766
|
-
* user-assigned identity.
|
|
902
|
+
* user-assigned identity, or app registration (when working with AKS pod-identity).
|
|
767
903
|
*
|
|
768
|
-
* @param clientId - The client ID of the user-assigned identity.
|
|
904
|
+
* @param clientId - The client ID of the user-assigned identity, or app registration (when working with AKS pod-identity).
|
|
769
905
|
* @param options - Options for configuring the client which makes the access token request.
|
|
770
906
|
*/
|
|
771
907
|
constructor(clientId: string, options?: TokenCredentialOptions);
|
|
@@ -779,10 +915,9 @@ export declare class ManagedIdentityCredential implements TokenCredential {
|
|
|
779
915
|
private cachedAvailableMSI;
|
|
780
916
|
private authenticateManagedIdentity;
|
|
781
917
|
/**
|
|
782
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
* containing failure details will be thrown.
|
|
918
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
919
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
920
|
+
* If an unexpected error occurs, an {@link AuthenticationError} will be thrown with the details of the failure.
|
|
786
921
|
*
|
|
787
922
|
* @param scopes - The list of scopes for which the token will have access.
|
|
788
923
|
* @param options - The options used to configure any requests this
|
|
@@ -791,6 +926,213 @@ export declare class ManagedIdentityCredential implements TokenCredential {
|
|
|
791
926
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
792
927
|
}
|
|
793
928
|
|
|
929
|
+
/**
|
|
930
|
+
* 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
|
+
*/
|
|
932
|
+
export declare class OnBehalfOfCredential implements TokenCredential {
|
|
933
|
+
private configuration;
|
|
934
|
+
private options;
|
|
935
|
+
private msalFlow;
|
|
936
|
+
/**
|
|
937
|
+
* Creates an instance of the {@link OnBehalfOfCredential} with the details
|
|
938
|
+
* needed to authenticate against Azure Active Directory with a client
|
|
939
|
+
* secret or a path to a PEM certificate, and an user assertion.
|
|
940
|
+
*
|
|
941
|
+
* Example using the `KeyClient` from [\@azure/keyvault-keys](https://www.npmjs.com/package/\@azure/keyvault-keys):
|
|
942
|
+
*
|
|
943
|
+
* ```ts
|
|
944
|
+
* const tokenCredential = new OnBehalfOfCredential({
|
|
945
|
+
* tenantId,
|
|
946
|
+
* clientId,
|
|
947
|
+
* clientSecret, // or `certificatePath: "/path/to/certificate.pem"
|
|
948
|
+
* userAssertionToken: "access-token"
|
|
949
|
+
* });
|
|
950
|
+
* const client = new KeyClient("vault-url", tokenCredential);
|
|
951
|
+
*
|
|
952
|
+
* await client.getKey("key-name");
|
|
953
|
+
* ```
|
|
954
|
+
*
|
|
955
|
+
* @param configuration - Configuration specific to this credential.
|
|
956
|
+
* @param options - Optional parameters, generally common across credentials.
|
|
957
|
+
*/
|
|
958
|
+
constructor(configuration: OnBehalfOfCredentialSecretConfiguration | OnBehalfOfCredentialCertificateConfiguration, options?: OnBehalfOfCredentialOptions);
|
|
959
|
+
/**
|
|
960
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
961
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
962
|
+
*
|
|
963
|
+
* @param scopes - The list of scopes for which the token will have access.
|
|
964
|
+
* @param options - The options used to configure the underlying network requests.
|
|
965
|
+
*/
|
|
966
|
+
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Defines the configuration parameters to authenticate the {@link OnBehalfOfCredential} with a certificate.
|
|
971
|
+
*/
|
|
972
|
+
export declare interface OnBehalfOfCredentialCertificateConfiguration {
|
|
973
|
+
/**
|
|
974
|
+
* The Azure Active Directory tenant (directory) ID.
|
|
975
|
+
*/
|
|
976
|
+
tenantId: string;
|
|
977
|
+
/**
|
|
978
|
+
* The client (application) ID of an App Registration in the tenant.
|
|
979
|
+
*/
|
|
980
|
+
clientId: string;
|
|
981
|
+
/**
|
|
982
|
+
* The path to a PEM-encoded public/private key certificate on the filesystem.
|
|
983
|
+
*/
|
|
984
|
+
certificatePath: string;
|
|
985
|
+
/**
|
|
986
|
+
* Option to include x5c header for SubjectName and Issuer name authorization.
|
|
987
|
+
* Set this option to send base64 encoded public certificate in the client assertion header as an x5c claim
|
|
988
|
+
*/
|
|
989
|
+
sendCertificateChain?: boolean;
|
|
990
|
+
/**
|
|
991
|
+
* The user assertion for the On-Behalf-Of flow.
|
|
992
|
+
*/
|
|
993
|
+
userAssertionToken: string;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Optional parameters for the {@link OnBehalfOfCredential} class.
|
|
998
|
+
*/
|
|
999
|
+
export declare interface OnBehalfOfCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Defines the configuration parameters to authenticate the {@link OnBehalfOfCredential} with a secret.
|
|
1004
|
+
*/
|
|
1005
|
+
export declare interface OnBehalfOfCredentialSecretConfiguration {
|
|
1006
|
+
/**
|
|
1007
|
+
* The Azure Active Directory tenant (directory) ID.
|
|
1008
|
+
*/
|
|
1009
|
+
tenantId: string;
|
|
1010
|
+
/**
|
|
1011
|
+
* The client (application) ID of an App Registration in the tenant.
|
|
1012
|
+
*/
|
|
1013
|
+
clientId: string;
|
|
1014
|
+
/**
|
|
1015
|
+
* A client secret that was generated for the App Registration.
|
|
1016
|
+
*/
|
|
1017
|
+
clientSecret: string;
|
|
1018
|
+
/**
|
|
1019
|
+
* The user assertion for the On-Behalf-Of flow.
|
|
1020
|
+
*/
|
|
1021
|
+
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"
|
|
1134
|
+
}
|
|
1135
|
+
|
|
794
1136
|
/**
|
|
795
1137
|
* Serializes an `AuthenticationRecord` into a string.
|
|
796
1138
|
*
|
|
@@ -811,13 +1153,16 @@ export declare function serializeAuthenticationRecord(record: AuthenticationReco
|
|
|
811
1153
|
* Parameters that enable token cache persistence in the Identity credentials.
|
|
812
1154
|
*/
|
|
813
1155
|
export declare interface TokenCachePersistenceOptions {
|
|
1156
|
+
/**
|
|
1157
|
+
* If set to true, persistent token caching will be enabled for this credential instance.
|
|
1158
|
+
*/
|
|
1159
|
+
enabled: boolean;
|
|
814
1160
|
/**
|
|
815
1161
|
* Unique identifier for the persistent token cache.
|
|
816
1162
|
*
|
|
817
1163
|
* Based on this identifier, the persistence file will be located in any of the following places:
|
|
818
1164
|
* - Darwin: '/Users/user/.IdentityService/<name>'
|
|
819
|
-
* - Windows 8
|
|
820
|
-
* - Windows XP: 'C:\Documents and Settings\user\Application Data\Local\.IdentityService\<name>'
|
|
1165
|
+
* - Windows 8+: 'C:\\Users\\user\\AppData\\Local\\.IdentityService\\<name>'
|
|
821
1166
|
* - Linux: '/home/user/.IdentityService/<name>'
|
|
822
1167
|
*/
|
|
823
1168
|
name?: string;
|
|
@@ -825,7 +1170,7 @@ export declare interface TokenCachePersistenceOptions {
|
|
|
825
1170
|
* If set to true, the cache will be stored without encryption if no OS level user encryption is available.
|
|
826
1171
|
* When set to false, the PersistentTokenCache will throw an error if no OS level user encryption is available.
|
|
827
1172
|
*/
|
|
828
|
-
|
|
1173
|
+
unsafeAllowUnencryptedStorage?: boolean;
|
|
829
1174
|
}
|
|
830
1175
|
export { TokenCredential }
|
|
831
1176
|
|
|
@@ -833,14 +1178,48 @@ export { TokenCredential }
|
|
|
833
1178
|
* Provides options to configure how the Identity library makes authentication
|
|
834
1179
|
* requests to Azure Active Directory.
|
|
835
1180
|
*/
|
|
836
|
-
export declare interface TokenCredentialOptions extends
|
|
1181
|
+
export declare interface TokenCredentialOptions extends CommonClientOptions {
|
|
837
1182
|
/**
|
|
838
1183
|
* The authority host to use for authentication requests.
|
|
1184
|
+
* Possible values are available through {@link AzureAuthorityHosts}.
|
|
839
1185
|
* The default is "https://login.microsoftonline.com".
|
|
840
1186
|
*/
|
|
841
1187
|
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;
|
|
842
1192
|
}
|
|
843
1193
|
|
|
1194
|
+
/**
|
|
1195
|
+
* Extend Azure Identity with additional functionality. Pass a plugin from
|
|
1196
|
+
* a plugin package, such as:
|
|
1197
|
+
*
|
|
1198
|
+
* - `@azure/identity-cache-persistence`: provides persistent token caching
|
|
1199
|
+
* - `@azure/identity-vscode`: provides the dependencies of
|
|
1200
|
+
* `VisualStudioCodeCredential` and enables it
|
|
1201
|
+
*
|
|
1202
|
+
* Example:
|
|
1203
|
+
*
|
|
1204
|
+
* ```javascript
|
|
1205
|
+
* import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
1206
|
+
*
|
|
1207
|
+
* import { useIdentityPlugin, DefaultAzureCredential } from "@azure/identity";
|
|
1208
|
+
* useIdentityPlugin(cachePersistencePlugin);
|
|
1209
|
+
*
|
|
1210
|
+
* // The plugin has the capability to extend `DefaultAzureCredential` and to
|
|
1211
|
+
* // add middleware to the underlying credentials, such as persistence.
|
|
1212
|
+
* const credential = new DefaultAzureCredential({
|
|
1213
|
+
* tokenCachePersistenceOptions: {
|
|
1214
|
+
* enabled: true
|
|
1215
|
+
* }
|
|
1216
|
+
* });
|
|
1217
|
+
* ```
|
|
1218
|
+
*
|
|
1219
|
+
* @param plugin - the plugin to register
|
|
1220
|
+
*/
|
|
1221
|
+
export declare function useIdentityPlugin(plugin: IdentityPlugin): void;
|
|
1222
|
+
|
|
844
1223
|
/**
|
|
845
1224
|
* Enables authentication to Azure Active Directory with a user's
|
|
846
1225
|
* username and password. This credential requires a high degree of
|
|
@@ -849,7 +1228,6 @@ export declare interface TokenCredentialOptions extends PipelineOptions {
|
|
|
849
1228
|
*/
|
|
850
1229
|
export declare class UsernamePasswordCredential implements TokenCredential {
|
|
851
1230
|
private msalFlow;
|
|
852
|
-
private disableAutomaticAuthentication?;
|
|
853
1231
|
/**
|
|
854
1232
|
* Creates an instance of the UsernamePasswordCredential with the details
|
|
855
1233
|
* needed to authenticate against Azure Active Directory with a username
|
|
@@ -863,10 +1241,8 @@ export declare class UsernamePasswordCredential implements TokenCredential {
|
|
|
863
1241
|
*/
|
|
864
1242
|
constructor(tenantId: string, clientId: string, username: string, password: string, options?: UsernamePasswordCredentialOptions);
|
|
865
1243
|
/**
|
|
866
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
867
|
-
*
|
|
868
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
869
|
-
* containing failure details will be thrown.
|
|
1244
|
+
* Authenticates with Azure Active Directory and returns an access token if successful.
|
|
1245
|
+
* If authentication fails, a {@link CredentialUnavailableError} will be thrown with the details of the failure.
|
|
870
1246
|
*
|
|
871
1247
|
* If the user provided the option `disableAutomaticAuthentication`,
|
|
872
1248
|
* once the token can't be retrieved silently,
|
|
@@ -877,25 +1253,12 @@ export declare class UsernamePasswordCredential implements TokenCredential {
|
|
|
877
1253
|
* TokenCredential implementation might make.
|
|
878
1254
|
*/
|
|
879
1255
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
880
|
-
/**
|
|
881
|
-
* Authenticates with Azure Active Directory and returns an access token if
|
|
882
|
-
* successful. If authentication cannot be performed at this time, this method may
|
|
883
|
-
* return null. If an error occurs during authentication, an {@link AuthenticationError}
|
|
884
|
-
* containing failure details will be thrown.
|
|
885
|
-
*
|
|
886
|
-
* If the token can't be retrieved silently, this method will require user interaction to retrieve the token.
|
|
887
|
-
*
|
|
888
|
-
* @param scopes - The list of scopes for which the token will have access.
|
|
889
|
-
* @param options - The options used to configure any requests this
|
|
890
|
-
* TokenCredential implementation might make.
|
|
891
|
-
*/
|
|
892
|
-
authenticate(scopes: string | string[], options?: GetTokenOptions): Promise<AuthenticationRecord | undefined>;
|
|
893
1256
|
}
|
|
894
1257
|
|
|
895
1258
|
/**
|
|
896
1259
|
* Defines options for the {@link UsernamePasswordCredential} class.
|
|
897
1260
|
*/
|
|
898
|
-
export declare interface UsernamePasswordCredentialOptions extends
|
|
1261
|
+
export declare interface UsernamePasswordCredentialOptions extends TokenCredentialOptions, CredentialPersistenceOptions {
|
|
899
1262
|
}
|
|
900
1263
|
|
|
901
1264
|
/**
|
|
@@ -907,9 +1270,15 @@ export declare class VisualStudioCodeCredential implements TokenCredential {
|
|
|
907
1270
|
private identityClient;
|
|
908
1271
|
private tenantId;
|
|
909
1272
|
private cloudName;
|
|
1273
|
+
private allowMultiTenantAuthentication?;
|
|
910
1274
|
/**
|
|
911
1275
|
* Creates an instance of VisualStudioCodeCredential to use for automatically authenticating via VSCode.
|
|
912
1276
|
*
|
|
1277
|
+
* **Note**: `VisualStudioCodeCredential` is provided by a plugin package:
|
|
1278
|
+
* `@azure/identity-vscode`. If this package is not installed and registered
|
|
1279
|
+
* using the plugin API (`useIdentityPlugin`), then authentication using
|
|
1280
|
+
* `VisualStudioCodeCredential` will not be available.
|
|
1281
|
+
*
|
|
913
1282
|
* @param options - Options for configuring the client which makes the authentication request.
|
|
914
1283
|
*/
|
|
915
1284
|
constructor(options?: VisualStudioCodeCredentialOptions);
|
|
@@ -933,7 +1302,7 @@ export declare class VisualStudioCodeCredential implements TokenCredential {
|
|
|
933
1302
|
* @param options - The options used to configure any requests this
|
|
934
1303
|
* `TokenCredential` implementation might make.
|
|
935
1304
|
*/
|
|
936
|
-
getToken(scopes: string | string[],
|
|
1305
|
+
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
937
1306
|
}
|
|
938
1307
|
|
|
939
1308
|
/**
|