@azure/identity 2.0.0-beta.3 → 2.0.0

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 (149) hide show
  1. package/CHANGELOG.md +232 -6
  2. package/README.md +124 -39
  3. package/dist/index.js +2317 -1596
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/client/identityClient.js +147 -133
  6. package/dist-esm/src/client/identityClient.js.map +1 -1
  7. package/dist-esm/src/constants.js +1 -1
  8. package/dist-esm/src/constants.js.map +1 -1
  9. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js +1 -1
  10. package/dist-esm/src/credentials/authorizationCodeCredential.browser.js.map +1 -1
  11. package/dist-esm/src/credentials/authorizationCodeCredential.js +13 -76
  12. package/dist-esm/src/credentials/authorizationCodeCredential.js.map +1 -1
  13. package/dist-esm/src/credentials/azureApplicationCredential.browser.js +34 -0
  14. package/dist-esm/src/credentials/azureApplicationCredential.browser.js.map +1 -0
  15. package/dist-esm/src/credentials/azureApplicationCredential.js +36 -0
  16. package/dist-esm/src/credentials/azureApplicationCredential.js.map +1 -0
  17. package/dist-esm/src/credentials/azureCliCredential.browser.js +7 -0
  18. package/dist-esm/src/credentials/azureCliCredential.browser.js.map +1 -1
  19. package/dist-esm/src/credentials/azureCliCredential.js +110 -83
  20. package/dist-esm/src/credentials/azureCliCredential.js.map +1 -1
  21. package/dist-esm/src/credentials/azureCliCredentialOptions.js +4 -0
  22. package/dist-esm/src/credentials/azureCliCredentialOptions.js.map +1 -0
  23. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js +3 -1
  24. package/dist-esm/src/credentials/azurePowerShellCredential.browser.js.map +1 -1
  25. package/dist-esm/src/credentials/azurePowerShellCredential.js +93 -83
  26. package/dist-esm/src/credentials/azurePowerShellCredential.js.map +1 -1
  27. package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js +4 -0
  28. package/dist-esm/src/credentials/azurePowerShellCredentialOptions.js.map +1 -0
  29. package/dist-esm/src/credentials/chainedTokenCredential.js +34 -37
  30. package/dist-esm/src/credentials/chainedTokenCredential.js.map +1 -1
  31. package/dist-esm/src/credentials/clientCertificateCredential.browser.js +7 -0
  32. package/dist-esm/src/credentials/clientCertificateCredential.browser.js.map +1 -1
  33. package/dist-esm/src/credentials/clientCertificateCredential.js +24 -23
  34. package/dist-esm/src/credentials/clientCertificateCredential.js.map +1 -1
  35. package/dist-esm/src/credentials/clientCertificateCredentialOptions.js.map +1 -1
  36. package/dist-esm/src/credentials/clientSecretCredential.browser.js +39 -44
  37. package/dist-esm/src/credentials/clientSecretCredential.browser.js.map +1 -1
  38. package/dist-esm/src/credentials/clientSecretCredential.js +9 -11
  39. package/dist-esm/src/credentials/clientSecretCredential.js.map +1 -1
  40. package/dist-esm/src/credentials/clientSecretCredentialOptions.js.map +1 -1
  41. package/dist-esm/src/credentials/credentialPersistenceOptions.js +4 -0
  42. package/dist-esm/src/credentials/credentialPersistenceOptions.js.map +1 -0
  43. package/dist-esm/src/credentials/defaultAzureCredential.browser.js +1 -1
  44. package/dist-esm/src/credentials/defaultAzureCredential.browser.js.map +1 -1
  45. package/dist-esm/src/credentials/defaultAzureCredential.js +50 -27
  46. package/dist-esm/src/credentials/defaultAzureCredential.js.map +1 -1
  47. package/dist-esm/src/credentials/deviceCodeCredential.browser.js +7 -0
  48. package/dist-esm/src/credentials/deviceCodeCredential.browser.js.map +1 -1
  49. package/dist-esm/src/credentials/deviceCodeCredential.js +27 -22
  50. package/dist-esm/src/credentials/deviceCodeCredential.js.map +1 -1
  51. package/dist-esm/src/credentials/deviceCodeCredentialOptions.js.map +1 -1
  52. package/dist-esm/src/credentials/environmentCredential.browser.js +7 -0
  53. package/dist-esm/src/credentials/environmentCredential.browser.js.map +1 -1
  54. package/dist-esm/src/credentials/environmentCredential.js +39 -38
  55. package/dist-esm/src/credentials/environmentCredential.js.map +1 -1
  56. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js +20 -29
  57. package/dist-esm/src/credentials/interactiveBrowserCredential.browser.js.map +1 -1
  58. package/dist-esm/src/credentials/interactiveBrowserCredential.js +23 -29
  59. package/dist-esm/src/credentials/interactiveBrowserCredential.js.map +1 -1
  60. package/dist-esm/src/credentials/interactiveBrowserCredentialOptions.js.map +1 -1
  61. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +36 -22
  62. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
  63. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +62 -47
  64. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
  65. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +33 -22
  66. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
  67. package/dist-esm/src/credentials/managedIdentityCredential/constants.js +2 -1
  68. package/dist-esm/src/credentials/managedIdentityCredential/constants.js.map +1 -1
  69. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +42 -27
  70. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
  71. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +115 -91
  72. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  73. package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js +3 -6
  74. package/dist-esm/src/credentials/managedIdentityCredential/index.browser.js.map +1 -1
  75. package/dist-esm/src/credentials/managedIdentityCredential/index.js +120 -125
  76. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  77. package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
  78. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js +82 -0
  79. package/dist-esm/src/credentials/managedIdentityCredential/tokenExchangeMsi.js.map +1 -0
  80. package/dist-esm/src/credentials/managedIdentityCredential/utils.js +14 -8
  81. package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
  82. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js +23 -0
  83. package/dist-esm/src/credentials/onBehalfOfCredential.browser.js.map +1 -0
  84. package/dist-esm/src/credentials/onBehalfOfCredential.js +57 -0
  85. package/dist-esm/src/credentials/onBehalfOfCredential.js.map +1 -0
  86. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js +4 -0
  87. package/dist-esm/src/credentials/onBehalfOfCredentialOptions.js.map +1 -0
  88. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js +41 -46
  89. package/dist-esm/src/credentials/usernamePasswordCredential.browser.js.map +1 -1
  90. package/dist-esm/src/credentials/usernamePasswordCredential.js +9 -13
  91. package/dist-esm/src/credentials/usernamePasswordCredential.js.map +1 -1
  92. package/dist-esm/src/credentials/usernamePasswordCredentialOptions.js.map +1 -1
  93. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js +27 -0
  94. package/dist-esm/src/credentials/visualStudioCodeCredential.browser.js.map +1 -0
  95. package/dist-esm/src/credentials/visualStudioCodeCredential.js +183 -0
  96. package/dist-esm/src/credentials/visualStudioCodeCredential.js.map +1 -0
  97. package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js +4 -0
  98. package/dist-esm/src/credentials/visualStudioCodeCredentialPlugin.js.map +1 -0
  99. package/dist-esm/src/{client/errors.js → errors.js} +16 -1
  100. package/dist-esm/src/errors.js.map +1 -0
  101. package/dist-esm/src/index.js +4 -2
  102. package/dist-esm/src/index.js.map +1 -1
  103. package/dist-esm/src/msal/browserFlows/browserCommon.js +33 -31
  104. package/dist-esm/src/msal/browserFlows/browserCommon.js.map +1 -1
  105. package/dist-esm/src/msal/browserFlows/msalAuthCode.js +113 -115
  106. package/dist-esm/src/msal/browserFlows/msalAuthCode.js.map +1 -1
  107. package/dist-esm/src/msal/credentials.js.map +1 -1
  108. package/dist-esm/src/msal/flows.js.map +1 -1
  109. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js +41 -0
  110. package/dist-esm/src/msal/nodeFlows/msalAuthorizationCode.js.map +1 -0
  111. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js +65 -46
  112. package/dist-esm/src/msal/nodeFlows/msalClientCertificate.js.map +1 -1
  113. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js +15 -16
  114. package/dist-esm/src/msal/nodeFlows/msalClientSecret.js.map +1 -1
  115. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js +20 -22
  116. package/dist-esm/src/msal/nodeFlows/msalDeviceCode.js.map +1 -1
  117. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js +56 -0
  118. package/dist-esm/src/msal/nodeFlows/msalOnBehalfOf.js.map +1 -0
  119. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js +44 -33
  120. package/dist-esm/src/msal/nodeFlows/msalOpenBrowser.js.map +1 -1
  121. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js +15 -17
  122. package/dist-esm/src/msal/nodeFlows/msalUsernamePassword.js.map +1 -1
  123. package/dist-esm/src/msal/nodeFlows/nodeCommon.js +141 -98
  124. package/dist-esm/src/msal/nodeFlows/nodeCommon.js.map +1 -1
  125. package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js +4 -0
  126. package/dist-esm/src/msal/nodeFlows/tokenCachePersistenceOptions.js.map +1 -0
  127. package/dist-esm/src/msal/utils.js +23 -15
  128. package/dist-esm/src/msal/utils.js.map +1 -1
  129. package/dist-esm/src/plugins/consumer.browser.js +7 -0
  130. package/dist-esm/src/plugins/consumer.browser.js.map +1 -0
  131. package/dist-esm/src/plugins/consumer.js +44 -0
  132. package/dist-esm/src/plugins/consumer.js.map +1 -0
  133. package/dist-esm/src/plugins/provider.js +4 -0
  134. package/dist-esm/src/plugins/provider.js.map +1 -0
  135. package/dist-esm/src/regionalAuthority.js +115 -0
  136. package/dist-esm/src/regionalAuthority.js.map +1 -0
  137. package/dist-esm/src/util/tracing.js +24 -27
  138. package/dist-esm/src/util/tracing.js.map +1 -1
  139. package/dist-esm/src/util/validateMultiTenant.browser.js +22 -0
  140. package/dist-esm/src/util/validateMultiTenant.browser.js.map +1 -0
  141. package/dist-esm/src/util/validateMultiTenant.js +29 -0
  142. package/dist-esm/src/util/validateMultiTenant.js.map +1 -0
  143. package/package.json +44 -28
  144. package/types/identity.d.ts +482 -126
  145. package/dist-esm/src/client/errors.js.map +0 -1
  146. package/dist-esm/src/msal/errors.js +0 -22
  147. package/dist-esm/src/msal/errors.js.map +0 -1
  148. package/dist-esm/src/util/authHostEnv.js +0 -13
  149. package/dist-esm/src/util/authHostEnv.js.map +0 -1
