@azure/identity 3.0.0-alpha.20220809.2 → 3.0.0-alpha.20220919.5

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

Potentially problematic release.


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

Files changed (132) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +1932 -1889
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/client/identityClient.js +5 -9
  5. package/dist-esm/src/client/identityClient.js.map +1 -1
  6. package/dist-esm/src/constants.js +4 -0
  7. package/dist-esm/src/constants.js.map +1 -1
  8. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  9. package/dist-esm/src/credentials/authorizationCodeCredential.js +10 -3
  10. package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
  11. package/dist-esm/src/credentials/authorizationCodeCredentialOptions.js +4 -0
  12. package/dist-esm/src/credentials/authorizationCodeCredentialOptions.js.map +1 -0
  13. package/dist-esm/src/credentials/azureApplicationCredential.browser.js.map +1 -1
  14. package/dist-esm/src/credentials/azureApplicationCredential.js +1 -1
  15. package/dist-esm/src/credentials/azureApplicationCredential.js.map +1 -1
  16. package/dist-esm/src/credentials/azureApplicationCredentialOptions.js +4 -0
  17. package/dist-esm/src/credentials/azureApplicationCredentialOptions.js.map +1 -0
  18. package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
  19. package/dist-esm/src/credentials/azureCliCredential.js +6 -9
  20. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  21. package/dist-esm/src/credentials/azureCliCredentialOptions.js.map +1 -1
  22. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
  23. package/dist-esm/src/credentials/azurePowerShellCredential.js +5 -8
  24. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
  25. package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js.map +1 -1
  26. package/dist-esm/src/credentials/chainedTokenCredential.js +1 -1
  27. package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
  28. package/dist-esm/src/credentials/clientAssertionCredential.js +4 -1
  29. package/dist-esm/src/credentials/clientAssertionCredential.js.map +1 -1
  30. package/dist-esm/src/credentials/clientAssertionCredentialOptions.js +4 -0
  31. package/dist-esm/src/credentials/clientAssertionCredentialOptions.js.map +1 -0
  32. package/dist-esm/src/credentials/clientCertificateCredential.js +4 -0
  33. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  34. package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
  35. package/dist-esm/src/credentials/clientSecretCredential.browser.js +6 -3
  36. package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
  37. package/dist-esm/src/credentials/clientSecretCredential.js +6 -1
  38. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  39. package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
  40. package/dist-esm/src/credentials/defaultAzureCredential.browser.js.map +1 -1
  41. package/dist-esm/src/credentials/defaultAzureCredential.js +2 -2
  42. package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
  43. package/dist-esm/src/credentials/defaultAzureCredentialOptions.js +4 -0
  44. package/dist-esm/src/credentials/defaultAzureCredentialOptions.js.map +1 -0
  45. package/dist-esm/src/credentials/deviceCodeCredential.js +7 -2
  46. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  47. package/dist-esm/src/credentials/deviceCodeCredentialOptions.js.map +1 -1
  48. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
  49. package/dist-esm/src/credentials/environmentCredential.js +18 -7
  50. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  51. package/dist-esm/src/credentials/environmentCredentialOptions.js +4 -0
  52. package/dist-esm/src/credentials/environmentCredentialOptions.js.map +1 -0
  53. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +8 -2
  54. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  55. package/dist-esm/src/credentials/interactiveBrowserCredential.js +8 -3
  56. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  57. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  58. package/dist-esm/src/credentials/interactiveCredentialOptions.js.map +1 -1
  59. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +1 -8
  60. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
  61. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js +1 -8
  62. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -1
  63. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +1 -8
  64. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
  65. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +31 -53
  66. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  67. package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
  68. package/dist-esm/src/credentials/managedIdentityCredential/utils.js +23 -0
  69. package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
  70. package/dist-esm/src/credentials/multiTenantTokenCredentialOptions.js +4 -0
  71. package/dist-esm/src/credentials/multiTenantTokenCredentialOptions.js.map +1 -0
  72. package/dist-esm/src/credentials/onBehalfOfCredential.js +7 -2
  73. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -1
  74. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -1
  75. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +8 -17
  76. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
  77. package/dist-esm/src/credentials/usernamePasswordCredential.js +7 -2
  78. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  79. package/dist-esm/src/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  80. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -1
  81. package/dist-esm/src/credentials/visualStudioCodeCredential.js +9 -7
  82. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -1
  83. package/dist-esm/src/credentials/visualStudioCodeCredentialOptions.js +4 -0
  84. package/dist-esm/src/credentials/visualStudioCodeCredentialOptions.js.map +1 -0
  85. package/dist-esm/src/index.js +4 -4
  86. package/dist-esm/src/index.js.map +1 -1
  87. package/dist-esm/src/msal/browserFlows/msalAuthCode.js +2 -2
  88. package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
  89. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js +2 -3
  90. package/dist-esm/src/msal/browserFlows/msalBrowserCommon.js.map +1 -1
  91. package/dist-esm/src/msal/credentials.js.map +1 -1
  92. package/dist-esm/src/msal/flows.js.map +1 -1
  93. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +1 -1
  94. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -1
  95. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js +1 -1
  96. package/dist-esm/src/msal/nodeFlows/msalClientAssertion.js.map +1 -1
  97. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +3 -3
  98. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
  99. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
  100. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +1 -1
  101. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js +4 -5
  102. package/dist-esm/src/msal/nodeFlows/msalNodeCommon.js.map +1 -1
  103. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +1 -1
  104. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -1
  105. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +4 -4
  106. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
  107. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +1 -1
  108. package/dist-esm/src/msal/utils.js +4 -4
  109. package/dist-esm/src/msal/utils.js.map +1 -1
  110. package/dist-esm/src/plugins/provider.js.map +1 -1
  111. package/dist-esm/src/util/logging.js +4 -0
  112. package/dist-esm/src/util/logging.js.map +1 -1
  113. package/dist-esm/src/util/processMultiTenantRequest.browser.js +29 -0
  114. package/dist-esm/src/util/processMultiTenantRequest.browser.js.map +1 -0
  115. package/dist-esm/src/util/processMultiTenantRequest.js +32 -0
  116. package/dist-esm/src/util/processMultiTenantRequest.js.map +1 -0
  117. package/dist-esm/src/util/scopeUtils.js +7 -0
  118. package/dist-esm/src/util/scopeUtils.js.map +1 -1
  119. package/dist-esm/src/util/tenantIdUtils.js +44 -0
  120. package/dist-esm/src/util/tenantIdUtils.js.map +1 -0
  121. package/dist-esm/src/util/tracing.js +1 -1
  122. package/dist-esm/src/util/tracing.js.map +1 -1
  123. package/package.json +2 -2
  124. package/types/identity.d.ts +59 -15
  125. package/dist-esm/src/util/checkTenantId.js +0 -11
  126. package/dist-esm/src/util/checkTenantId.js.map +0 -1
  127. package/dist-esm/src/util/resolveTenantId.js +0 -18
  128. package/dist-esm/src/util/resolveTenantId.js.map +0 -1
  129. package/dist-esm/src/util/validateMultiTenant.browser.js +0 -22
  130. package/dist-esm/src/util/validateMultiTenant.browser.js.map +0 -1
  131. package/dist-esm/src/util/validateMultiTenant.js +0 -29
  132. package/dist-esm/src/util/validateMultiTenant.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkTenantId.js","sourceRoot":"","sources":["../../../src/util/checkTenantId.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAoB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,UAAU,aAAa,CAAC,MAAwB,EAAE,QAAgB;IACtE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE;QACzC,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,2KAA2K,CAC5K,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QACpC,MAAM,KAAK,CAAC;KACb;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CredentialLogger, formatError } from \"../util/logging\";\n\nexport function checkTenantId(logger: CredentialLogger, tenantId: string): void {\n if (!tenantId.match(/^[0-9a-zA-Z-.:/]+$/)) {\n const error = new Error(\n \"Invalid tenant id provided. You can locate your tenant id by following the instructions listed here: https://docs.microsoft.com/partner-center/find-ids-and-domain-names.\"\n );\n logger.info(formatError(\"\", error));\n throw error;\n }\n}\n"]}
