@azure/identity 2.0.0-beta.5 → 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 +49 -10
- package/README.md +26 -21
- package/dist/index.js +461 -211
- 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 +2 -6
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/credentials/applicationCredential.js +0 -3
- package/dist-esm/src/credentials/applicationCredential.js.map +1 -1
- package/dist-esm/src/credentials/authorizationCodeCredential.js +12 -76
- package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
- package/dist-esm/src/credentials/chainedTokenCredential.js +4 -3
- package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientCertificateCredential.js +3 -0
- package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
- package/dist-esm/src/credentials/clientSecretCredential.browser.js +1 -4
- 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/credentialPersistenceOptions.js.map +1 -1
- package/dist-esm/src/credentials/defaultAzureCredential.js +5 -8
- package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +21 -10
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +23 -12
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +22 -11
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +19 -7
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +29 -20
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +13 -10
- 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 +10 -5
- 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/{visualStudioCodeCredentialExtension.js → onBehalfOfCredentialOptions.js} +1 -1
- package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +10 -13
- package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/usernamePasswordCredential.js +3 -0
- package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
- package/dist-esm/src/credentials/visualStudioCodeCredential.js +11 -1
- 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 +2 -1
- package/dist-esm/src/index.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 +48 -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/nodeCommon.js +6 -1
- 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/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/package.json +10 -12
- package/types/identity.d.ts +126 -41
- 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
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
import { msalNodeFlowCacheControl } from "../msal/nodeFlows/nodeCommon";
|
|
4
4
|
import { vsCodeCredentialControl } from "../credentials/visualStudioCodeCredential";
|
|
5
5
|
/**
|
|
6
|
-
* The context passed to an Identity
|
|
7
|
-
*
|
|
6
|
+
* The context passed to an Identity plugin. This contains objects that
|
|
7
|
+
* plugins can use to set backend implementations.
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const pluginContext = {
|
|
11
11
|
cachePluginControl: msalNodeFlowCacheControl,
|
|
12
12
|
vsCodeCredentialControl: vsCodeCredentialControl
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* Extend Azure Identity with additional functionality. Pass
|
|
16
|
-
*
|
|
15
|
+
* Extend Azure Identity with additional functionality. Pass a plugin from
|
|
16
|
+
* a plugin package, such as:
|
|
17
17
|
*
|
|
18
18
|
* - `@azure/identity-cache-persistence`: provides persistent token caching
|
|
19
19
|
* - `@azure/identity-vscode`: provides the dependencies of
|
|
@@ -22,12 +22,12 @@ const extensionContext = {
|
|
|
22
22
|
* Example:
|
|
23
23
|
*
|
|
24
24
|
* ```javascript
|
|
25
|
-
* import {
|
|
25
|
+
* import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
26
26
|
*
|
|
27
|
-
* import {
|
|
28
|
-
*
|
|
27
|
+
* import { useIdentityPlugin, DefaultAzureCredential } from "@azure/identity";
|
|
28
|
+
* useIdentityPlugin(cachePersistencePlugin);
|
|
29
29
|
*
|
|
30
|
-
* // The
|
|
30
|
+
* // The plugin has the capability to extend `DefaultAzureCredential` and to
|
|
31
31
|
* // add middleware to the underlying credentials, such as persistence.
|
|
32
32
|
* const credential = new DefaultAzureCredential({
|
|
33
33
|
* tokenCachePersistenceOptions: {
|
|
@@ -36,9 +36,9 @@ const extensionContext = {
|
|
|
36
36
|
* });
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
|
-
* @param
|
|
39
|
+
* @param plugin - the plugin to register
|
|
40
40
|
*/
|
|
41
|
-
export function
|
|
42
|
-
|
|
41
|
+
export function useIdentityPlugin(plugin) {
|
|
42
|
+
plugin(pluginContext);
|
|
43
43
|
}
|
|
44
44
|
//# sourceMappingURL=consumer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../../src/plugins/consumer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEpF;;;;GAIG;AACH,MAAM,aAAa,GAAuB;IACxC,kBAAkB,EAAE,wBAAwB;IAC5C,uBAAuB,EAAE,uBAAuB;CACjD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAsB;IACtD,MAAM,CAAC,aAAa,CAAC,CAAC;AACxB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzurePluginContext, IdentityPlugin } from \"./provider\";\nimport { msalNodeFlowCacheControl } from \"../msal/nodeFlows/nodeCommon\";\nimport { vsCodeCredentialControl } from \"../credentials/visualStudioCodeCredential\";\n\n/**\n * The context passed to an Identity plugin. This contains objects that\n * plugins can use to set backend implementations.\n * @internal\n */\nconst pluginContext: AzurePluginContext = {\n cachePluginControl: msalNodeFlowCacheControl,\n vsCodeCredentialControl: vsCodeCredentialControl\n};\n\n/**\n * Extend Azure Identity with additional functionality. Pass a plugin from\n * a plugin package, such as:\n *\n * - `@azure/identity-cache-persistence`: provides persistent token caching\n * - `@azure/identity-vscode`: provides the dependencies of\n * `VisualStudioCodeCredential` and enables it\n *\n * Example:\n *\n * ```javascript\n * import { cachePersistencePlugin } from \"@azure/identity-cache-persistence\";\n *\n * import { useIdentityPlugin, DefaultAzureCredential } from \"@azure/identity\";\n * useIdentityPlugin(cachePersistencePlugin);\n *\n * // The plugin has the capability to extend `DefaultAzureCredential` and to\n * // add middleware to the underlying credentials, such as persistence.\n * const credential = new DefaultAzureCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true\n * }\n * });\n * ```\n *\n * @param plugin - the plugin to register\n */\nexport function useIdentityPlugin(plugin: IdentityPlugin): void {\n plugin(pluginContext);\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/plugins/provider.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { VSCodeCredentialFinder } from \"../credentials/visualStudioCodeCredentialPlugin\";\nimport { TokenCachePersistenceOptions } from \"../msal/nodeFlows/tokenCachePersistenceOptions\";\n\n/**\n * The type of an Azure Identity plugin, a function accepting a plugin\n * context.\n */\nexport type IdentityPlugin = (context: unknown) => void;\n\n/**\n * Plugin context entries for controlling cache plugins.\n */\nexport interface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions\n ) => Promise<import(\"@azure/msal-common\").ICachePlugin>\n ): void;\n}\n\n/**\n * Plugin context entries for controlling VisualStudioCodeCredential.\n */\nexport interface VisualStudioCodeCredentialControl {\n setVsCodeCredentialFinder(finder: VSCodeCredentialFinder): void;\n}\n\n/**\n * Context options passed to a plugin during initialization.\n *\n * Plugin authors are responsible for casting their plugin context values\n * to this type.\n *\n * @internal\n */\nexport interface AzurePluginContext {\n cachePluginControl: CachePluginControl;\n vsCodeCredentialControl: VisualStudioCodeCredentialControl;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/identity",
|
|
3
3
|
"sdk-type": "client",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.6",
|
|
5
5
|
"description": "Provides credential implementations for Azure SDK libraries that can authenticate with Azure Active Directory",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist-esm/src/index.js",
|
|
@@ -22,18 +22,19 @@
|
|
|
22
22
|
"./dist-esm/src/credentials/usernamePasswordCredential.js": "./dist-esm/src/credentials/usernamePasswordCredential.browser.js",
|
|
23
23
|
"./dist-esm/src/credentials/azurePowerShellCredential.js": "./dist-esm/src/credentials/azurePowerShellCredential.browser.js",
|
|
24
24
|
"./dist-esm/src/credentials/applicationCredential.js": "./dist-esm/src/credentials/applicationCredential.browser.js",
|
|
25
|
+
"./dist-esm/src/credentials/onBehalfOfCredential.js": "./dist-esm/src/credentials/onBehalfOfCredential.browser.js",
|
|
25
26
|
"./dist-esm/src/util/authHostEnv.js": "./dist-esm/src/util/authHostEnv.browser.js",
|
|
26
27
|
"./dist-esm/src/tokenCache/TokenCachePersistence.js": "./dist-esm/src/tokenCache/TokenCachePersistence.browser.js",
|
|
27
|
-
"./dist-esm/src/
|
|
28
|
+
"./dist-esm/src/plugins/consumer.js": "./dist-esm/src/plugins/consumer.browser.js",
|
|
28
29
|
"./dist-esm/test/httpRequests.js": "./dist-esm/test/httpRequests.browser.js"
|
|
29
30
|
},
|
|
30
31
|
"scripts": {
|
|
31
32
|
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
|
|
32
33
|
"build:samples": "echo skipped",
|
|
33
34
|
"build:test": "tsc -p . && rollup -c 2>&1",
|
|
34
|
-
"build": "npm run extract-api && tsc -p . && rollup -c 2>&1",
|
|
35
|
+
"build": "npm run clean && npm run extract-api && tsc -p . && rollup -c 2>&1",
|
|
35
36
|
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples/**/*.{js,json}\"",
|
|
36
|
-
"clean": "rimraf dist dist-*
|
|
37
|
+
"clean": "rimraf dist dist-* types *.tgz *.log",
|
|
37
38
|
"execute:samples": "echo skipped",
|
|
38
39
|
"extract-api": "tsc -p . && api-extractor run --local",
|
|
39
40
|
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples/**/*.{js,json}\"",
|
|
@@ -43,7 +44,6 @@
|
|
|
43
44
|
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
|
|
44
45
|
"lint": "eslint package.json api-extractor.json src test --ext .ts",
|
|
45
46
|
"pack": "npm pack 2>&1",
|
|
46
|
-
"prebuild": "npm run clean",
|
|
47
47
|
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
|
|
48
48
|
"test:node": "npm run clean && npm run build:test && npm run unit-test:node && npm run integration-test:node",
|
|
49
49
|
"test": "npm run clean && npm run build:test && npm run unit-test && npm run integration-test",
|
|
@@ -98,14 +98,13 @@
|
|
|
98
98
|
"@azure/core-rest-pipeline": "^1.1.0",
|
|
99
99
|
"@azure/logger": "^1.0.0",
|
|
100
100
|
"@azure/abort-controller": "^1.0.0",
|
|
101
|
-
"@azure/msal-common": "^4.
|
|
102
|
-
"@azure/msal-node": "^1.
|
|
103
|
-
"@azure/msal-browser": "^2.
|
|
101
|
+
"@azure/msal-common": "^4.5.1",
|
|
102
|
+
"@azure/msal-node": "^1.3.0",
|
|
103
|
+
"@azure/msal-browser": "^2.16.0",
|
|
104
104
|
"@types/stoppable": "^1.1.0",
|
|
105
105
|
"events": "^3.0.0",
|
|
106
106
|
"jws": "^4.0.0",
|
|
107
107
|
"open": "^7.0.0",
|
|
108
|
-
"qs": "^6.7.0",
|
|
109
108
|
"stoppable": "^1.1.0",
|
|
110
109
|
"tslib": "^2.2.0",
|
|
111
110
|
"uuid": "^8.3.0"
|
|
@@ -114,12 +113,11 @@
|
|
|
114
113
|
"@azure/eslint-plugin-azure-sdk": "^3.0.0",
|
|
115
114
|
"@azure/dev-tool": "^1.0.0",
|
|
116
115
|
"@azure/test-utils": "^1.0.0",
|
|
117
|
-
"@azure/test-
|
|
116
|
+
"@azure-tools/test-recorder": "^1.0.0",
|
|
118
117
|
"@microsoft/api-extractor": "7.7.11",
|
|
119
118
|
"@types/jws": "^3.2.2",
|
|
120
119
|
"@types/mocha": "^7.0.2",
|
|
121
120
|
"@types/node": "^12.0.0",
|
|
122
|
-
"@types/qs": "^6.5.3",
|
|
123
121
|
"@types/uuid": "^8.0.0",
|
|
124
122
|
"@types/chai": "^4.1.6",
|
|
125
123
|
"chai": "^4.2.0",
|
|
@@ -139,7 +137,7 @@
|
|
|
139
137
|
"mocha": "^7.1.1",
|
|
140
138
|
"mocha-junit-reporter": "^1.18.0",
|
|
141
139
|
"prettier": "^1.16.4",
|
|
142
|
-
"puppeteer": "^
|
|
140
|
+
"puppeteer": "^10.2.0",
|
|
143
141
|
"rimraf": "^3.0.0",
|
|
144
142
|
"rollup": "^1.16.3",
|
|
145
143
|
"typescript": "~4.2.0",
|
package/types/identity.d.ts
CHANGED
|
@@ -34,9 +34,6 @@ export declare const AggregateAuthenticationErrorName = "AggregateAuthentication
|
|
|
34
34
|
*
|
|
35
35
|
* Consult the documentation of these credential types for more information
|
|
36
36
|
* on how they attempt authentication.
|
|
37
|
-
*
|
|
38
|
-
* Azure Identity extensions may add credential types to the default credential
|
|
39
|
-
* stack.
|
|
40
37
|
*/
|
|
41
38
|
export declare class ApplicationCredential extends ChainedTokenCredential {
|
|
42
39
|
/**
|
|
@@ -137,14 +134,10 @@ export declare class AuthenticationRequiredError extends Error {
|
|
|
137
134
|
* https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
|
|
138
135
|
*/
|
|
139
136
|
export declare class AuthorizationCodeCredential implements TokenCredential {
|
|
140
|
-
private
|
|
141
|
-
private
|
|
142
|
-
private clientId;
|
|
143
|
-
private clientSecret;
|
|
137
|
+
private msalFlow;
|
|
138
|
+
private disableAutomaticAuthentication?;
|
|
144
139
|
private authorizationCode;
|
|
145
140
|
private redirectUri;
|
|
146
|
-
private lastTokenResponse;
|
|
147
|
-
private allowMultiTenantAuthentication?;
|
|
148
141
|
/**
|
|
149
142
|
* Creates an instance of CodeFlowCredential with the details needed
|
|
150
143
|
* to request an access token using an authentication that was obtained
|
|
@@ -327,10 +320,6 @@ export declare class ChainedTokenCredential implements TokenCredential {
|
|
|
327
320
|
*/
|
|
328
321
|
protected UnavailableMessage: string;
|
|
329
322
|
private _sources;
|
|
330
|
-
/**
|
|
331
|
-
* The selected credential, in case users want to read it or use it directly.
|
|
332
|
-
*/
|
|
333
|
-
selectedCredential?: TokenCredential;
|
|
334
323
|
/**
|
|
335
324
|
* Creates an instance of ChainedTokenCredential using the given credentials.
|
|
336
325
|
*
|
|
@@ -461,21 +450,21 @@ export declare interface CredentialPersistenceOptions {
|
|
|
461
450
|
* Options to provide to the persistence layer (if one is available) when
|
|
462
451
|
* storing credentials.
|
|
463
452
|
*
|
|
464
|
-
* You must first register a persistence provider
|
|
453
|
+
* You must first register a persistence provider plugin. See the
|
|
465
454
|
* `@azure/identity-cache-persistence` package on NPM.
|
|
466
455
|
*
|
|
467
456
|
* Example:
|
|
468
457
|
*
|
|
469
|
-
* ```
|
|
470
|
-
* import
|
|
471
|
-
* import {
|
|
458
|
+
* ```javascript
|
|
459
|
+
* import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
460
|
+
* import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";
|
|
472
461
|
*
|
|
473
|
-
*
|
|
462
|
+
* useIdentityPlugin(cachePersistencePlugin);
|
|
474
463
|
*
|
|
475
464
|
* async function main() {
|
|
476
465
|
* const credential = new DeviceCodeCredential({
|
|
477
466
|
* tokenCachePersistenceOptions: {
|
|
478
|
-
*
|
|
467
|
+
* enabled: true
|
|
479
468
|
* }
|
|
480
469
|
* });
|
|
481
470
|
* }
|
|
@@ -485,7 +474,7 @@ export declare interface CredentialPersistenceOptions {
|
|
|
485
474
|
* process.exit(1);
|
|
486
475
|
* });
|
|
487
476
|
* ```
|
|
488
|
-
|
|
477
|
+
*/
|
|
489
478
|
tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
|
|
490
479
|
}
|
|
491
480
|
|
|
@@ -516,19 +505,16 @@ export declare const CredentialUnavailableErrorName = "CredentialUnavailableErro
|
|
|
516
505
|
*
|
|
517
506
|
* Consult the documentation of these credential types for more information
|
|
518
507
|
* on how they attempt authentication.
|
|
519
|
-
*
|
|
520
|
-
* **Note**: `VisualStudioCodeCredential` is provided by an extension package:
|
|
521
|
-
* `@azure/identity-vscode`. If this package is not installed and registered
|
|
522
|
-
* using the extension API (`useIdentityExtension`), then authentication using
|
|
523
|
-
* `VisualStudioCodeCredential` will not be available.
|
|
524
|
-
*
|
|
525
|
-
* Azure Identity extensions may add credential types to the default credential
|
|
526
|
-
* stack.
|
|
527
508
|
*/
|
|
528
509
|
export declare class DefaultAzureCredential extends ChainedTokenCredential {
|
|
529
510
|
/**
|
|
530
511
|
* Creates an instance of the DefaultAzureCredential class.
|
|
531
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
|
+
*
|
|
532
518
|
* @param options - Optional parameters. See {@link DefaultAzureCredentialOptions}.
|
|
533
519
|
*/
|
|
534
520
|
constructor(options?: DefaultAzureCredentialOptions);
|
|
@@ -761,10 +747,10 @@ export declare function getDefaultAzureCredential(): TokenCredential;
|
|
|
761
747
|
export { GetTokenOptions }
|
|
762
748
|
|
|
763
749
|
/**
|
|
764
|
-
* The type of an Azure Identity
|
|
750
|
+
* The type of an Azure Identity plugin, a function accepting a plugin
|
|
765
751
|
* context.
|
|
766
752
|
*/
|
|
767
|
-
export declare type
|
|
753
|
+
export declare type IdentityPlugin = (context: unknown) => void;
|
|
768
754
|
|
|
769
755
|
/**
|
|
770
756
|
* Enables authentication to Azure Active Directory inside of the web browser
|
|
@@ -940,6 +926,101 @@ export declare class ManagedIdentityCredential implements TokenCredential {
|
|
|
940
926
|
getToken(scopes: string | string[], options?: GetTokenOptions): Promise<AccessToken>;
|
|
941
927
|
}
|
|
942
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
|
+
|
|
943
1024
|
/**
|
|
944
1025
|
* Helps specify a regional authority, or "AutoDiscoverRegion" to auto-detect the region.
|
|
945
1026
|
*/
|
|
@@ -1081,8 +1162,7 @@ export declare interface TokenCachePersistenceOptions {
|
|
|
1081
1162
|
*
|
|
1082
1163
|
* Based on this identifier, the persistence file will be located in any of the following places:
|
|
1083
1164
|
* - Darwin: '/Users/user/.IdentityService/<name>'
|
|
1084
|
-
* - Windows 8
|
|
1085
|
-
* - Windows XP: 'C:\\Documents and Settings\\user\\Application Data\\Local\\.IdentityService\\<name>'
|
|
1165
|
+
* - Windows 8+: 'C:\\Users\\user\\AppData\\Local\\.IdentityService\\<name>'
|
|
1086
1166
|
* - Linux: '/home/user/.IdentityService/<name>'
|
|
1087
1167
|
*/
|
|
1088
1168
|
name?: string;
|
|
@@ -1090,7 +1170,7 @@ export declare interface TokenCachePersistenceOptions {
|
|
|
1090
1170
|
* If set to true, the cache will be stored without encryption if no OS level user encryption is available.
|
|
1091
1171
|
* When set to false, the PersistentTokenCache will throw an error if no OS level user encryption is available.
|
|
1092
1172
|
*/
|
|
1093
|
-
|
|
1173
|
+
unsafeAllowUnencryptedStorage?: boolean;
|
|
1094
1174
|
}
|
|
1095
1175
|
export { TokenCredential }
|
|
1096
1176
|
|
|
@@ -1112,8 +1192,8 @@ export declare interface TokenCredentialOptions extends CommonClientOptions {
|
|
|
1112
1192
|
}
|
|
1113
1193
|
|
|
1114
1194
|
/**
|
|
1115
|
-
* Extend Azure Identity with additional functionality. Pass
|
|
1116
|
-
*
|
|
1195
|
+
* Extend Azure Identity with additional functionality. Pass a plugin from
|
|
1196
|
+
* a plugin package, such as:
|
|
1117
1197
|
*
|
|
1118
1198
|
* - `@azure/identity-cache-persistence`: provides persistent token caching
|
|
1119
1199
|
* - `@azure/identity-vscode`: provides the dependencies of
|
|
@@ -1122,12 +1202,12 @@ export declare interface TokenCredentialOptions extends CommonClientOptions {
|
|
|
1122
1202
|
* Example:
|
|
1123
1203
|
*
|
|
1124
1204
|
* ```javascript
|
|
1125
|
-
* import {
|
|
1205
|
+
* import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
|
|
1126
1206
|
*
|
|
1127
|
-
* import {
|
|
1128
|
-
*
|
|
1207
|
+
* import { useIdentityPlugin, DefaultAzureCredential } from "@azure/identity";
|
|
1208
|
+
* useIdentityPlugin(cachePersistencePlugin);
|
|
1129
1209
|
*
|
|
1130
|
-
* // The
|
|
1210
|
+
* // The plugin has the capability to extend `DefaultAzureCredential` and to
|
|
1131
1211
|
* // add middleware to the underlying credentials, such as persistence.
|
|
1132
1212
|
* const credential = new DefaultAzureCredential({
|
|
1133
1213
|
* tokenCachePersistenceOptions: {
|
|
@@ -1136,9 +1216,9 @@ export declare interface TokenCredentialOptions extends CommonClientOptions {
|
|
|
1136
1216
|
* });
|
|
1137
1217
|
* ```
|
|
1138
1218
|
*
|
|
1139
|
-
* @param
|
|
1219
|
+
* @param plugin - the plugin to register
|
|
1140
1220
|
*/
|
|
1141
|
-
export declare function
|
|
1221
|
+
export declare function useIdentityPlugin(plugin: IdentityPlugin): void;
|
|
1142
1222
|
|
|
1143
1223
|
/**
|
|
1144
1224
|
* Enables authentication to Azure Active Directory with a user's
|
|
@@ -1194,6 +1274,11 @@ export declare class VisualStudioCodeCredential implements TokenCredential {
|
|
|
1194
1274
|
/**
|
|
1195
1275
|
* Creates an instance of VisualStudioCodeCredential to use for automatically authenticating via VSCode.
|
|
1196
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
|
+
*
|
|
1197
1282
|
* @param options - Options for configuring the client which makes the authentication request.
|
|
1198
1283
|
*/
|
|
1199
1284
|
constructor(options?: VisualStudioCodeCredentialOptions);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visualStudioCodeCredentialExtension.js","sourceRoot":"","sources":["../../../src/credentials/visualStudioCodeCredentialExtension.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// Copyright (c) Microsoft Corporation\n// Licensed under the MIT license.\n\n/**\n * A function that searches for credentials in the Visual Studio Code credential store.\n *\n * @returns an array of credentials (username and password)\n * @internal\n */\nexport type VSCodeCredentialFinder = () => Promise<Array<{ account: string; password: string }>>;\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
// This module is a shim for the extension consumer in the browser
|
|
4
|
-
export function useIdentityExtension(_extension) {
|
|
5
|
-
throw new Error("Identity extensions are not supported in browser environments.");
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=consumer.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consumer.browser.js","sourceRoot":"","sources":["../../../src/extensions/consumer.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,kEAAkE;AAElE,MAAM,UAAU,oBAAoB,CAAC,UAAmB;IACtD,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;AACpF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// This module is a shim for the extension consumer in the browser\n\nexport function useIdentityExtension(_extension: unknown): void {\n throw new Error(\"Identity extensions are not supported in browser environments.\");\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../../src/extensions/consumer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEpF;;;;GAIG;AACH,MAAM,gBAAgB,GAA0B;IAC9C,kBAAkB,EAAE,wBAAwB;IAC5C,uBAAuB,EAAE,uBAAuB;CACjD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAA4B;IAC/D,SAAS,CAAC,gBAAgB,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { AzureExtensionContext, IdentityExtension } from \"./provider\";\nimport { msalNodeFlowCacheControl } from \"../msal/nodeFlows/nodeCommon\";\nimport { vsCodeCredentialControl } from \"../credentials/visualStudioCodeCredential\";\n\n/**\n * The context passed to an Identity Extension. This contains objects that\n * extensions can use to set backend implementations.\n * @internal\n */\nconst extensionContext: AzureExtensionContext = {\n cachePluginControl: msalNodeFlowCacheControl,\n vsCodeCredentialControl: vsCodeCredentialControl\n};\n\n/**\n * Extend Azure Identity with additional functionality. Pass an extension from\n * an extension package, such as:\n *\n * - `@azure/identity-cache-persistence`: provides persistent token caching\n * - `@azure/identity-vscode`: provides the dependencies of\n * `VisualStudioCodeCredential` and enables it\n *\n * Example:\n *\n * ```javascript\n * import { cachePersistenceExtension } from \"@azure/identity-cache-persistence\";\n *\n * import { useIdentityExtension, DefaultAzureCredential } from \"@azure/identity\";\n * useIdentityExtension(persistence);\n *\n * // The extension has the capability to extend `DefaultAzureCredential` and to\n * // add middleware to the underlying credentials, such as persistence.\n * const credential = new DefaultAzureCredential({\n * tokenCachePersistenceOptions: {\n * enabled: true\n * }\n * });\n * ```\n *\n * @param extension - the extension to register\n */\nexport function useIdentityExtension(extension: IdentityExtension): void {\n extension(extensionContext);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/extensions/provider.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { VSCodeCredentialFinder } from \"../credentials/visualStudioCodeCredentialExtension\";\nimport { TokenCachePersistenceOptions } from \"../msal/nodeFlows/tokenCachePersistenceOptions\";\n\n/**\n * The type of an Azure Identity Extension, a function accepting an extension\n * context.\n */\nexport type IdentityExtension = (context: unknown) => void;\n\n/**\n * Extension context entries for controlling cache plugins.\n */\nexport interface CachePluginControl {\n setPersistence(\n persistenceFactory: (\n options?: TokenCachePersistenceOptions\n ) => Promise<import(\"@azure/msal-common\").ICachePlugin>\n ): void;\n}\n\n/**\n * Extension context entries for controlling VisualStudioCodeCredential.\n */\nexport interface VisualStudioCodeCredentialControl {\n setVsCodeCredentialFinder(finder: VSCodeCredentialFinder): void;\n}\n\n/**\n * Context options passed to an extension during initialization.\n *\n * Extension authors are responsible for casting their extension context values\n * to this type.\n *\n * @internal\n */\nexport interface AzureExtensionContext {\n cachePluginControl: CachePluginControl;\n vsCodeCredentialControl: VisualStudioCodeCredentialControl;\n}\n"]}
|