@@ -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"]}
@@ -0,0 +1,115 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * Helps specify a regional authority, or "AutoDiscoverRegion" to auto-detect the region.
5
+ */
6
+ export var RegionalAuthority;
7
+ (function (RegionalAuthority) {
8
+ /** Instructs MSAL to attempt to discover the region */
9
+ RegionalAuthority["AutoDiscoverRegion"] = "AutoDiscoverRegion";
10
+ /** Uses the {@link RegionalAuthority} for the Azure 'westus' region. */
11
+ RegionalAuthority["USWest"] = "westus";
12
+ /** Uses the {@link RegionalAuthority} for the Azure 'westus2' region. */
13
+ RegionalAuthority["USWest2"] = "westus2";
14
+ /** Uses the {@link RegionalAuthority} for the Azure 'centralus' region. */
15
+ RegionalAuthority["USCentral"] = "centralus";
16
+ /** Uses the {@link RegionalAuthority} for the Azure 'eastus' region. */
17
+ RegionalAuthority["USEast"] = "eastus";
18
+ /** Uses the {@link RegionalAuthority} for the Azure 'eastus2' region. */
19
+ RegionalAuthority["USEast2"] = "eastus2";
20
+ /** Uses the {@link RegionalAuthority} for the Azure 'northcentralus' region. */
21
+ RegionalAuthority["USNorthCentral"] = "northcentralus";
22
+ /** Uses the {@link RegionalAuthority} for the Azure 'southcentralus' region. */
23
+ RegionalAuthority["USSouthCentral"] = "southcentralus";
24
+ /** Uses the {@link RegionalAuthority} for the Azure 'westcentralus' region. */
25
+ RegionalAuthority["USWestCentral"] = "westcentralus";
26
+ /** Uses the {@link RegionalAuthority} for the Azure 'canadacentral' region. */
27
+ RegionalAuthority["CanadaCentral"] = "canadacentral";
28
+ /** Uses the {@link RegionalAuthority} for the Azure 'canadaeast' region. */
29
+ RegionalAuthority["CanadaEast"] = "canadaeast";
30
+ /** Uses the {@link RegionalAuthority} for the Azure 'brazilsouth' region. */
31
+ RegionalAuthority["BrazilSouth"] = "brazilsouth";
32
+ /** Uses the {@link RegionalAuthority} for the Azure 'northeurope' region. */
33
+ RegionalAuthority["EuropeNorth"] = "northeurope";
34
+ /** Uses the {@link RegionalAuthority} for the Azure 'westeurope' region. */
35
+ RegionalAuthority["EuropeWest"] = "westeurope";
36
+ /** Uses the {@link RegionalAuthority} for the Azure 'uksouth' region. */
37
+ RegionalAuthority["UKSouth"] = "uksouth";
38
+ /** Uses the {@link RegionalAuthority} for the Azure 'ukwest' region. */
39
+ RegionalAuthority["UKWest"] = "ukwest";
40
+ /** Uses the {@link RegionalAuthority} for the Azure 'francecentral' region. */
41
+ RegionalAuthority["FranceCentral"] = "francecentral";
42
+ /** Uses the {@link RegionalAuthority} for the Azure 'francesouth' region. */
43
+ RegionalAuthority["FranceSouth"] = "francesouth";
44
+ /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandnorth' region. */
45
+ RegionalAuthority["SwitzerlandNorth"] = "switzerlandnorth";
46
+ /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandwest' region. */
47
+ RegionalAuthority["SwitzerlandWest"] = "switzerlandwest";
48
+ /** Uses the {@link RegionalAuthority} for the Azure 'germanynorth' region. */
49
+ RegionalAuthority["GermanyNorth"] = "germanynorth";
50
+ /** Uses the {@link RegionalAuthority} for the Azure 'germanywestcentral' region. */
51
+ RegionalAuthority["GermanyWestCentral"] = "germanywestcentral";
52
+ /** Uses the {@link RegionalAuthority} for the Azure 'norwaywest' region. */
53
+ RegionalAuthority["NorwayWest"] = "norwaywest";
54
+ /** Uses the {@link RegionalAuthority} for the Azure 'norwayeast' region. */
55
+ RegionalAuthority["NorwayEast"] = "norwayeast";
56
+ /** Uses the {@link RegionalAuthority} for the Azure 'eastasia' region. */
57
+ RegionalAuthority["AsiaEast"] = "eastasia";
58
+ /** Uses the {@link RegionalAuthority} for the Azure 'southeastasia' region. */
59
+ RegionalAuthority["AsiaSouthEast"] = "southeastasia";
60
+ /** Uses the {@link RegionalAuthority} for the Azure 'japaneast' region. */
61
+ RegionalAuthority["JapanEast"] = "japaneast";
62
+ /** Uses the {@link RegionalAuthority} for the Azure 'japanwest' region. */
63
+ RegionalAuthority["JapanWest"] = "japanwest";
64
+ /** Uses the {@link RegionalAuthority} for the Azure 'australiaeast' region. */
65
+ RegionalAuthority["AustraliaEast"] = "australiaeast";
66
+ /** Uses the {@link RegionalAuthority} for the Azure 'australiasoutheast' region. */
67
+ RegionalAuthority["AustraliaSouthEast"] = "australiasoutheast";
68
+ /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral' region. */
69
+ RegionalAuthority["AustraliaCentral"] = "australiacentral";
70
+ /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral2' region. */
71
+ RegionalAuthority["AustraliaCentral2"] = "australiacentral2";
72
+ /** Uses the {@link RegionalAuthority} for the Azure 'centralindia' region. */
73
+ RegionalAuthority["IndiaCentral"] = "centralindia";
74
+ /** Uses the {@link RegionalAuthority} for the Azure 'southindia' region. */
75
+ RegionalAuthority["IndiaSouth"] = "southindia";
76
+ /** Uses the {@link RegionalAuthority} for the Azure 'westindia' region. */
77
+ RegionalAuthority["IndiaWest"] = "westindia";
78
+ /** Uses the {@link RegionalAuthority} for the Azure 'koreasouth' region. */
79
+ RegionalAuthority["KoreaSouth"] = "koreasouth";
80
+ /** Uses the {@link RegionalAuthority} for the Azure 'koreacentral' region. */
81
+ RegionalAuthority["KoreaCentral"] = "koreacentral";
82
+ /** Uses the {@link RegionalAuthority} for the Azure 'uaecentral' region. */
83
+ RegionalAuthority["UAECentral"] = "uaecentral";
84
+ /** Uses the {@link RegionalAuthority} for the Azure 'uaenorth' region. */
85
+ RegionalAuthority["UAENorth"] = "uaenorth";
86
+ /** Uses the {@link RegionalAuthority} for the Azure 'southafricanorth' region. */
87
+ RegionalAuthority["SouthAfricaNorth"] = "southafricanorth";
88
+ /** Uses the {@link RegionalAuthority} for the Azure 'southafricawest' region. */
89
+ RegionalAuthority["SouthAfricaWest"] = "southafricawest";
90
+ /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth' region. */
91
+ RegionalAuthority["ChinaNorth"] = "chinanorth";
92
+ /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast' region. */
93
+ RegionalAuthority["ChinaEast"] = "chinaeast";
94
+ /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth2' region. */
95
+ RegionalAuthority["ChinaNorth2"] = "chinanorth2";
96
+ /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast2' region. */
97
+ RegionalAuthority["ChinaEast2"] = "chinaeast2";
98
+ /** Uses the {@link RegionalAuthority} for the Azure 'germanycentral' region. */
99
+ RegionalAuthority["GermanyCentral"] = "germanycentral";
100
+ /** Uses the {@link RegionalAuthority} for the Azure 'germanynortheast' region. */
101
+ RegionalAuthority["GermanyNorthEast"] = "germanynortheast";
102
+ /** Uses the {@link RegionalAuthority} for the Azure 'usgovvirginia' region. */
103
+ RegionalAuthority["GovernmentUSVirginia"] = "usgovvirginia";
104
+ /** Uses the {@link RegionalAuthority} for the Azure 'usgoviowa' region. */
105
+ RegionalAuthority["GovernmentUSIowa"] = "usgoviowa";
106
+ /** Uses the {@link RegionalAuthority} for the Azure 'usgovarizona' region. */
107
+ RegionalAuthority["GovernmentUSArizona"] = "usgovarizona";
108
+ /** Uses the {@link RegionalAuthority} for the Azure 'usgovtexas' region. */
109
+ RegionalAuthority["GovernmentUSTexas"] = "usgovtexas";
110
+ /** Uses the {@link RegionalAuthority} for the Azure 'usdodeast' region. */
111
+ RegionalAuthority["GovernmentUSDodEast"] = "usdodeast";
112
+ /** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */
113
+ RegionalAuthority["GovernmentUSDodCentral"] = "usdodcentral";
114
+ })(RegionalAuthority || (RegionalAuthority = {}));
115
+ //# sourceMappingURL=regionalAuthority.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regionalAuthority.js","sourceRoot":"","sources":["../../src/regionalAuthority.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAN,IAAY,iBA2GX;AA3GD,WAAY,iBAAiB;IAC3B,uDAAuD;IACvD,8DAAyC,CAAA;IACzC,wEAAwE;IACxE,sCAAiB,CAAA;IACjB,yEAAyE;IACzE,wCAAmB,CAAA;IACnB,2EAA2E;IAC3E,4CAAuB,CAAA;IACvB,wEAAwE;IACxE,sCAAiB,CAAA;IACjB,yEAAyE;IACzE,wCAAmB,CAAA;IACnB,gFAAgF;IAChF,sDAAiC,CAAA;IACjC,gFAAgF;IAChF,sDAAiC,CAAA;IACjC,+EAA+E;IAC/E,oDAA+B,CAAA;IAC/B,+EAA+E;IAC/E,oDAA+B,CAAA;IAC/B,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,6EAA6E;IAC7E,gDAA2B,CAAA;IAC3B,6EAA6E;IAC7E,gDAA2B,CAAA;IAC3B,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,yEAAyE;IACzE,wCAAmB,CAAA;IACnB,wEAAwE;IACxE,sCAAiB,CAAA;IACjB,+EAA+E;IAC/E,oDAA+B,CAAA;IAC/B,6EAA6E;IAC7E,gDAA2B,CAAA;IAC3B,kFAAkF;IAClF,0DAAqC,CAAA;IACrC,iFAAiF;IACjF,wDAAmC,CAAA;IACnC,8EAA8E;IAC9E,kDAA6B,CAAA;IAC7B,oFAAoF;IACpF,8DAAyC,CAAA;IACzC,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,0EAA0E;IAC1E,0CAAqB,CAAA;IACrB,+EAA+E;IAC/E,oDAA+B,CAAA;IAC/B,2EAA2E;IAC3E,4CAAuB,CAAA;IACvB,2EAA2E;IAC3E,4CAAuB,CAAA;IACvB,+EAA+E;IAC/E,oDAA+B,CAAA;IAC/B,oFAAoF;IACpF,8DAAyC,CAAA;IACzC,kFAAkF;IAClF,0DAAqC,CAAA;IACrC,mFAAmF;IACnF,4DAAuC,CAAA;IACvC,8EAA8E;IAC9E,kDAA6B,CAAA;IAC7B,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,2EAA2E;IAC3E,4CAAuB,CAAA;IACvB,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,8EAA8E;IAC9E,kDAA6B,CAAA;IAC7B,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,0EAA0E;IAC1E,0CAAqB,CAAA;IACrB,kFAAkF;IAClF,0DAAqC,CAAA;IACrC,iFAAiF;IACjF,wDAAmC,CAAA;IACnC,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,2EAA2E;IAC3E,4CAAuB,CAAA;IACvB,6EAA6E;IAC7E,gDAA2B,CAAA;IAC3B,4EAA4E;IAC5E,8CAAyB,CAAA;IACzB,gFAAgF;IAChF,sDAAiC,CAAA;IACjC,kFAAkF;IAClF,0DAAqC,CAAA;IACrC,+EAA+E;IAC/E,2DAAsC,CAAA;IACtC,2EAA2E;IAC3E,mDAA8B,CAAA;IAC9B,8EAA8E;IAC9E,yDAAoC,CAAA;IACpC,4EAA4E;IAC5E,qDAAgC,CAAA;IAChC,2EAA2E;IAC3E,sDAAiC,CAAA;IACjC,8EAA8E;IAC9E,4DAAuC,CAAA;AACzC,CAAC,EA3GW,iBAAiB,KAAjB,iBAAiB,QA2G5B","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Helps specify a regional authority, or \"AutoDiscoverRegion\" to auto-detect the region.\n */\nexport enum RegionalAuthority {\n /** Instructs MSAL to attempt to discover the region */\n AutoDiscoverRegion = \"AutoDiscoverRegion\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westus' region. */\n USWest = \"westus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westus2' region. */\n USWest2 = \"westus2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'centralus' region. */\n USCentral = \"centralus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'eastus' region. */\n USEast = \"eastus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'eastus2' region. */\n USEast2 = \"eastus2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'northcentralus' region. */\n USNorthCentral = \"northcentralus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southcentralus' region. */\n USSouthCentral = \"southcentralus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westcentralus' region. */\n USWestCentral = \"westcentralus\",\n /** Uses the {@link RegionalAuthority} for the Azure 'canadacentral' region. */\n CanadaCentral = \"canadacentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'canadaeast' region. */\n CanadaEast = \"canadaeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'brazilsouth' region. */\n BrazilSouth = \"brazilsouth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'northeurope' region. */\n EuropeNorth = \"northeurope\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westeurope' region. */\n EuropeWest = \"westeurope\",\n /** Uses the {@link RegionalAuthority} for the Azure 'uksouth' region. */\n UKSouth = \"uksouth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'ukwest' region. */\n UKWest = \"ukwest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'francecentral' region. */\n FranceCentral = \"francecentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'francesouth' region. */\n FranceSouth = \"francesouth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandnorth' region. */\n SwitzerlandNorth = \"switzerlandnorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'switzerlandwest' region. */\n SwitzerlandWest = \"switzerlandwest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'germanynorth' region. */\n GermanyNorth = \"germanynorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'germanywestcentral' region. */\n GermanyWestCentral = \"germanywestcentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'norwaywest' region. */\n NorwayWest = \"norwaywest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'norwayeast' region. */\n NorwayEast = \"norwayeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'eastasia' region. */\n AsiaEast = \"eastasia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southeastasia' region. */\n AsiaSouthEast = \"southeastasia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'japaneast' region. */\n JapanEast = \"japaneast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'japanwest' region. */\n JapanWest = \"japanwest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'australiaeast' region. */\n AustraliaEast = \"australiaeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'australiasoutheast' region. */\n AustraliaSouthEast = \"australiasoutheast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral' region. */\n AustraliaCentral = \"australiacentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'australiacentral2' region. */\n AustraliaCentral2 = \"australiacentral2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'centralindia' region. */\n IndiaCentral = \"centralindia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southindia' region. */\n IndiaSouth = \"southindia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'westindia' region. */\n IndiaWest = \"westindia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'koreasouth' region. */\n KoreaSouth = \"koreasouth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'koreacentral' region. */\n KoreaCentral = \"koreacentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'uaecentral' region. */\n UAECentral = \"uaecentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'uaenorth' region. */\n UAENorth = \"uaenorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southafricanorth' region. */\n SouthAfricaNorth = \"southafricanorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'southafricawest' region. */\n SouthAfricaWest = \"southafricawest\",\n /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth' region. */\n ChinaNorth = \"chinanorth\",\n /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast' region. */\n ChinaEast = \"chinaeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'chinanorth2' region. */\n ChinaNorth2 = \"chinanorth2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'chinaeast2' region. */\n ChinaEast2 = \"chinaeast2\",\n /** Uses the {@link RegionalAuthority} for the Azure 'germanycentral' region. */\n GermanyCentral = \"germanycentral\",\n /** Uses the {@link RegionalAuthority} for the Azure 'germanynortheast' region. */\n GermanyNorthEast = \"germanynortheast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usgovvirginia' region. */\n GovernmentUSVirginia = \"usgovvirginia\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usgoviowa' region. */\n GovernmentUSIowa = \"usgoviowa\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usgovarizona' region. */\n GovernmentUSArizona = \"usgovarizona\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usgovtexas' region. */\n GovernmentUSTexas = \"usgovtexas\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usdodeast' region. */\n GovernmentUSDodEast = \"usdodeast\",\n /** Uses the {@link RegionalAuthority} for the Azure 'usdodcentral' region. */\n GovernmentUSDodCentral = \"usdodcentral\"\n}\n"]}
@@ -1,13 +1,12 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- import { __awaiter } from "tslib";
4
3
  import { createSpanFunction, SpanStatusCode } from "@azure/core-tracing";