@@ -1,18 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- import { DeveloperSignOnClientId } from "../constants";
4
- import { checkTenantId } from "./checkTenantId";
5
- export function resolveTenantId(logger, tenantId, clientId) {
6
- if (tenantId) {
7
- checkTenantId(logger, tenantId);
8
- return tenantId;
9
- }
10
- if (!clientId) {
11
- clientId = DeveloperSignOnClientId;
12
- }
13
- if (clientId !== DeveloperSignOnClientId) {
14
- return "common";
15
- }
16
- return "organizations";
17
- }
18
- //# sourceMappingURL=resolveTenantId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveTenantId.js","sourceRoot":"","sources":["../../../src/util/resolveTenantId.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,UAAU,eAAe,CAC7B,MAAwB,EACxB,QAAiB,EACjB,QAAiB;IAEjB,IAAI,QAAQ,EAAE;QACZ,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChC,OAAO,QAAQ,CAAC;KACjB;IACD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,uBAAuB,CAAC;KACpC;IACD,IAAI,QAAQ,KAAK,uBAAuB,EAAE;QACxC,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { DeveloperSignOnClientId } from \"../constants\";\nimport { checkTenantId } from \"./checkTenantId\";\nimport { CredentialLogger } from \"./logging\";\n\nexport function resolveTenantId(\n logger: CredentialLogger,\n tenantId?: string,\n clientId?: string\n): string {\n if (tenantId) {\n checkTenantId(logger, tenantId);\n return tenantId;\n }\n if (!clientId) {\n clientId = DeveloperSignOnClientId;\n }\n if (clientId !== DeveloperSignOnClientId) {\n return \"common\";\n }\n return \"organizations\";\n}\n"]}
@@ -1,22 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- /**
4
- * @internal
5
- */
6
- export const multiTenantADFSErrorMessage = "A new tenant Id can't be assigned through the GetTokenOptions when a credential has been originally configured to use the tenant `adfs`.";
7
- /**
8
- * Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,
9
- * unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),
10
- * or unless the original tenant Id is `adfs`.
11
- * @internal
12
- */
13
- export function processMultiTenantRequest(tenantId, getTokenOptions) {
14
- if (!(getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId)) {
15
- return tenantId;
16
- }
17
- if (tenantId === "adfs") {
18
- throw new Error(multiTenantADFSErrorMessage);
19
- }
20
- return getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId;
21
- }
22
- //# sourceMappingURL=validateMultiTenant.browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateMultiTenant.browser.js","sourceRoot":"","sources":["../../../src/util/validateMultiTenant.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,0IAA0I,CAAC;AAE7I;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAiB,EACjB,eAAiC;IAEjC,IAAI,CAAC,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAA,EAAE;QAC9B,OAAO,QAAQ,CAAC;KACjB;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAC9C;IACD,OAAO,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAC;AACnC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { GetTokenOptions } from \"@azure/core-auth\";\n\n/**\n * @internal\n */\nexport const multiTenantADFSErrorMessage =\n \"A new tenant Id can't be assigned through the GetTokenOptions when a credential has been originally configured to use the tenant `adfs`.\";\n\n/**\n * Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,\n * unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),\n * or unless the original tenant Id is `adfs`.\n * @internal\n */\nexport function processMultiTenantRequest(\n tenantId?: string,\n getTokenOptions?: GetTokenOptions\n): string | undefined {\n if (!getTokenOptions?.tenantId) {\n return tenantId;\n }\n if (tenantId === \"adfs\") {\n throw new Error(multiTenantADFSErrorMessage);\n }\n return getTokenOptions?.tenantId;\n}\n"]}
@@ -1,29 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT license.
3
- /**
4
- * @internal
5
- */
6
- export const multiTenantDisabledErrorMessage = "A getToken request was attempted with a tenant different than the tenant configured at the initialization of the credential, but multi-tenant authentication has been disabled by the environment variable AZURE_IDENTITY_DISABLE_MULTITENANTAUTH.";
7
- /**
8
- * @internal
9
- */
10
- export const multiTenantADFSErrorMessage = "A new tenant Id can't be assigned through the GetTokenOptions when a credential has been originally configured to use the tenant `adfs`.";
11
- /**
12
- * Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,
13
- * unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),
14
- * or unless the original tenant Id is `adfs`.
15
- * @internal
16
- */
17
- export function processMultiTenantRequest(tenantId, getTokenOptions) {
18
- if (!(getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId)) {
19
- return tenantId;
20
- }
21
- if (process.env.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH) {
22
- throw new Error(multiTenantDisabledErrorMessage);
23
- }
24
- if (tenantId === "adfs") {
25
- throw new Error(multiTenantADFSErrorMessage);
26
- }
27
- return getTokenOptions === null || getTokenOptions === void 0 ? void 0 : getTokenOptions.tenantId;
28
- }
29
- //# sourceMappingURL=validateMultiTenant.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateMultiTenant.js","sourceRoot":"","sources":["../../../src/util/validateMultiTenant.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,oPAAoP,CAAC;AAEvP;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC,0IAA0I,CAAC;AAE7I;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAiB,EACjB,eAAiC;IAEjC,IAAI,CAAC,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAA,EAAE;QAC9B,OAAO,QAAQ,CAAC;KACjB;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE;QACtD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;KAClD;IACD,IAAI,QAAQ,KAAK,MAAM,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAC9C;IACD,OAAO,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAC;AACnC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { GetTokenOptions } from \"@azure/core-auth\";\n\n/**\n * @internal\n */\nexport const multiTenantDisabledErrorMessage =\n \"A getToken request was attempted with a tenant different than the tenant configured at the initialization of the credential, but multi-tenant authentication has been disabled by the environment variable AZURE_IDENTITY_DISABLE_MULTITENANTAUTH.\";\n\n/**\n * @internal\n */\nexport const multiTenantADFSErrorMessage =\n \"A new tenant Id can't be assigned through the GetTokenOptions when a credential has been originally configured to use the tenant `adfs`.\";\n\n/**\n * Of getToken contains a tenantId, this functions allows picking this tenantId as the appropriate for authentication,\n * unless multitenant authentication has been disabled through the AZURE_IDENTITY_DISABLE_MULTITENANTAUTH (on Node.js),\n * or unless the original tenant Id is `adfs`.\n * @internal\n */\nexport function processMultiTenantRequest(\n tenantId?: string,\n getTokenOptions?: GetTokenOptions\n): string | undefined {\n if (!getTokenOptions?.tenantId) {\n return tenantId;\n }\n if (process.env.AZURE_IDENTITY_DISABLE_MULTITENANTAUTH) {\n throw new Error(multiTenantDisabledErrorMessage);\n }\n if (tenantId === \"adfs\") {\n throw new Error(multiTenantADFSErrorMessage);\n }\n return getTokenOptions?.tenantId;\n}\n"]}