@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
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import { __awaiter } from "tslib";
|
|
4
|
-
/**
|
|
5
|
-
* TokenCachePersistence is not available for the browsers.
|
|
6
|
-
* @internal
|
|
7
|
-
*/
|
|
8
|
-
export class TokenCachePersistence {
|
|
9
|
-
constructor(_options = {}) {
|
|
10
|
-
throw new Error("TokenCachePersistence is not available in the browser");
|
|
11
|
-
}
|
|
12
|
-
getPersistence() {
|
|
13
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
throw new Error("TokenCachePersistence is not available in the browser");
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
register(_options) {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
throw new Error("TokenCachePersistence is not available in the browser");
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=TokenCachePersistence.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TokenCachePersistence.browser.js","sourceRoot":"","sources":["../../../src/tokenCache/TokenCachePersistence.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAKlC;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IAChC,YAAY,WAAyC,EAAE;QACrD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAEK,cAAc;;YAClB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;KAAA;IAEK,QAAQ,CAAC,QAAoC;;YACjD,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;KAAA;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCachePersistenceOptions } from \"./persistencePlatforms\";\nimport { MsalPersistence, CachePlugin, TokenCacheRegisterOptions } from \"./types\";\n\n/**\n * TokenCachePersistence is not available for the browsers.\n * @internal\n */\nexport class TokenCachePersistence {\n constructor(_options: TokenCachePersistenceOptions = {}) {\n throw new Error(\"TokenCachePersistence is not available in the browser\");\n }\n\n async getPersistence(): Promise<MsalPersistence | undefined> {\n throw new Error(\"TokenCachePersistence is not available in the browser\");\n }\n\n async register(_options?: TokenCacheRegisterOptions): Promise<CachePlugin> {\n throw new Error(\"TokenCachePersistence is not available in the browser\");\n }\n}\n"]}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import { __awaiter } from "tslib";
|
|
4
|
-
import { CredentialUnavailableError } from "../client/errors";
|
|
5
|
-
import { isNode15, isNode8, Node15NotSupportedError, Node8NotSupportedError } from "./nodeVersion";
|
|
6
|
-
import { msalPersistencePlatforms } from "./persistencePlatforms";
|
|
7
|
-
/**
|
|
8
|
-
* Determines which platform we can trust to deliver a persistence layer for MSAL,
|
|
9
|
-
* and also provides a way to extract a CachePlugin that can be sent to MSAL through the MSAL applications' configurations.
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export class TokenCachePersistence {
|
|
13
|
-
constructor(options = {}) {
|
|
14
|
-
this.options = options;
|
|
15
|
-
}
|
|
16
|
-
getPersistence() {
|
|
17
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const { win32, darwin, linux } = msalPersistencePlatforms;
|
|
19
|
-
const availablePlatform = [win32, darwin, linux].find((platform) => platform.isAvailable());
|
|
20
|
-
return availablePlatform === null || availablePlatform === void 0 ? void 0 : availablePlatform.persistence(this.options);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
register(_options) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const lockOptions = {
|
|
26
|
-
retryNumber: 100,
|
|
27
|
-
retryDelay: 50
|
|
28
|
-
};
|
|
29
|
-
let extensions;
|
|
30
|
-
try {
|
|
31
|
-
/* eslint-disable-next-line @typescript-eslint/no-require-imports */
|
|
32
|
-
extensions = require("@azure/msal-node-extensions");
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
throw new CredentialUnavailableError("To use the token cache persistence feature, please install the package '@azure/msal-node-extensions@1.0.0-alpha.6'.");
|
|
36
|
-
}
|
|
37
|
-
if (isNode8 || isNode15) {
|
|
38
|
-
throw isNode8 ? Node8NotSupportedError : Node15NotSupportedError;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const { PersistenceCachePlugin } = extensions;
|
|
42
|
-
const persistence = yield this.getPersistence();
|
|
43
|
-
if (!persistence) {
|
|
44
|
-
throw new Error("No persistence implementations available.");
|
|
45
|
-
}
|
|
46
|
-
return new PersistenceCachePlugin(persistence, lockOptions);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=TokenCachePersistence.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TokenCachePersistence.js","sourceRoot":"","sources":["../../../src/tokenCache/TokenCachePersistence.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACnG,OA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AC7D;QACH,CAAC;KAAA;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CredentialUnavailableError } from \"../client/errors\";\nimport { isNode15, isNode8, Node15NotSupportedError, Node8NotSupportedError } from \"./nodeVersion\";\nimport { msalPersistencePlatforms, TokenCachePersistenceOptions } from \"./persistencePlatforms\";\nimport { MsalPersistence, CachePlugin, TokenCacheRegisterOptions } from \"./types\";\n\n/**\n * Determines which platform we can trust to deliver a persistence layer for MSAL,\n * and also provides a way to extract a CachePlugin that can be sent to MSAL through the MSAL applications' configurations.\n * @internal\n */\nexport class TokenCachePersistence {\n private options: TokenCachePersistenceOptions;\n\n constructor(options: TokenCachePersistenceOptions = {}) {\n this.options = options;\n }\n\n async getPersistence(): Promise<MsalPersistence | undefined> {\n const { win32, darwin, linux } = msalPersistencePlatforms;\n\n const availablePlatform = [win32, darwin, linux].find((platform) => platform.isAvailable());\n\n return availablePlatform?.persistence(this.options);\n }\n\n async register(_options?: TokenCacheRegisterOptions): Promise<CachePlugin> {\n const lockOptions = {\n retryNumber: 100,\n retryDelay: 50\n };\n\n let extensions: any;\n try {\n /* eslint-disable-next-line @typescript-eslint/no-require-imports */\n extensions = require(\"@azure/msal-node-extensions\");\n } catch (e) {\n throw new CredentialUnavailableError(\n \"To use the token cache persistence feature, please install the package '@azure/msal-node-extensions@1.0.0-alpha.6'.\"\n );\n }\n\n if (isNode8 || isNode15) {\n throw isNode8 ? Node8NotSupportedError : Node15NotSupportedError;\n } else {\n const { PersistenceCachePlugin } = extensions;\n\n const persistence = await this.getPersistence();\n if (!persistence) {\n throw new Error(\"No persistence implementations available.\");\n }\n\n return new PersistenceCachePlugin(persistence, lockOptions);\n }\n }\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
// TODO:
|
|
4
|
-
// Either drop Node 8 or re-enable it.
|
|
5
|
-
// Also TODO, re-enable Node 15 asap.
|
|
6
|
-
export const isNode8 = process.versions.node[0] === "8";
|
|
7
|
-
export const Node8NotSupportedError = new Error("Node 8 does not support persistence caching.");
|
|
8
|
-
export const isNode15 = process.versions.node.slice(0, 2) === "15";
|
|
9
|
-
export const Node15NotSupportedError = new Error("Node 15 does not support persistence caching.");
|
|
10
|
-
//# sourceMappingURL=nodeVersion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nodeVersion.js","sourceRoot":"","sources":["../../../src/tokenCache/nodeVersion.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,QAAQ;AACR,sCAAsC;AACtC,qCAAqC;AAErC,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AACxD,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;AACnE,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n// TODO:\n// Either drop Node 8 or re-enable it.\n// Also TODO, re-enable Node 15 asap.\n\nexport const isNode8 = process.versions.node[0] === \"8\";\nexport const Node8NotSupportedError = new Error(\"Node 8 does not support persistence caching.\");\n\nexport const isNode15 = process.versions.node.slice(0, 2) === \"15\";\nexport const Node15NotSupportedError = new Error(\"Node 15 does not support persistence caching.\");\n"]}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
/* eslint-disable tsdoc/syntax */
|
|
4
|
-
import { __awaiter } from "tslib";
|
|
5
|
-
import * as path from "path";
|
|
6
|
-
import { isNode15, isNode8, Node15NotSupportedError, Node8NotSupportedError } from "./nodeVersion";
|
|
7
|
-
/**
|
|
8
|
-
* Local application data folder
|
|
9
|
-
* Expected values:
|
|
10
|
-
* - Darwin: '/Users/user/'
|
|
11
|
-
* - Windows 8: 'C:\Users\user\AppData\Local'
|
|
12
|
-
* - Windows XP: 'C:\Documents and Settings\user\Application Data\Local'
|
|
13
|
-
* - Linux: '/home/user/.local/share'
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
const localApplicationDataFolder = process.env.APPDATA
|
|
17
|
-
? process.env.APPDATA.replace(/(.Roaming)*$/, "\\Local")
|
|
18
|
-
: (process.platform === "darwin" ? process.env.HOME : process.env.HOME);
|
|
19
|
-
/**
|
|
20
|
-
* Dictionary of values that we use as default as we discover, pick and enable the persistence layer.
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
export const defaultMsalValues = {
|
|
24
|
-
tokenCache: {
|
|
25
|
-
name: "msal.cache",
|
|
26
|
-
// Expected values:
|
|
27
|
-
// - Darwin: '/Users/user/.IdentityService'
|
|
28
|
-
// - Windows 8: 'C:\Users\user\AppData\Local\.IdentityService'
|
|
29
|
-
// - Windows XP: 'C:\Documents and Settings\user\Application Data\Local\.IdentityService'
|
|
30
|
-
// - Linux: '/home/user/.IdentityService'
|
|
31
|
-
directory: path.join(localApplicationDataFolder, ".IdentityService")
|
|
32
|
-
},
|
|
33
|
-
keyRing: {
|
|
34
|
-
label: "MSALCache",
|
|
35
|
-
schema: "msal.cache",
|
|
36
|
-
collection: "default",
|
|
37
|
-
attributes: {
|
|
38
|
-
MsalClientID: "Microsoft.Developer.IdentityService",
|
|
39
|
-
"Microsoft.Developer.IdentityService": "1.0.0.0"
|
|
40
|
-
},
|
|
41
|
-
service: "Microsoft.Developer.IdentityService",
|
|
42
|
-
account: "MSALCache"
|
|
43
|
-
},
|
|
44
|
-
keyChain: {
|
|
45
|
-
service: "Microsoft.Developer.IdentityService",
|
|
46
|
-
account: "MSALCache"
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Expected responses:
|
|
51
|
-
* - Darwin: '/Users/user/.IdentityService/<name>'
|
|
52
|
-
* - Windows 8: 'C:\Users\user\AppData\Local\.IdentityService\<name>'
|
|
53
|
-
* - Windows XP: 'C:\Documents and Settings\user\Application Data\Local\.IdentityService\<name>'
|
|
54
|
-
* - Linux: '/home/user/.IdentityService/<name>'
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
function getPersistencePath(name) {
|
|
58
|
-
return path.join(defaultMsalValues.tokenCache.directory, name);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Set of the platforms we attempt to deliver persistence on.
|
|
62
|
-
*
|
|
63
|
-
* - On Windows we use DPAPI.
|
|
64
|
-
* - On OSX (Darwin), we try to use the system's Keychain, otherwise if the property `allowUnencryptedStorage` is set to true, we use an unencrypted file.
|
|
65
|
-
* - On Linux, we try to use the system's Keyring, otherwise if the property `allowUnencryptedStorage` is set to true, we use an unencrypted file.
|
|
66
|
-
*
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
export const msalPersistencePlatforms = {
|
|
70
|
-
win32: {
|
|
71
|
-
name: "win32",
|
|
72
|
-
isAvailable: () => process.platform === "win32",
|
|
73
|
-
persistence: ({ name = defaultMsalValues.tokenCache.name } = {}) => {
|
|
74
|
-
if (isNode8 || isNode15) {
|
|
75
|
-
throw isNode8 ? Node8NotSupportedError : Node15NotSupportedError;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
const { FilePersistenceWithDataProtection, DataProtectionScope
|
|
79
|
-
/* eslint-disable-next-line @typescript-eslint/no-require-imports */
|
|
80
|
-
} = require("@azure/msal-node-extensions");
|
|
81
|
-
return FilePersistenceWithDataProtection.create(getPersistencePath(name), DataProtectionScope.CurrentUser);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
darwin: {
|
|
86
|
-
name: "darwin",
|
|
87
|
-
isAvailable: () => process.platform === "darwin",
|
|
88
|
-
persistence(options = {}) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const { name, allowUnencryptedStorage } = options;
|
|
91
|
-
const { service, account } = defaultMsalValues.keyChain;
|
|
92
|
-
const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);
|
|
93
|
-
if (isNode8 || isNode15) {
|
|
94
|
-
throw isNode8 ? Node8NotSupportedError : Node15NotSupportedError;
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
/* eslint-disable-next-line @typescript-eslint/no-require-imports */
|
|
98
|
-
const { KeychainPersistence, FilePersistence } = require("@azure/msal-node-extensions");
|
|
99
|
-
try {
|
|
100
|
-
const persistence = yield KeychainPersistence.create(persistencePath, service, account);
|
|
101
|
-
// If we don't encounter an error when trying to read from the keychain, then we should be good to go.
|
|
102
|
-
yield persistence.load();
|
|
103
|
-
return persistence;
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
// If we got an error while trying to read from the keyring,
|
|
107
|
-
// we will proceed only if the user has specified that unencrypted storage is allowed.
|
|
108
|
-
if (!allowUnencryptedStorage) {
|
|
109
|
-
throw new Error("MSAL was unable to read from the system's keyring.");
|
|
110
|
-
}
|
|
111
|
-
return FilePersistence.create(persistencePath);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
linux: {
|
|
118
|
-
name: "linux",
|
|
119
|
-
isAvailable: () => process.platform === "linux",
|
|
120
|
-
persistence(options = {}) {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
const { name, allowUnencryptedStorage } = options;
|
|
123
|
-
const { service, account } = defaultMsalValues.keyRing;
|
|
124
|
-
const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);
|
|
125
|
-
if (isNode8 || isNode15) {
|
|
126
|
-
throw isNode8 ? Node8NotSupportedError : Node15NotSupportedError;
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
/* eslint-disable-next-line @typescript-eslint/no-require-imports */
|
|
130
|
-
const { LibSecretPersistence, FilePersistence } = require("@azure/msal-node-extensions");
|
|
131
|
-
try {
|
|
132
|
-
const persistence = yield LibSecretPersistence.create(persistencePath, service, account);
|
|
133
|
-
// If we don't encounter an error when trying to read from the keyring, then we should be good to go.
|
|
134
|
-
yield persistence.load();
|
|
135
|
-
return persistence;
|
|
136
|
-
}
|
|
137
|
-
catch (e) {
|
|
138
|
-
// If we got an error while trying to read from the keyring,
|
|
139
|
-
// we will proceed only if the user has specified that unencrypted storage is allowed.
|
|
140
|
-
if (!allowUnencryptedStorage) {
|
|
141
|
-
throw new Error("MSAL was unable to read from the system's keyring.");
|
|
142
|
-
}
|
|
143
|
-
return FilePersistence.create(persistencePath);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
//# sourceMappingURL=persistencePlatforms.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"persistencePlatforms.js","sourceRoot":"","sources":["../../../src/tokenCache/persistencePlatforms.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,iCAAiC;;AAEjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEnG;;;;;;;;GAQG;AACH,MAAM,0BAA0B,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO;IACpD,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,SAAS,CAAC;IACxD,CAAC,CAAC,CAAC,OA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C,MAAM,CAAC,eAAe,CAAC,CAAC;qBAChD;iBACF;YACH,CAAC;SAAA;KACF;IAED,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO;QACzC,WAAW,CAAC,UAAwC,EAAE;;gBAC1D,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC;gBAClD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC;gBACvD,MAAM,eAAe,GAAG,kBAAkB,CAAC,IAAI,IAAI,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBAEtF,IAAI,OAAO,IAAI,QAAQ,EAAE;oBACvB,MAAM,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,uBAAuB,CAAC;iBAClE;qBAAM;oBACL,oEAAoE;oBACpE,MAAM,EAAE,oBAAoB,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;oBAEzF,IAAI;wBACF,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;wBACzF,qGAAqG;wBACrG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAC;wBACzB,OAAO,WAAW,CAAC;qBACpB;oBAAC,OAAO,CAAC,EAAE;wBACV,4DAA4D;wBAC5D,sFAAsF;wBACtF,IAAI,CAAC,uBAAuB,EAAE;4BAC5B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;yBACvE;wBACD,OAAO,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;qBAChD;iBACF;YACH,CAAC;SAAA;KACF;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/* eslint-disable tsdoc/syntax */\n\nimport * as path from \"path\";\nimport { MsalPersistence } from \"./types\";\nimport { isNode15, isNode8, Node15NotSupportedError, Node8NotSupportedError } from \"./nodeVersion\";\n\n/**\n * Local application data folder\n * Expected values:\n * - Darwin: '/Users/user/'\n * - Windows 8: 'C:\\Users\\user\\AppData\\Local'\n * - Windows XP: 'C:\\Documents and Settings\\user\\Application Data\\Local'\n * - Linux: '/home/user/.local/share'\n * @internal\n */\nconst localApplicationDataFolder = process.env.APPDATA\n ? process.env.APPDATA.replace(/(.Roaming)*$/, \"\\\\Local\")\n : (process.platform === \"darwin\" ? process.env.HOME : process.env.HOME)!;\n\n/**\n * Dictionary of values that we use as default as we discover, pick and enable the persistence layer.\n * @internal\n */\nexport const defaultMsalValues = {\n tokenCache: {\n name: \"msal.cache\",\n // Expected values:\n // - Darwin: '/Users/user/.IdentityService'\n // - Windows 8: 'C:\\Users\\user\\AppData\\Local\\.IdentityService'\n // - Windows XP: 'C:\\Documents and Settings\\user\\Application Data\\Local\\.IdentityService'\n // - Linux: '/home/user/.IdentityService'\n directory: path.join(localApplicationDataFolder, \".IdentityService\")\n },\n keyRing: {\n label: \"MSALCache\",\n schema: \"msal.cache\",\n collection: \"default\",\n attributes: {\n MsalClientID: \"Microsoft.Developer.IdentityService\",\n \"Microsoft.Developer.IdentityService\": \"1.0.0.0\"\n },\n service: \"Microsoft.Developer.IdentityService\",\n account: \"MSALCache\"\n },\n keyChain: {\n service: \"Microsoft.Developer.IdentityService\",\n account: \"MSALCache\"\n }\n};\n\n/**\n * Parameters that enable token cache persistence in the Identity credentials.\n */\nexport interface TokenCachePersistenceOptions {\n /**\n * Unique identifier for the persistent token cache.\n *\n * Based on this identifier, the persistence file will be located in any of the following places:\n * - Darwin: '/Users/user/.IdentityService/<name>'\n * - Windows 8: 'C:\\Users\\user\\AppData\\Local\\.IdentityService\\<name>'\n * - Windows XP: 'C:\\Documents and Settings\\user\\Application Data\\Local\\.IdentityService\\<name>'\n * - Linux: '/home/user/.IdentityService/<name>'\n */\n name?: string;\n /**\n * If set to true, the cache will be stored without encryption if no OS level user encryption is available.\n * When set to false, the PersistentTokenCache will throw an error if no OS level user encryption is available.\n */\n allowUnencryptedStorage?: boolean;\n}\n\n/**\n * The platforms we currently support.\n * @internal\n */\nexport type MsalPersistencePlatforms = \"win32\" | \"darwin\" | \"linux\";\n\n/**\n * The common set of properties of all the persistence implementations we have.\n * @internal\n */\nexport interface MsalPersistenceImplementation {\n name: string;\n isAvailable(): boolean;\n /**\n * Returns the available persistance.\n * @param options Input options provided by the end user.\n */\n persistence(options?: TokenCachePersistenceOptions): Promise<MsalPersistence>;\n}\n\n/**\n * Expected responses:\n * - Darwin: '/Users/user/.IdentityService/<name>'\n * - Windows 8: 'C:\\Users\\user\\AppData\\Local\\.IdentityService\\<name>'\n * - Windows XP: 'C:\\Documents and Settings\\user\\Application Data\\Local\\.IdentityService\\<name>'\n * - Linux: '/home/user/.IdentityService/<name>'\n * @internal\n */\nfunction getPersistencePath(name: string): string {\n return path.join(defaultMsalValues.tokenCache.directory, name);\n}\n\n/**\n * Set of the platforms we attempt to deliver persistence on.\n *\n * - On Windows we use DPAPI.\n * - On OSX (Darwin), we try to use the system's Keychain, otherwise if the property `allowUnencryptedStorage` is set to true, we use an unencrypted file.\n * - On Linux, we try to use the system's Keyring, otherwise if the property `allowUnencryptedStorage` is set to true, we use an unencrypted file.\n *\n * @internal\n */\nexport const msalPersistencePlatforms: Record<\n MsalPersistencePlatforms,\n MsalPersistenceImplementation\n> = {\n win32: {\n name: \"win32\",\n isAvailable: () => process.platform === \"win32\",\n persistence: ({ name = defaultMsalValues.tokenCache.name } = {}): Promise<MsalPersistence> => {\n if (isNode8 || isNode15) {\n throw isNode8 ? Node8NotSupportedError : Node15NotSupportedError;\n } else {\n const {\n FilePersistenceWithDataProtection,\n DataProtectionScope\n /* eslint-disable-next-line @typescript-eslint/no-require-imports */\n } = require(\"@azure/msal-node-extensions\");\n return FilePersistenceWithDataProtection.create(\n getPersistencePath(name),\n DataProtectionScope.CurrentUser\n );\n }\n }\n },\n\n darwin: {\n name: \"darwin\",\n isAvailable: () => process.platform === \"darwin\",\n async persistence(options: TokenCachePersistenceOptions = {}): Promise<MsalPersistence> {\n const { name, allowUnencryptedStorage } = options;\n const { service, account } = defaultMsalValues.keyChain;\n const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);\n\n if (isNode8 || isNode15) {\n throw isNode8 ? Node8NotSupportedError : Node15NotSupportedError;\n } else {\n /* eslint-disable-next-line @typescript-eslint/no-require-imports */\n const { KeychainPersistence, FilePersistence } = require(\"@azure/msal-node-extensions\");\n\n try {\n const persistence = await KeychainPersistence.create(persistencePath, service, account);\n // If we don't encounter an error when trying to read from the keychain, then we should be good to go.\n await persistence.load();\n return persistence;\n } catch (e) {\n // If we got an error while trying to read from the keyring,\n // we will proceed only if the user has specified that unencrypted storage is allowed.\n if (!allowUnencryptedStorage) {\n throw new Error(\"MSAL was unable to read from the system's keyring.\");\n }\n return FilePersistence.create(persistencePath);\n }\n }\n }\n },\n\n linux: {\n name: \"linux\",\n isAvailable: () => process.platform === \"linux\",\n async persistence(options: TokenCachePersistenceOptions = {}): Promise<MsalPersistence> {\n const { name, allowUnencryptedStorage } = options;\n const { service, account } = defaultMsalValues.keyRing;\n const persistencePath = getPersistencePath(name || defaultMsalValues.tokenCache.name);\n\n if (isNode8 || isNode15) {\n throw isNode8 ? Node8NotSupportedError : Node15NotSupportedError;\n } else {\n /* eslint-disable-next-line @typescript-eslint/no-require-imports */\n const { LibSecretPersistence, FilePersistence } = require(\"@azure/msal-node-extensions\");\n\n try {\n const persistence = await LibSecretPersistence.create(persistencePath, service, account);\n // If we don't encounter an error when trying to read from the keyring, then we should be good to go.\n await persistence.load();\n return persistence;\n } catch (e) {\n // If we got an error while trying to read from the keyring,\n // we will proceed only if the user has specified that unencrypted storage is allowed.\n if (!allowUnencryptedStorage) {\n throw new Error(\"MSAL was unable to read from the system's keyring.\");\n }\n return FilePersistence.create(persistencePath);\n }\n }\n }\n }\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tokenCache/types.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport interface TokenCacheRegisterOptions {}\n\n/**\n * Custom definition of MSAL's MsalPersistence interface.\n * @internal\n */\nexport interface MsalPersistence {\n save(contents: string): Promise<void>;\n\n // Load returns Promise<string> on MsalPersistence,\n // but it returns Promise<string | null> on FilePersistenceWithDataProtection.\n load(): Promise<string | null>;\n\n delete(): Promise<boolean>;\n reloadNecessary(lastSync: number): Promise<boolean>;\n getFilePath(): string;\n\n // // Incompatible between MsalPersistence and FilePersistenceWithDataProtection\n // // Error says:\n // // Type 'Logger' is missing the following properties from type 'Logger': packageName, packageVersion, clone\n // getLogger(): Logger;\n}\n\n/**\n * Custom definition of MSAL's MsalCachePlugin interface.\n * @internal\n */\nexport interface CachePlugin {\n beforeCacheAccess: (tokenCacheContext: any) => Promise<void>;\n afterCacheAccess: (tokenCacheContext: any) => Promise<void>;\n}\n\n/**\n * A simple representation of the TokenCache.\n * @internal\n */\nexport interface TokenCache {\n register(_options?: TokenCacheRegisterOptions): Promise<CachePlugin>;\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
export function getAuthorityHostEnvironment() {
|
|
4
|
-
if (process.env.AZURE_AUTHORITY_HOST) {
|
|
5
|
-
return {
|
|
6
|
-
authorityHost: process.env.AZURE_AUTHORITY_HOST
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=authHostEnv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authHostEnv.js","sourceRoot":"","sources":["../../../src/util/authHostEnv.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,UAAU,2BAA2B;IACzC,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE;QACpC,OAAO;YACL,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;SAChD,CAAC;KACH;SAAM;QACL,OAAO,SAAS,CAAC;KAClB;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport function getAuthorityHostEnvironment(): { authorityHost: string } | undefined {\n if (process.env.AZURE_AUTHORITY_HOST) {\n return {\n authorityHost: process.env.AZURE_AUTHORITY_HOST\n };\n } else {\n return undefined;\n }\n}\n"]}
|