5
4
  /**
6
5
  * Creates a span using the global tracer.
7
6
  * @internal
8
7
  */
9
8
  export const createSpan = createSpanFunction({
10
- packagePrefix: "Azure.Identity",
9
+ packagePrefix: "",
11
10
  namespace: "Microsoft.AAD"
12
11
  });
13
12
  /**
@@ -15,34 +14,32 @@ export const createSpan = createSpanFunction({
15
14
  * Traces an operation and properly handles reporting start, end and errors for a given span
16
15
  *
17
16
  * @param operationName - Name of a method in the TClient type
18
- * @param options - An options class, typically derived from \@azure/core-http/RequestOptionsBase
17
+ * @param options - An options class, typically derived from \@azure/core-rest-pipeline/RequestOptionsBase
19
18
  * @param fn - The function to call with an options class that properly propagates the span context
20
19
  *
21
20
  * @internal
22
21
  */
23
- export function trace(operationName, options, fn, createSpanFn = createSpan) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const { updatedOptions, span } = createSpanFn(operationName, options);
26
- try {
27
- // NOTE: we really do need to await on this function here so we can handle any exceptions thrown and properly
28
- // close the span.
29
- const result = yield fn(updatedOptions, span);
30
- // otel 0.16+ needs this or else the code ends up being set as UNSET
31
- span.setStatus({
32
- code: SpanStatusCode.OK
33
- });
34
- return result;
35
- }
36
- catch (err) {
37
- span.setStatus({
38
- code: SpanStatusCode.ERROR,
39
- message: err.message
40
- });
41
- throw err;
42
- }
43
- finally {
44
- span.end();
45
- }
46
- });
22
+ export async function trace(operationName, options, fn, createSpanFn = createSpan) {
23
+ const { updatedOptions, span } = createSpanFn(operationName, options);
24
+ try {
25
+ // NOTE: we really do need to await on this function here so we can handle any exceptions thrown and properly
26
+ // close the span.
27
+ const result = await fn(updatedOptions, span);
28
+ // otel 0.16+ needs this or else the code ends up being set as UNSET
29
+ span.setStatus({
30
+ code: SpanStatusCode.OK
31
+ });
32
+ return result;
33
+ }
34
+ catch (err) {
35
+ span.setStatus({
36
+ code: SpanStatusCode.ERROR,
37
+ message: err.message
38
+ });
39
+ throw err;
40
+ }
41
+ finally {
42
+ span.end();
43
+ }
47
44
  }
48
45
  //# sourceMappingURL=tracing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/util/tracing.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;IAC3C,aAAa,EAAE,gBAAgB;IAC/B,SAAS,EAAE,eAAe;CAC3B,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAgB,KAAK,CACzB,aAAqB,EACrB,OAAyB,EACzB,EAA+D,EAC/D,YAAY,GAAG,UAAU;;QAEzB,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAEtE,IAAI;YACF,6GAA6G;YAC7G,kBAAkB;YAClB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;YAE9C,oEAAoE;YACpE,IAAI,CAAC,SAAS,CAAC;gBACb,IAAI,EAAE,cAAc,CAAC,EAAE;aACxB,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;SACf;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,SAAS,CAAC;gBACb,IAAI,EAAE,cAAc,CAAC,KAAK;gBAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;aACrB,CAAC,CAAC;YACH,MAAM,GAAG,CAAC;SACX;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;CAAA","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { OperationOptions } from \"@azure/core-http\";\nimport { createSpanFunction, SpanStatusCode, Span } from \"@azure/core-tracing\";\n\n/**\n * Creates a span using the global tracer.\n * @internal\n */\nexport const createSpan = createSpanFunction({\n packagePrefix: \"Azure.Identity\",\n namespace: \"Microsoft.AAD\"\n});\n\n/**\n * From: https://github.com/Azure/azure-sdk-for-js/blob/46139daa3317a0d12e8b55b02b9d9cdf1b2e762a/sdk/appconfiguration/app-configuration/src/internal/tracingHelpers.ts\n * Traces an operation and properly handles reporting start, end and errors for a given span\n *\n * @param operationName - Name of a method in the TClient type\n * @param options - An options class, typically derived from \\@azure/core-http/RequestOptionsBase\n * @param fn - The function to call with an options class that properly propagates the span context\n *\n * @internal\n */\nexport async function trace<ReturnT>(\n operationName: string,\n options: OperationOptions,\n fn: (options: OperationOptions, span: Span) => Promise<ReturnT>,\n createSpanFn = createSpan\n): Promise<ReturnT> {\n const { updatedOptions, span } = createSpanFn(operationName, options);\n\n try {\n // NOTE: we really do need to await on this function here so we can handle any exceptions thrown and properly\n // close the span.\n const result = await fn(updatedOptions, span);\n\n // otel 0.16+ needs this or else the code ends up being set as UNSET\n span.setStatus({\n code: SpanStatusCode.OK\n });\n return result;\n } catch (err) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message\n });\n throw err;\n } finally {\n span.end();\n }\n}\n"]}
1
+ {"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/util/tracing.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAG/E;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;IAC3C,aAAa,EAAE,EAAE;IACjB,SAAS,EAAE,eAAe;CAC3B,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,aAAqB,EACrB,OAAyB,EACzB,EAA+D,EAC/D,YAAY,GAAG,UAAU;IAEzB,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAEtE,IAAI;QACF,6GAA6G;QAC7G,kBAAkB;QAClB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QAE9C,oEAAoE;QACpE,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,cAAc,CAAC,EAAE;SACxB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;KACf;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,cAAc,CAAC,KAAK;YAC1B,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC,CAAC;QACH,MAAM,GAAG,CAAC;KACX;YAAS;QACR,IAAI,CAAC,GAAG,EAAE,CAAC;KACZ;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createSpanFunction, SpanStatusCode, Span } from \"@azure/core-tracing\";\nimport { OperationOptions } from \"@azure/core-client\";\n\n/**\n * Creates a span using the global tracer.\n * @internal\n */\nexport const createSpan = createSpanFunction({\n packagePrefix: \"\",\n namespace: \"Microsoft.AAD\"\n});\n\n/**\n * From: https://github.com/Azure/azure-sdk-for-js/blob/46139daa3317a0d12e8b55b02b9d9cdf1b2e762a/sdk/appconfiguration/app-configuration/src/internal/tracingHelpers.ts\n * Traces an operation and properly handles reporting start, end and errors for a given span\n *\n * @param operationName - Name of a method in the TClient type\n * @param options - An options class, typically derived from \\@azure/core-rest-pipeline/RequestOptionsBase\n * @param fn - The function to call with an options class that properly propagates the span context\n *\n * @internal\n */\nexport async function trace<ReturnT>(\n operationName: string,\n options: OperationOptions,\n fn: (options: OperationOptions, span: Span) => Promise<ReturnT>,\n createSpanFn = createSpan\n): Promise<ReturnT> {\n const { updatedOptions, span } = createSpanFn(operationName, options);\n\n try {\n // NOTE: we really do need to await on this function here so we can handle any exceptions thrown and properly\n // close the span.\n const result = await fn(updatedOptions, span);\n\n // otel 0.16+ needs this or else the code ends up being set as UNSET\n span.setStatus({\n code: SpanStatusCode.OK\n });\n return result;\n } catch (err) {\n span.setStatus({\n code: SpanStatusCode.ERROR,\n message: err.message\n });\n throw err;\n } finally {\n span.end();\n }\n}\n"]}
@@ -0,0 +1,22 @@
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
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,29 @@
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
@@ -0,0 +1 @@
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"]}
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@azure/identity",
3
3
  "sdk-type": "client",
4
- "version": "2.0.0-beta.3",
4
+ "version": "2.0.0",
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",
8
8
  "types": "./types/identity.d.ts",
9
9
  "browser": {
10
+ "os": false,
11
+ "process": false,
10
12
  "./dist-esm/src/credentials/azureCliCredential.js": "./dist-esm/src/credentials/azureCliCredential.browser.js",
11
13
  "./dist-esm/src/credentials/environmentCredential.js": "./dist-esm/src/credentials/environmentCredential.browser.js",
12
14
  "./dist-esm/src/credentials/managedIdentityCredential/index.js": "./dist-esm/src/credentials/managedIdentityCredential/index.browser.js",
@@ -19,31 +21,36 @@
19
21
  "./dist-esm/src/credentials/visualStudioCodeCredential.js": "./dist-esm/src/credentials/visualStudioCodeCredential.browser.js",
20
22
  "./dist-esm/src/credentials/usernamePasswordCredential.js": "./dist-esm/src/credentials/usernamePasswordCredential.browser.js",
21
23
  "./dist-esm/src/credentials/azurePowerShellCredential.js": "./dist-esm/src/credentials/azurePowerShellCredential.browser.js",
24
+ "./dist-esm/src/credentials/azureApplicationCredential.js": "./dist-esm/src/credentials/azureApplicationCredential.browser.js",
25
+ "./dist-esm/src/credentials/onBehalfOfCredential.js": "./dist-esm/src/credentials/onBehalfOfCredential.browser.js",
22
26
  "./dist-esm/src/util/authHostEnv.js": "./dist-esm/src/util/authHostEnv.browser.js",
23
- "./dist-esm/src/tokenCache/TokenCachePersistence.js": "./dist-esm/src/tokenCache/TokenCachePersistence.browser.js"
27
+ "./dist-esm/src/util/validateMultiTenant.js": "./dist-esm/src/util/validateMultiTenant.browser.js",
28
+ "./dist-esm/src/tokenCache/TokenCachePersistence.js": "./dist-esm/src/tokenCache/TokenCachePersistence.browser.js",
29
+ "./dist-esm/src/plugins/consumer.js": "./dist-esm/src/plugins/consumer.browser.js",
30
+ "./dist-esm/test/httpRequests.js": "./dist-esm/test/httpRequests.browser.js"
24
31
  },
25
32
  "scripts": {
26
33
  "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
27
34
  "build:samples": "echo skipped",
28
- "build:test": "tsc -p . && rollup -c rollup.config.js 2>&1",
29
- "build": "npm run extract-api && tsc -p . && rollup -c 2>&1",
35
+ "build:test": "tsc -p . && rollup -c 2>&1",
36
+ "build": "npm run clean && npm run extract-api && tsc -p . && rollup -c 2>&1",
30
37
  "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples/**/*.{js,json}\"",
31
- "clean": "rimraf dist dist-* typings *.tgz *.log",
38
+ "clean": "rimraf dist dist-* types *.tgz *.log",
32
39
  "execute:samples": "echo skipped",
33
40
  "extract-api": "tsc -p . && api-extractor run --local",
34
41
  "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\" \"samples/**/*.{js,json}\"",
35
42
  "integration-test:browser": "echo skipped",
36
- "integration-test:node": "echo skipped",
43
+ "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace \"dist-esm/test/public/node/*.spec.js\"",
37
44
  "integration-test": "npm run integration-test:node && npm run integration-test:browser",
38
45
  "lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
39
46
  "lint": "eslint package.json api-extractor.json src test --ext .ts",
40
47
  "pack": "npm pack 2>&1",
41
- "prebuild": "npm run clean",
42
48
  "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser",
43
49
  "test:node": "npm run clean && npm run build:test && npm run unit-test:node && npm run integration-test:node",
44
50
  "test": "npm run clean && npm run build:test && npm run unit-test && npm run integration-test",
45
51
  "unit-test:browser": "karma start --single-run",
46
- "unit-test:node": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 180000 --full-trace --exclude \"test/**/browser/**/*.spec.ts\" \"test/**/*.spec.ts\"",
52
+ "unit-test:node": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 300000 --full-trace --exclude \"test/**/browser/**/*.spec.ts\" \"test/**/*.spec.ts\"",
53
+ "unit-test:node:no-timeouts": "mocha -r esm -r ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --no-timeouts --full-trace --exclude \"test/**/browser/**/*.spec.ts\" \"test/**/*.spec.ts\"",
47
54
  "unit-test": "npm run unit-test:node && npm run unit-test:browser",
48
55
  "docs": "typedoc --excludePrivate --excludeNotExported --excludeExternals --stripInternal --mode file --out ./dist/docs ./src"
49
56
  },
@@ -54,8 +61,16 @@
54
61
  "README.md",
55
62
  "LICENSE"
56
63
  ],
64
+ "//metadata": {
65
+ "constantPaths": [
66
+ {
67
+ "path": "src/client/identityClient.ts",
68
+ "prefix": "packageDetails"
69
+ }
70
+ ]
71
+ },
57
72
  "engines": {
58
- "node": ">=8.0.0"
73
+ "node": ">=12.0.0"
59
74
  },
60
75
  "repository": "github:Azure/azure-sdk-for-js",
61
76
  "keywords": [
@@ -65,7 +80,7 @@
65
80
  "authentication",
66
81
  "credential",
67
82
  "certificate",
68
- "managed service identity",
83
+ "managed identity",
69
84
  "client secret",
70
85
  "access token"
71
86
  ],
@@ -74,38 +89,39 @@
74
89
  "bugs": {
75
90
  "url": "https://github.com/Azure/azure-sdk-for-js/issues"
76
91
  },
77
- "engine": {
78
- "node": ">=8.0.0"
79
- },
80
- "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity/README.md",
92
+ "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity/README.md",
81
93
  "sideEffects": false,
82
94
  "dependencies": {
83
- "@azure/core-http": "^1.2.0",
84
- "@azure/core-tracing": "1.0.0-preview.11",
95
+ "@azure/core-util": "^1.0.0-beta.1",
96
+ "@azure/core-tracing": "1.0.0-preview.13",
97
+ "@azure/core-auth": "^1.3.0",
98
+ "@azure/core-client": "^1.0.0",
99
+ "@azure/core-rest-pipeline": "^1.1.0",
85
100
  "@azure/logger": "^1.0.0",
86
101
  "@azure/abort-controller": "^1.0.0",
87
- "@azure/msal-common": "~4.0.1",
88
- "@azure/msal-node": "^1.0.2",
89
- "@azure/msal-browser": "2.9.0",
102
+ "@azure/msal-common": "^4.5.1",
103
+ "@azure/msal-node": "^1.3.0",
104
+ "@azure/msal-browser": "^2.16.0",
90
105
  "@types/stoppable": "^1.1.0",
91
106
  "events": "^3.0.0",
92
107
  "jws": "^4.0.0",
93
- "open": "^7.0.0",
94
- "qs": "^6.7.0",
108
+ "open": "^8.0.0",
95
109
  "stoppable": "^1.1.0",
96
- "tslib": "^2.0.0",
110
+ "tslib": "^2.2.0",
97
111
  "uuid": "^8.3.0"
98
112
  },
99
113
  "devDependencies": {
100
114
  "@azure/eslint-plugin-azure-sdk": "^3.0.0",
101
115
  "@azure/dev-tool": "^1.0.0",
102
- "@azure/test-utils-recorder": "^1.0.0",
103
- "@microsoft/api-extractor": "7.7.11",
116
+ "@azure/test-utils": "^1.0.0",
117
+ "@azure-tools/test-recorder": "^1.0.0",
118
+ "@microsoft/api-extractor": "^7.18.11",
104
119
  "@types/jws": "^3.2.2",
105
120
  "@types/mocha": "^7.0.2",
106
- "@types/node": "^8.0.0",
107
- "@types/qs": "^6.5.3",
121
+ "@types/node": "^12.0.0",
108
122
  "@types/uuid": "^8.0.0",
123
+ "@types/chai": "^4.1.6",
124
+ "chai": "^4.2.0",
109
125
  "assert": "^1.4.1",
110
126
  "cross-env": "^7.0.2",
111
127
  "dotenv": "^8.2.0",
@@ -121,15 +137,15 @@
121
137
  "karma-sourcemap-loader": "^0.3.8",
122
138
  "mocha": "^7.1.1",
123
139
  "mocha-junit-reporter": "^1.18.0",
140
+ "nyc": "^14.0.0",
124
141
  "prettier": "^1.16.4",
125
- "puppeteer": "^3.3.0",
142
+ "puppeteer": "^10.2.0",
126
143
  "rimraf": "^3.0.0",
127
144
  "rollup": "^1.16.3",
128
145
  "typescript": "~4.2.0",
129
146
  "util": "^0.12.1",
130
147
  "sinon": "^9.0.2",
131
148
  "@types/sinon": "^9.0.4",
132
- "mock-fs": "^4.10.4",
133
149
  "typedoc": "0.15.2"
134
150
  }
135
151
  }