@azure/msal-common 15.13.3 → 16.0.0-beta.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.
Files changed (453) hide show
  1. package/dist/account/AccountInfo.d.ts +0 -1
  2. package/dist/account/AccountInfo.d.ts.map +1 -1
  3. package/dist/account/AccountInfo.mjs +1 -1
  4. package/dist/account/AccountInfo.mjs.map +1 -1
  5. package/dist/account/AuthToken.d.ts.map +1 -1
  6. package/dist/account/AuthToken.mjs +2 -3
  7. package/dist/account/AuthToken.mjs.map +1 -1
  8. package/dist/account/CcsCredential.mjs +1 -1
  9. package/dist/account/ClientInfo.d.ts.map +1 -1
  10. package/dist/account/ClientInfo.mjs +4 -6
  11. package/dist/account/ClientInfo.mjs.map +1 -1
  12. package/dist/account/TokenClaims.mjs +1 -1
  13. package/dist/authority/Authority.d.ts +2 -2
  14. package/dist/authority/Authority.d.ts.map +1 -1
  15. package/dist/authority/Authority.mjs +89 -105
  16. package/dist/authority/Authority.mjs.map +1 -1
  17. package/dist/authority/AuthorityFactory.d.ts +6 -2
  18. package/dist/authority/AuthorityFactory.d.ts.map +1 -1
  19. package/dist/authority/AuthorityFactory.mjs +8 -5
  20. package/dist/authority/AuthorityFactory.mjs.map +1 -1
  21. package/dist/authority/AuthorityMetadata.d.ts +2 -2
  22. package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
  23. package/dist/authority/AuthorityMetadata.mjs +34 -31
  24. package/dist/authority/AuthorityMetadata.mjs.map +1 -1
  25. package/dist/authority/AuthorityOptions.d.ts +0 -1
  26. package/dist/authority/AuthorityOptions.d.ts.map +1 -1
  27. package/dist/authority/AuthorityOptions.mjs +1 -1
  28. package/dist/authority/AuthorityOptions.mjs.map +1 -1
  29. package/dist/authority/AuthorityType.mjs +1 -1
  30. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  31. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  32. package/dist/authority/OIDCOptions.d.ts +2 -2
  33. package/dist/authority/OIDCOptions.d.ts.map +1 -1
  34. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  35. package/dist/authority/ProtocolMode.mjs +1 -1
  36. package/dist/authority/RegionDiscovery.d.ts +3 -3
  37. package/dist/authority/RegionDiscovery.d.ts.map +1 -1
  38. package/dist/authority/RegionDiscovery.mjs +14 -15
  39. package/dist/authority/RegionDiscovery.mjs.map +1 -1
  40. package/dist/cache/CacheManager.d.ts +26 -19
  41. package/dist/cache/CacheManager.d.ts.map +1 -1
  42. package/dist/cache/CacheManager.mjs +70 -83
  43. package/dist/cache/CacheManager.mjs.map +1 -1
  44. package/dist/cache/entities/AccessTokenEntity.d.ts +0 -4
  45. package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
  46. package/dist/cache/entities/AccountEntity.d.ts +4 -56
  47. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  48. package/dist/cache/entities/CredentialEntity.d.ts +0 -2
  49. package/dist/cache/entities/CredentialEntity.d.ts.map +1 -1
  50. package/dist/cache/interface/ICacheManager.d.ts +35 -17
  51. package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
  52. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  53. package/dist/cache/utils/AccountEntityUtils.d.ts +53 -0
  54. package/dist/cache/utils/AccountEntityUtils.d.ts.map +1 -0
  55. package/dist/cache/utils/AccountEntityUtils.mjs +192 -0
  56. package/dist/cache/utils/AccountEntityUtils.mjs.map +1 -0
  57. package/dist/cache/utils/CacheHelpers.d.ts +2 -2
  58. package/dist/cache/utils/CacheHelpers.d.ts.map +1 -1
  59. package/dist/cache/utils/CacheHelpers.mjs +10 -13
  60. package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
  61. package/dist/cache/utils/CacheTypes.d.ts +0 -1
  62. package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
  63. package/dist/client/AuthorizationCodeClient.d.ts +23 -4
  64. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  65. package/dist/client/AuthorizationCodeClient.mjs +63 -35
  66. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  67. package/dist/client/RefreshTokenClient.d.ts +17 -4
  68. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  69. package/dist/client/RefreshTokenClient.mjs +51 -37
  70. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  71. package/dist/client/SilentFlowClient.d.ts +17 -4
  72. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  73. package/dist/client/SilentFlowClient.mjs +28 -15
  74. package/dist/client/SilentFlowClient.mjs.map +1 -1
  75. package/dist/config/ClientConfiguration.d.ts +2 -22
  76. package/dist/config/ClientConfiguration.d.ts.map +1 -1
  77. package/dist/config/ClientConfiguration.mjs +9 -15
  78. package/dist/config/ClientConfiguration.mjs.map +1 -1
  79. package/dist/constants/AADServerParamKeys.mjs +1 -1
  80. package/dist/crypto/ICrypto.d.ts +5 -3
  81. package/dist/crypto/ICrypto.d.ts.map +1 -1
  82. package/dist/crypto/ICrypto.mjs +1 -1
  83. package/dist/crypto/ICrypto.mjs.map +1 -1
  84. package/dist/crypto/JoseHeader.mjs +1 -1
  85. package/dist/crypto/PopTokenGenerator.d.ts +2 -2
  86. package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
  87. package/dist/crypto/PopTokenGenerator.mjs +3 -5
  88. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  89. package/dist/error/AuthError.d.ts +1 -18
  90. package/dist/error/AuthError.d.ts.map +1 -1
  91. package/dist/error/AuthError.mjs +12 -34
  92. package/dist/error/AuthError.mjs.map +1 -1
  93. package/dist/error/AuthErrorCodes.mjs +1 -1
  94. package/dist/error/CacheError.d.ts +1 -6
  95. package/dist/error/CacheError.d.ts.map +1 -1
  96. package/dist/error/CacheError.mjs +6 -13
  97. package/dist/error/CacheError.mjs.map +1 -1
  98. package/dist/error/CacheErrorCodes.mjs +1 -1
  99. package/dist/error/ClientAuthError.d.ts +0 -229
  100. package/dist/error/ClientAuthError.d.ts.map +1 -1
  101. package/dist/error/ClientAuthError.mjs +3 -240
  102. package/dist/error/ClientAuthError.mjs.map +1 -1
  103. package/dist/error/ClientAuthErrorCodes.d.ts +0 -8
  104. package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -1
  105. package/dist/error/ClientAuthErrorCodes.mjs +2 -10
  106. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
  107. package/dist/error/ClientConfigurationError.d.ts +0 -128
  108. package/dist/error/ClientConfigurationError.d.ts.map +1 -1
  109. package/dist/error/ClientConfigurationError.mjs +3 -134
  110. package/dist/error/ClientConfigurationError.mjs.map +1 -1
  111. package/dist/error/ClientConfigurationErrorCodes.d.ts +0 -2
  112. package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
  113. package/dist/error/ClientConfigurationErrorCodes.mjs +3 -5
  114. package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -1
  115. package/dist/error/InteractionRequiredAuthError.d.ts +1 -19
  116. package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
  117. package/dist/error/InteractionRequiredAuthError.mjs +10 -35
  118. package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
  119. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  120. package/dist/error/JoseHeaderError.d.ts +0 -4
  121. package/dist/error/JoseHeaderError.d.ts.map +1 -1
  122. package/dist/error/JoseHeaderError.mjs +3 -8
  123. package/dist/error/JoseHeaderError.mjs.map +1 -1
  124. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  125. package/dist/error/NetworkError.mjs +1 -1
  126. package/dist/error/PlatformBrokerError.d.ts.map +1 -1
  127. package/dist/error/PlatformBrokerError.mjs +3 -2
  128. package/dist/error/PlatformBrokerError.mjs.map +1 -1
  129. package/dist/error/ServerError.mjs +1 -1
  130. package/dist/exports-browser-only.d.ts +4 -3
  131. package/dist/exports-browser-only.d.ts.map +1 -1
  132. package/dist/exports-common.d.ts +11 -8
  133. package/dist/exports-common.d.ts.map +1 -1
  134. package/dist/exports-node-only.d.ts +2 -4
  135. package/dist/exports-node-only.d.ts.map +1 -1
  136. package/dist/index-node.mjs +15 -10
  137. package/dist/index-node.mjs.map +1 -1
  138. package/dist/index.mjs +17 -11
  139. package/dist/index.mjs.map +1 -1
  140. package/dist/logger/Logger.d.ts +36 -13
  141. package/dist/logger/Logger.d.ts.map +1 -1
  142. package/dist/logger/Logger.mjs +105 -22
  143. package/dist/logger/Logger.mjs.map +1 -1
  144. package/dist/network/INetworkModule.mjs +1 -1
  145. package/dist/network/RequestThumbprint.mjs +2 -2
  146. package/dist/network/RequestThumbprint.mjs.map +1 -1
  147. package/dist/network/ThrottlingUtils.d.ts.map +1 -1
  148. package/dist/network/ThrottlingUtils.mjs +6 -7
  149. package/dist/network/ThrottlingUtils.mjs.map +1 -1
  150. package/dist/packageMetadata.d.ts +1 -1
  151. package/dist/packageMetadata.d.ts.map +1 -1
  152. package/dist/packageMetadata.mjs +2 -2
  153. package/dist/protocol/Authorize.d.ts +1 -2
  154. package/dist/protocol/Authorize.d.ts.map +1 -1
  155. package/dist/protocol/Authorize.mjs +14 -14
  156. package/dist/protocol/Authorize.mjs.map +1 -1
  157. package/dist/protocol/Token.d.ts +40 -0
  158. package/dist/protocol/Token.d.ts.map +1 -0
  159. package/dist/protocol/Token.mjs +129 -0
  160. package/dist/protocol/Token.mjs.map +1 -0
  161. package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -1
  162. package/dist/request/AuthenticationHeaderParser.mjs +3 -3
  163. package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
  164. package/dist/request/BaseAuthRequest.d.ts +4 -8
  165. package/dist/request/BaseAuthRequest.d.ts.map +1 -1
  166. package/dist/request/CommonAuthorizationCodeRequest.d.ts +2 -1
  167. package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
  168. package/dist/request/CommonAuthorizationUrlRequest.d.ts +2 -4
  169. package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
  170. package/dist/request/CommonRefreshTokenRequest.d.ts +2 -1
  171. package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
  172. package/dist/request/CommonSilentFlowRequest.d.ts +2 -1
  173. package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
  174. package/dist/request/RequestParameterBuilder.d.ts +6 -12
  175. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  176. package/dist/request/RequestParameterBuilder.mjs +11 -24
  177. package/dist/request/RequestParameterBuilder.mjs.map +1 -1
  178. package/dist/request/ScopeSet.mjs +5 -5
  179. package/dist/request/ScopeSet.mjs.map +1 -1
  180. package/dist/response/AuthenticationResult.d.ts +1 -1
  181. package/dist/response/AuthenticationResult.d.ts.map +1 -1
  182. package/dist/response/ResponseHandler.d.ts +7 -6
  183. package/dist/response/ResponseHandler.d.ts.map +1 -1
  184. package/dist/response/ResponseHandler.mjs +41 -43
  185. package/dist/response/ResponseHandler.mjs.map +1 -1
  186. package/dist/telemetry/performance/IPerformanceClient.d.ts +0 -29
  187. package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  188. package/dist/telemetry/performance/PerformanceClient.d.ts +5 -81
  189. package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  190. package/dist/telemetry/performance/PerformanceClient.mjs +24 -170
  191. package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
  192. package/dist/telemetry/performance/PerformanceEvent.d.ts +1 -280
  193. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  194. package/dist/telemetry/performance/PerformanceEvent.mjs +2 -483
  195. package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
  196. package/dist/telemetry/performance/PerformanceEvents.d.ts +66 -0
  197. package/dist/telemetry/performance/PerformanceEvents.d.ts.map +1 -0
  198. package/dist/telemetry/performance/PerformanceEvents.mjs +74 -0
  199. package/dist/telemetry/performance/PerformanceEvents.mjs.map +1 -0
  200. package/dist/telemetry/performance/StubPerformanceClient.d.ts +0 -4
  201. package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
  202. package/dist/telemetry/performance/StubPerformanceClient.mjs +2 -26
  203. package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
  204. package/dist/telemetry/server/ServerTelemetryManager.d.ts +2 -2
  205. package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
  206. package/dist/telemetry/server/ServerTelemetryManager.mjs +28 -30
  207. package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
  208. package/dist/url/UrlString.d.ts +0 -5
  209. package/dist/url/UrlString.d.ts.map +1 -1
  210. package/dist/url/UrlString.mjs +5 -13
  211. package/dist/url/UrlString.mjs.map +1 -1
  212. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  213. package/dist/utils/Constants.d.ts +81 -112
  214. package/dist/utils/Constants.d.ts.map +1 -1
  215. package/dist/utils/Constants.mjs +100 -127
  216. package/dist/utils/Constants.mjs.map +1 -1
  217. package/dist/utils/FunctionWrappers.d.ts +2 -2
  218. package/dist/utils/FunctionWrappers.d.ts.map +1 -1
  219. package/dist/utils/FunctionWrappers.mjs +19 -20
  220. package/dist/utils/FunctionWrappers.mjs.map +1 -1
  221. package/dist/utils/ProtocolUtils.d.ts +14 -35
  222. package/dist/utils/ProtocolUtils.d.ts.map +1 -1
  223. package/dist/utils/ProtocolUtils.mjs +57 -61
  224. package/dist/utils/ProtocolUtils.mjs.map +1 -1
  225. package/dist/utils/StateTypes.d.ts +15 -0
  226. package/dist/utils/StateTypes.d.ts.map +1 -0
  227. package/dist/utils/StringUtils.mjs +1 -1
  228. package/dist/utils/TimeUtils.mjs +1 -1
  229. package/dist/utils/UrlUtils.d.ts +1 -2
  230. package/dist/utils/UrlUtils.d.ts.map +1 -1
  231. package/dist/utils/UrlUtils.mjs +3 -10
  232. package/dist/utils/UrlUtils.mjs.map +1 -1
  233. package/lib/index-browser.cjs +26 -206
  234. package/lib/index-browser.cjs.map +1 -1
  235. package/lib/{index-node-4Jss3kYh.js → index-node-B7mR4APO.js} +3494 -4270
  236. package/lib/index-node-B7mR4APO.js.map +1 -0
  237. package/lib/index-node.cjs +6 -34
  238. package/lib/index-node.cjs.map +1 -1
  239. package/lib/index.cjs +5 -34
  240. package/lib/index.cjs.map +1 -1
  241. package/lib/types/account/AccountInfo.d.ts +0 -1
  242. package/lib/types/account/AccountInfo.d.ts.map +1 -1
  243. package/lib/types/account/AuthToken.d.ts.map +1 -1
  244. package/lib/types/account/ClientInfo.d.ts.map +1 -1
  245. package/lib/types/authority/Authority.d.ts +2 -2
  246. package/lib/types/authority/Authority.d.ts.map +1 -1
  247. package/lib/types/authority/AuthorityFactory.d.ts +6 -2
  248. package/lib/types/authority/AuthorityFactory.d.ts.map +1 -1
  249. package/lib/types/authority/AuthorityMetadata.d.ts +2 -2
  250. package/lib/types/authority/AuthorityMetadata.d.ts.map +1 -1
  251. package/lib/types/authority/AuthorityOptions.d.ts +0 -1
  252. package/lib/types/authority/AuthorityOptions.d.ts.map +1 -1
  253. package/lib/types/authority/OIDCOptions.d.ts +2 -2
  254. package/lib/types/authority/OIDCOptions.d.ts.map +1 -1
  255. package/lib/types/authority/RegionDiscovery.d.ts +3 -3
  256. package/lib/types/authority/RegionDiscovery.d.ts.map +1 -1
  257. package/lib/types/cache/CacheManager.d.ts +26 -19
  258. package/lib/types/cache/CacheManager.d.ts.map +1 -1
  259. package/lib/types/cache/entities/AccessTokenEntity.d.ts +0 -4
  260. package/lib/types/cache/entities/AccessTokenEntity.d.ts.map +1 -1
  261. package/lib/types/cache/entities/AccountEntity.d.ts +4 -56
  262. package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
  263. package/lib/types/cache/entities/CredentialEntity.d.ts +0 -2
  264. package/lib/types/cache/entities/CredentialEntity.d.ts.map +1 -1
  265. package/lib/types/cache/interface/ICacheManager.d.ts +35 -17
  266. package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
  267. package/lib/types/cache/utils/AccountEntityUtils.d.ts +53 -0
  268. package/lib/types/cache/utils/AccountEntityUtils.d.ts.map +1 -0
  269. package/lib/types/cache/utils/CacheHelpers.d.ts +2 -2
  270. package/lib/types/cache/utils/CacheHelpers.d.ts.map +1 -1
  271. package/lib/types/cache/utils/CacheTypes.d.ts +0 -1
  272. package/lib/types/cache/utils/CacheTypes.d.ts.map +1 -1
  273. package/lib/types/client/AuthorizationCodeClient.d.ts +23 -4
  274. package/lib/types/client/AuthorizationCodeClient.d.ts.map +1 -1
  275. package/lib/types/client/RefreshTokenClient.d.ts +17 -4
  276. package/lib/types/client/RefreshTokenClient.d.ts.map +1 -1
  277. package/lib/types/client/SilentFlowClient.d.ts +17 -4
  278. package/lib/types/client/SilentFlowClient.d.ts.map +1 -1
  279. package/lib/types/config/ClientConfiguration.d.ts +2 -22
  280. package/lib/types/config/ClientConfiguration.d.ts.map +1 -1
  281. package/lib/types/crypto/ICrypto.d.ts +5 -3
  282. package/lib/types/crypto/ICrypto.d.ts.map +1 -1
  283. package/lib/types/crypto/PopTokenGenerator.d.ts +2 -2
  284. package/lib/types/crypto/PopTokenGenerator.d.ts.map +1 -1
  285. package/lib/types/error/AuthError.d.ts +1 -18
  286. package/lib/types/error/AuthError.d.ts.map +1 -1
  287. package/lib/types/error/CacheError.d.ts +1 -6
  288. package/lib/types/error/CacheError.d.ts.map +1 -1
  289. package/lib/types/error/ClientAuthError.d.ts +0 -229
  290. package/lib/types/error/ClientAuthError.d.ts.map +1 -1
  291. package/lib/types/error/ClientAuthErrorCodes.d.ts +0 -8
  292. package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
  293. package/lib/types/error/ClientConfigurationError.d.ts +0 -128
  294. package/lib/types/error/ClientConfigurationError.d.ts.map +1 -1
  295. package/lib/types/error/ClientConfigurationErrorCodes.d.ts +0 -2
  296. package/lib/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
  297. package/lib/types/error/InteractionRequiredAuthError.d.ts +1 -19
  298. package/lib/types/error/InteractionRequiredAuthError.d.ts.map +1 -1
  299. package/lib/types/error/JoseHeaderError.d.ts +0 -4
  300. package/lib/types/error/JoseHeaderError.d.ts.map +1 -1
  301. package/lib/types/error/PlatformBrokerError.d.ts.map +1 -1
  302. package/lib/types/exports-browser-only.d.ts +4 -3
  303. package/lib/types/exports-browser-only.d.ts.map +1 -1
  304. package/lib/types/exports-common.d.ts +11 -8
  305. package/lib/types/exports-common.d.ts.map +1 -1
  306. package/lib/types/exports-node-only.d.ts +2 -4
  307. package/lib/types/exports-node-only.d.ts.map +1 -1
  308. package/lib/types/logger/Logger.d.ts +36 -13
  309. package/lib/types/logger/Logger.d.ts.map +1 -1
  310. package/lib/types/network/ThrottlingUtils.d.ts.map +1 -1
  311. package/lib/types/packageMetadata.d.ts +1 -1
  312. package/lib/types/packageMetadata.d.ts.map +1 -1
  313. package/lib/types/protocol/Authorize.d.ts +1 -2
  314. package/lib/types/protocol/Authorize.d.ts.map +1 -1
  315. package/lib/types/protocol/Token.d.ts +40 -0
  316. package/lib/types/protocol/Token.d.ts.map +1 -0
  317. package/lib/types/request/AuthenticationHeaderParser.d.ts.map +1 -1
  318. package/lib/types/request/BaseAuthRequest.d.ts +4 -8
  319. package/lib/types/request/BaseAuthRequest.d.ts.map +1 -1
  320. package/lib/types/request/CommonAuthorizationCodeRequest.d.ts +2 -1
  321. package/lib/types/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
  322. package/lib/types/request/CommonAuthorizationUrlRequest.d.ts +2 -4
  323. package/lib/types/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
  324. package/lib/types/request/CommonRefreshTokenRequest.d.ts +2 -1
  325. package/lib/types/request/CommonRefreshTokenRequest.d.ts.map +1 -1
  326. package/lib/types/request/CommonSilentFlowRequest.d.ts +2 -1
  327. package/lib/types/request/CommonSilentFlowRequest.d.ts.map +1 -1
  328. package/lib/types/request/RequestParameterBuilder.d.ts +6 -12
  329. package/lib/types/request/RequestParameterBuilder.d.ts.map +1 -1
  330. package/lib/types/response/AuthenticationResult.d.ts +1 -1
  331. package/lib/types/response/AuthenticationResult.d.ts.map +1 -1
  332. package/lib/types/response/ResponseHandler.d.ts +7 -6
  333. package/lib/types/response/ResponseHandler.d.ts.map +1 -1
  334. package/lib/types/telemetry/performance/IPerformanceClient.d.ts +0 -29
  335. package/lib/types/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  336. package/lib/types/telemetry/performance/PerformanceClient.d.ts +5 -81
  337. package/lib/types/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  338. package/lib/types/telemetry/performance/PerformanceEvent.d.ts +1 -280
  339. package/lib/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  340. package/lib/types/telemetry/performance/PerformanceEvents.d.ts +66 -0
  341. package/lib/types/telemetry/performance/PerformanceEvents.d.ts.map +1 -0
  342. package/lib/types/telemetry/performance/StubPerformanceClient.d.ts +0 -4
  343. package/lib/types/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
  344. package/lib/types/telemetry/server/ServerTelemetryManager.d.ts +2 -2
  345. package/lib/types/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
  346. package/lib/types/url/UrlString.d.ts +0 -5
  347. package/lib/types/url/UrlString.d.ts.map +1 -1
  348. package/lib/types/utils/Constants.d.ts +81 -112
  349. package/lib/types/utils/Constants.d.ts.map +1 -1
  350. package/lib/types/utils/FunctionWrappers.d.ts +2 -2
  351. package/lib/types/utils/FunctionWrappers.d.ts.map +1 -1
  352. package/lib/types/utils/ProtocolUtils.d.ts +14 -35
  353. package/lib/types/utils/ProtocolUtils.d.ts.map +1 -1
  354. package/lib/types/utils/StateTypes.d.ts +15 -0
  355. package/lib/types/utils/StateTypes.d.ts.map +1 -0
  356. package/lib/types/utils/UrlUtils.d.ts +1 -2
  357. package/lib/types/utils/UrlUtils.d.ts.map +1 -1
  358. package/package.json +7 -7
  359. package/src/account/AccountInfo.ts +0 -1
  360. package/src/account/AuthToken.ts +1 -2
  361. package/src/account/ClientInfo.ts +3 -6
  362. package/src/authority/Authority.ts +145 -146
  363. package/src/authority/AuthorityFactory.ts +7 -7
  364. package/src/authority/AuthorityMetadata.ts +54 -47
  365. package/src/authority/AuthorityOptions.ts +0 -1
  366. package/src/authority/OIDCOptions.ts +2 -2
  367. package/src/authority/RegionDiscovery.ts +20 -33
  368. package/src/cache/CacheManager.ts +177 -128
  369. package/src/cache/entities/AccessTokenEntity.ts +0 -4
  370. package/src/cache/entities/AccountEntity.ts +4 -292
  371. package/src/cache/entities/CredentialEntity.ts +0 -2
  372. package/src/cache/interface/ICacheManager.ts +55 -20
  373. package/src/cache/utils/AccountEntityUtils.ts +258 -0
  374. package/src/cache/utils/CacheHelpers.ts +23 -37
  375. package/src/cache/utils/CacheTypes.ts +0 -1
  376. package/src/client/AuthorizationCodeClient.ts +146 -58
  377. package/src/client/RefreshTokenClient.ts +108 -65
  378. package/src/client/SilentFlowClient.ts +74 -25
  379. package/src/config/ClientConfiguration.ts +9 -37
  380. package/src/crypto/ICrypto.ts +5 -3
  381. package/src/crypto/PopTokenGenerator.ts +3 -13
  382. package/src/error/AuthError.ts +11 -30
  383. package/src/error/CacheError.ts +4 -15
  384. package/src/error/ClientAuthError.ts +1 -317
  385. package/src/error/ClientAuthErrorCodes.ts +0 -8
  386. package/src/error/ClientConfigurationError.ts +1 -202
  387. package/src/error/ClientConfigurationErrorCodes.ts +0 -4
  388. package/src/error/InteractionRequiredAuthError.ts +8 -48
  389. package/src/error/JoseHeaderError.ts +1 -8
  390. package/src/error/PlatformBrokerError.ts +2 -1
  391. package/src/exports-browser-only.ts +2 -6
  392. package/src/exports-common.ts +8 -40
  393. package/src/exports-node-only.ts +5 -4
  394. package/src/logger/Logger.ts +174 -39
  395. package/src/network/RequestThumbprint.ts +1 -1
  396. package/src/network/ThrottlingUtils.ts +12 -15
  397. package/src/packageMetadata.ts +1 -1
  398. package/src/protocol/Authorize.ts +24 -20
  399. package/src/protocol/Token.ts +230 -0
  400. package/src/request/AuthenticationHeaderParser.ts +2 -4
  401. package/src/request/BaseAuthRequest.ts +4 -8
  402. package/src/request/CommonAuthorizationCodeRequest.ts +2 -1
  403. package/src/request/CommonAuthorizationUrlRequest.ts +2 -4
  404. package/src/request/CommonRefreshTokenRequest.ts +2 -1
  405. package/src/request/CommonSilentFlowRequest.ts +2 -1
  406. package/src/request/RequestParameterBuilder.ts +35 -50
  407. package/src/request/ScopeSet.ts +4 -4
  408. package/src/response/AuthenticationResult.ts +1 -1
  409. package/src/response/ResponseHandler.ts +56 -60
  410. package/src/telemetry/performance/IPerformanceClient.ts +0 -40
  411. package/src/telemetry/performance/PerformanceClient.ts +26 -295
  412. package/src/telemetry/performance/PerformanceEvent.ts +3 -582
  413. package/src/telemetry/performance/PerformanceEvents.ts +98 -0
  414. package/src/telemetry/performance/StubPerformanceClient.ts +0 -16
  415. package/src/telemetry/server/ServerTelemetryManager.ts +33 -44
  416. package/src/url/UrlString.ts +3 -12
  417. package/src/utils/Constants.ts +103 -140
  418. package/src/utils/FunctionWrappers.ts +28 -29
  419. package/src/utils/ProtocolUtils.ts +67 -93
  420. package/src/utils/StateTypes.ts +20 -0
  421. package/src/utils/UrlUtils.ts +2 -15
  422. package/dist/cache/entities/AccountEntity.mjs +0 -232
  423. package/dist/cache/entities/AccountEntity.mjs.map +0 -1
  424. package/dist/client/BaseClient.d.ts +0 -59
  425. package/dist/client/BaseClient.d.ts.map +0 -1
  426. package/dist/client/BaseClient.mjs +0 -167
  427. package/dist/client/BaseClient.mjs.map +0 -1
  428. package/dist/index-browser.mjs +0 -72
  429. package/dist/index-browser.mjs.map +0 -1
  430. package/dist/request/CommonClientCredentialRequest.d.ts +0 -18
  431. package/dist/request/CommonClientCredentialRequest.d.ts.map +0 -1
  432. package/dist/request/CommonDeviceCodeRequest.d.ts +0 -22
  433. package/dist/request/CommonDeviceCodeRequest.d.ts.map +0 -1
  434. package/dist/request/CommonOnBehalfOfRequest.d.ts +0 -14
  435. package/dist/request/CommonOnBehalfOfRequest.d.ts.map +0 -1
  436. package/dist/request/CommonUsernamePasswordRequest.d.ts +0 -18
  437. package/dist/request/CommonUsernamePasswordRequest.d.ts.map +0 -1
  438. package/lib/index-node-4Jss3kYh.js.map +0 -1
  439. package/lib/types/client/BaseClient.d.ts +0 -59
  440. package/lib/types/client/BaseClient.d.ts.map +0 -1
  441. package/lib/types/request/CommonClientCredentialRequest.d.ts +0 -18
  442. package/lib/types/request/CommonClientCredentialRequest.d.ts.map +0 -1
  443. package/lib/types/request/CommonDeviceCodeRequest.d.ts +0 -22
  444. package/lib/types/request/CommonDeviceCodeRequest.d.ts.map +0 -1
  445. package/lib/types/request/CommonOnBehalfOfRequest.d.ts +0 -14
  446. package/lib/types/request/CommonOnBehalfOfRequest.d.ts.map +0 -1
  447. package/lib/types/request/CommonUsernamePasswordRequest.d.ts +0 -18
  448. package/lib/types/request/CommonUsernamePasswordRequest.d.ts.map +0 -1
  449. package/src/client/BaseClient.ts +0 -320
  450. package/src/request/CommonClientCredentialRequest.ts +0 -23
  451. package/src/request/CommonDeviceCodeRequest.ts +0 -31
  452. package/src/request/CommonOnBehalfOfRequest.ts +0 -19
  453. package/src/request/CommonUsernamePasswordRequest.ts +0 -23
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Time spent sending/waiting for the response of a request to the token endpoint
8
+ */
9
+ export const NetworkClientSendPostRequestAsync =
10
+ "networkClientSendPostRequestAsync";
11
+ export const RefreshTokenClientExecutePostToTokenEndpoint =
12
+ "refreshTokenClientExecutePostToTokenEndpoint";
13
+ export const AuthorizationCodeClientExecutePostToTokenEndpoint =
14
+ "authorizationCodeClientExecutePostToTokenEndpoint";
15
+
16
+ /**
17
+ * Time spent on the network for refresh token acquisition
18
+ */
19
+ export const RefreshTokenClientExecuteTokenRequest =
20
+ "refreshTokenClientExecuteTokenRequest";
21
+
22
+ /**
23
+ * Time taken for acquiring refresh token , records RT size
24
+ */
25
+ export const RefreshTokenClientAcquireToken = "refreshTokenClientAcquireToken";
26
+
27
+ /**
28
+ * Time taken for acquiring cached refresh token
29
+ */
30
+ export const RefreshTokenClientAcquireTokenWithCachedRefreshToken =
31
+ "refreshTokenClientAcquireTokenWithCachedRefreshToken";
32
+
33
+ /**
34
+ * Helper function to create token request body in RefreshTokenClient (msal-common).
35
+ */
36
+ export const RefreshTokenClientCreateTokenRequestBody =
37
+ "refreshTokenClientCreateTokenRequestBody";
38
+
39
+ export const SilentFlowClientGenerateResultFromCacheRecord =
40
+ "silentFlowClientGenerateResultFromCacheRecord";
41
+
42
+ /**
43
+ * getAuthCodeUrl API (msal-browser and msal-node).
44
+ */
45
+ export const GetAuthCodeUrl = "getAuthCodeUrl";
46
+
47
+ /**
48
+ * Functions from InteractionHandler (msal-browser)
49
+ */
50
+ export const HandleCodeResponseFromServer = "handleCodeResponseFromServer";
51
+
52
+ /**
53
+ * APIs in Authorization Code Client (msal-common)
54
+ */
55
+ export const AuthClientExecuteTokenRequest = "authClientExecuteTokenRequest";
56
+ export const AuthClientCreateTokenRequestBody =
57
+ "authClientCreateTokenRequestBody";
58
+ export const UpdateTokenEndpointAuthority = "updateTokenEndpointAuthority";
59
+
60
+ /**
61
+ * Generate functions in PopTokenGenerator (msal-common)
62
+ */
63
+ export const PopTokenGenerateCnf = "popTokenGenerateCnf";
64
+
65
+ /**
66
+ * handleServerTokenResponse API in ResponseHandler (msal-common)
67
+ */
68
+ export const HandleServerTokenResponse = "handleServerTokenResponse";
69
+
70
+ /**
71
+ * Authority functions
72
+ */
73
+ export const AuthorityResolveEndpointsAsync = "authorityResolveEndpointsAsync";
74
+ export const AuthorityGetCloudDiscoveryMetadataFromNetwork =
75
+ "authorityGetCloudDiscoveryMetadataFromNetwork";
76
+ export const AuthorityUpdateCloudDiscoveryMetadata =
77
+ "authorityUpdateCloudDiscoveryMetadata";
78
+ export const AuthorityGetEndpointMetadataFromNetwork =
79
+ "authorityGetEndpointMetadataFromNetwork";
80
+ export const AuthorityUpdateEndpointMetadata =
81
+ "authorityUpdateEndpointMetadata";
82
+ export const AuthorityUpdateMetadataWithRegionalInformation =
83
+ "authorityUpdateMetadataWithRegionalInformation";
84
+
85
+ /**
86
+ * Region Discovery functions
87
+ */
88
+ export const RegionDiscoveryDetectRegion = "regionDiscoveryDetectRegion";
89
+ export const RegionDiscoveryGetRegionFromIMDS =
90
+ "regionDiscoveryGetRegionFromIMDS";
91
+ export const RegionDiscoveryGetCurrentVersion =
92
+ "regionDiscoveryGetCurrentVersion";
93
+
94
+ /**
95
+ * Cache operations
96
+ */
97
+ export const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
98
+ export const SetUserData = "setUserData";
@@ -50,25 +50,9 @@ export class StubPerformanceClient implements IPerformanceClient {
50
50
  startTimeMs: Date.now(),
51
51
  correlationId: correlationId || "",
52
52
  },
53
- measurement: new StubPerformanceMeasurement(),
54
53
  };
55
54
  }
56
55
 
57
- startPerformanceMeasurement(): IPerformanceMeasurement {
58
- return new StubPerformanceMeasurement();
59
- }
60
- calculateQueuedTime(): number {
61
- return 0;
62
- }
63
-
64
- addQueueMeasurement(): void {
65
- return;
66
- }
67
-
68
- setPreQueueTime(): void {
69
- return;
70
- }
71
-
72
56
  endMeasurement(): PerformanceEvent | null {
73
57
  return null;
74
58
  }
@@ -3,14 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- SERVER_TELEM_CONSTANTS,
8
- Separators,
9
- CacheOutcome,
10
- Constants,
11
- RegionDiscoverySources,
12
- RegionDiscoveryOutcomes,
13
- } from "../../utils/Constants.js";
6
+ import * as Constants from "../../utils/Constants.js";
14
7
  import { CacheManager } from "../../cache/CacheManager.js";
15
8
  import { AuthError } from "../../error/AuthError.js";
16
9
  import { ServerTelemetryRequest } from "./ServerTelemetryRequest.js";
@@ -89,9 +82,10 @@ export class ServerTelemetryManager {
89
82
  private wrapperSKU: String;
90
83
  private wrapperVer: String;
91
84
  private regionUsed: string | undefined;
92
- private regionSource: RegionDiscoverySources | undefined;
93
- private regionOutcome: RegionDiscoveryOutcomes | undefined;
94
- private cacheOutcome: CacheOutcome = CacheOutcome.NOT_APPLICABLE;
85
+ private regionSource: Constants.RegionDiscoverySources | undefined;
86
+ private regionOutcome: Constants.RegionDiscoveryOutcomes | undefined;
87
+ private cacheOutcome: Constants.CacheOutcome =
88
+ Constants.CacheOutcome.NOT_APPLICABLE;
95
89
 
96
90
  constructor(
97
91
  telemetryRequest: ServerTelemetryRequest,
@@ -100,12 +94,12 @@ export class ServerTelemetryManager {
100
94
  this.cacheManager = cacheManager;
101
95
  this.apiId = telemetryRequest.apiId;
102
96
  this.correlationId = telemetryRequest.correlationId;
103
- this.wrapperSKU = telemetryRequest.wrapperSKU || Constants.EMPTY_STRING;
104
- this.wrapperVer = telemetryRequest.wrapperVer || Constants.EMPTY_STRING;
97
+ this.wrapperSKU = telemetryRequest.wrapperSKU || "";
98
+ this.wrapperVer = telemetryRequest.wrapperVer || "";
105
99
 
106
100
  this.telemetryCacheKey =
107
- SERVER_TELEM_CONSTANTS.CACHE_KEY +
108
- Separators.CACHE_KEY_SEPARATOR +
101
+ Constants.SERVER_TELEM_CACHE_KEY +
102
+ Constants.CACHE_KEY_SEPARATOR +
109
103
  telemetryRequest.clientId;
110
104
  }
111
105
 
@@ -113,26 +107,26 @@ export class ServerTelemetryManager {
113
107
  * API to add MSER Telemetry to request
114
108
  */
115
109
  generateCurrentRequestHeaderValue(): string {
116
- const request = `${this.apiId}${SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR}${this.cacheOutcome}`;
110
+ const request = `${this.apiId}${Constants.SERVER_TELEM_VALUE_SEPARATOR}${this.cacheOutcome}`;
117
111
  const platformFieldsArr = [this.wrapperSKU, this.wrapperVer];
118
112
  const nativeBrokerErrorCode = this.getNativeBrokerErrorCode();
119
113
  if (nativeBrokerErrorCode?.length) {
120
114
  platformFieldsArr.push(`broker_error=${nativeBrokerErrorCode}`);
121
115
  }
122
116
  const platformFields = platformFieldsArr.join(
123
- SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR
117
+ Constants.SERVER_TELEM_VALUE_SEPARATOR
124
118
  );
125
119
  const regionDiscoveryFields = this.getRegionDiscoveryFields();
126
120
  const requestWithRegionDiscoveryFields = [
127
121
  request,
128
122
  regionDiscoveryFields,
129
- ].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);
123
+ ].join(Constants.SERVER_TELEM_VALUE_SEPARATOR);
130
124
 
131
125
  return [
132
- SERVER_TELEM_CONSTANTS.SCHEMA_VERSION,
126
+ Constants.SERVER_TELEM_SCHEMA_VERSION,
133
127
  requestWithRegionDiscoveryFields,
134
128
  platformFields,
135
- ].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);
129
+ ].join(Constants.SERVER_TELEM_CATEGORY_SEPARATOR);
136
130
  }
137
131
 
138
132
  /**
@@ -144,28 +138,28 @@ export class ServerTelemetryManager {
144
138
  const maxErrors = ServerTelemetryManager.maxErrorsToSend(lastRequests);
145
139
  const failedRequests = lastRequests.failedRequests
146
140
  .slice(0, 2 * maxErrors)
147
- .join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);
141
+ .join(Constants.SERVER_TELEM_VALUE_SEPARATOR);
148
142
  const errors = lastRequests.errors
149
143
  .slice(0, maxErrors)
150
- .join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);
144
+ .join(Constants.SERVER_TELEM_VALUE_SEPARATOR);
151
145
  const errorCount = lastRequests.errors.length;
152
146
 
153
147
  // Indicate whether this header contains all data or partial data
154
148
  const overflow =
155
149
  maxErrors < errorCount
156
- ? SERVER_TELEM_CONSTANTS.OVERFLOW_TRUE
157
- : SERVER_TELEM_CONSTANTS.OVERFLOW_FALSE;
150
+ ? Constants.SERVER_TELEM_OVERFLOW_TRUE
151
+ : Constants.SERVER_TELEM_OVERFLOW_FALSE;
158
152
  const platformFields = [errorCount, overflow].join(
159
- SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR
153
+ Constants.SERVER_TELEM_VALUE_SEPARATOR
160
154
  );
161
155
 
162
156
  return [
163
- SERVER_TELEM_CONSTANTS.SCHEMA_VERSION,
157
+ Constants.SERVER_TELEM_SCHEMA_VERSION,
164
158
  lastRequests.cacheHits,
165
159
  failedRequests,
166
160
  errors,
167
161
  platformFields,
168
- ].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);
162
+ ].join(Constants.SERVER_TELEM_CATEGORY_SEPARATOR);
169
163
  }
170
164
 
171
165
  /**
@@ -176,7 +170,7 @@ export class ServerTelemetryManager {
176
170
  const lastRequests = this.getLastRequests();
177
171
  if (
178
172
  lastRequests.errors.length >=
179
- SERVER_TELEM_CONSTANTS.MAX_CACHED_ERRORS
173
+ Constants.SERVER_TELEM_MAX_CACHED_ERRORS
180
174
  ) {
181
175
  // Remove a cached error to make room, first in first out
182
176
  lastRequests.failedRequests.shift(); // apiId
@@ -199,7 +193,7 @@ export class ServerTelemetryManager {
199
193
  lastRequests.errors.push(error.toString());
200
194
  }
201
195
  } else {
202
- lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);
196
+ lastRequests.errors.push(Constants.SERVER_TELEM_UNKNOWN_ERROR);
203
197
  }
204
198
 
205
199
  this.cacheManager.setServerTelemetry(
@@ -236,7 +230,8 @@ export class ServerTelemetryManager {
236
230
  cacheHits: 0,
237
231
  };
238
232
  const lastRequests = this.cacheManager.getServerTelemetry(
239
- this.telemetryCacheKey
233
+ this.telemetryCacheKey,
234
+ this.correlationId
240
235
  ) as ServerTelemetryEntity;
241
236
 
242
237
  return lastRequests || initialValue;
@@ -287,14 +282,10 @@ export class ServerTelemetryManager {
287
282
  const errorCount = serverTelemetryEntity.errors.length;
288
283
  for (i = 0; i < errorCount; i++) {
289
284
  // failedRequests parameter contains pairs of apiId and correlationId, multiply index by 2 to preserve pairs
290
- const apiId =
291
- serverTelemetryEntity.failedRequests[2 * i] ||
292
- Constants.EMPTY_STRING;
285
+ const apiId = serverTelemetryEntity.failedRequests[2 * i] || "";
293
286
  const correlationId =
294
- serverTelemetryEntity.failedRequests[2 * i + 1] ||
295
- Constants.EMPTY_STRING;
296
- const errorCode =
297
- serverTelemetryEntity.errors[i] || Constants.EMPTY_STRING;
287
+ serverTelemetryEntity.failedRequests[2 * i + 1] || "";
288
+ const errorCode = serverTelemetryEntity.errors[i] || "";
298
289
 
299
290
  // Count number of characters that would be added to header, each character is 1 byte. Add 3 at the end to account for separators
300
291
  dataSize +=
@@ -303,7 +294,7 @@ export class ServerTelemetryManager {
303
294
  errorCode.length +
304
295
  3;
305
296
 
306
- if (dataSize < SERVER_TELEM_CONSTANTS.MAX_LAST_HEADER_BYTES) {
297
+ if (dataSize < Constants.SERVER_TELEM_MAX_LAST_HEADER_BYTES) {
307
298
  // Adding this entry to the header would still keep header size below the limit
308
299
  maxErrors += 1;
309
300
  } else {
@@ -322,11 +313,9 @@ export class ServerTelemetryManager {
322
313
  getRegionDiscoveryFields(): string {
323
314
  const regionDiscoveryFields: string[] = [];
324
315
 
325
- regionDiscoveryFields.push(this.regionUsed || Constants.EMPTY_STRING);
326
- regionDiscoveryFields.push(this.regionSource || Constants.EMPTY_STRING);
327
- regionDiscoveryFields.push(
328
- this.regionOutcome || Constants.EMPTY_STRING
329
- );
316
+ regionDiscoveryFields.push(this.regionUsed || "");
317
+ regionDiscoveryFields.push(this.regionSource || "");
318
+ regionDiscoveryFields.push(this.regionOutcome || "");
330
319
 
331
320
  return regionDiscoveryFields.join(",");
332
321
  }
@@ -348,7 +337,7 @@ export class ServerTelemetryManager {
348
337
  /**
349
338
  * Set cache outcome
350
339
  */
351
- setCacheOutcome(cacheOutcome: CacheOutcome): void {
340
+ setCacheOutcome(cacheOutcome: Constants.CacheOutcome): void {
352
341
  this.cacheOutcome = cacheOutcome;
353
342
  }
354
343
 
@@ -9,8 +9,7 @@ import {
9
9
  } from "../error/ClientConfigurationError.js";
10
10
  import { StringUtils } from "../utils/StringUtils.js";
11
11
  import { IUri } from "./IUri.js";
12
- import { AADAuthorityConstants, Constants } from "../utils/Constants.js";
13
- import * as UrlUtils from "../utils/UrlUtils.js";
12
+ import * as Constants from "../utils/Constants.js";
14
13
 
15
14
  /**
16
15
  * Url object class which can perform various transformations on url strings.
@@ -126,8 +125,8 @@ export class UrlString {
126
125
  if (
127
126
  tenantId &&
128
127
  pathArray.length !== 0 &&
129
- (pathArray[0] === AADAuthorityConstants.COMMON ||
130
- pathArray[0] === AADAuthorityConstants.ORGANIZATIONS)
128
+ (pathArray[0] === Constants.AADAuthority.COMMON ||
129
+ pathArray[0] === Constants.AADAuthority.ORGANIZATIONS)
131
130
  ) {
132
131
  pathArray[0] = tenantId;
133
132
  }
@@ -215,12 +214,4 @@ export class UrlString {
215
214
  urlObject.PathSegments.join("/")
216
215
  );
217
216
  }
218
-
219
- /**
220
- * Check if the hash of the URL string contains known properties
221
- * @deprecated This API will be removed in a future version
222
- */
223
- static hashContainsKnownProperties(response: string): boolean {
224
- return !!UrlUtils.getDeserializedResponse(response);
225
- }
226
217
  }
@@ -3,82 +3,70 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- export const Constants = {
7
- LIBRARY_NAME: "MSAL.JS",
8
- SKU: "msal.js.common",
9
- // default authority
10
- DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
11
- DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
12
- DEFAULT_COMMON_TENANT: "common",
13
- // ADFS String
14
- ADFS: "adfs",
15
- DSTS: "dstsv2",
16
- // Default AAD Instance Discovery Endpoint
17
- AAD_INSTANCE_DISCOVERY_ENDPT:
18
- "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",
19
- // CIAM URL
20
- CIAM_AUTH_URL: ".ciamlogin.com",
21
- AAD_TENANT_DOMAIN_SUFFIX: ".onmicrosoft.com",
22
- // Resource delimiter - used for certain cache entries
23
- RESOURCE_DELIM: "|",
24
- // Placeholder for non-existent account ids/objects
25
- NO_ACCOUNT: "NO_ACCOUNT",
26
- // Claims
27
- CLAIMS: "claims",
28
- // Consumer UTID
29
- CONSUMER_UTID: "9188040d-6c67-4c5b-b112-36a304b66dad",
30
- // Default scopes
31
- OPENID_SCOPE: "openid",
32
- PROFILE_SCOPE: "profile",
33
- OFFLINE_ACCESS_SCOPE: "offline_access",
34
- EMAIL_SCOPE: "email",
35
- CODE_GRANT_TYPE: "authorization_code",
36
- RT_GRANT_TYPE: "refresh_token",
37
- S256_CODE_CHALLENGE_METHOD: "S256",
38
- URL_FORM_CONTENT_TYPE: "application/x-www-form-urlencoded;charset=utf-8",
39
- AUTHORIZATION_PENDING: "authorization_pending",
40
- NOT_DEFINED: "not_defined",
41
- EMPTY_STRING: "",
42
- NOT_APPLICABLE: "N/A",
43
- NOT_AVAILABLE: "Not Available",
44
- FORWARD_SLASH: "/",
45
- IMDS_ENDPOINT: "http://169.254.169.254/metadata/instance/compute/location",
46
- IMDS_VERSION: "2020-06-01",
47
- IMDS_TIMEOUT: 2000,
48
- AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
49
- REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
50
- KNOWN_PUBLIC_CLOUDS: [
51
- "login.microsoftonline.com",
52
- "login.windows.net",
53
- "login.microsoft.com",
54
- "sts.windows.net",
55
- ],
56
- SHR_NONCE_VALIDITY: 240,
57
- INVALID_INSTANCE: "invalid_instance",
58
- };
59
-
60
- export const HttpStatus = {
61
- SUCCESS: 200,
62
- SUCCESS_RANGE_START: 200,
63
- SUCCESS_RANGE_END: 299,
64
- REDIRECT: 302,
65
- CLIENT_ERROR: 400,
66
- CLIENT_ERROR_RANGE_START: 400,
67
- BAD_REQUEST: 400,
68
- UNAUTHORIZED: 401,
69
- NOT_FOUND: 404,
70
- REQUEST_TIMEOUT: 408,
71
- GONE: 410,
72
- TOO_MANY_REQUESTS: 429,
73
- CLIENT_ERROR_RANGE_END: 499,
74
- SERVER_ERROR: 500,
75
- SERVER_ERROR_RANGE_START: 500,
76
- SERVICE_UNAVAILABLE: 503,
77
- GATEWAY_TIMEOUT: 504,
78
- SERVER_ERROR_RANGE_END: 599,
79
- MULTI_SIDED_ERROR: 600,
80
- } as const;
81
- export type HttpStatus = (typeof HttpStatus)[keyof typeof HttpStatus];
6
+ export const SKU = "msal.js.common";
7
+ // default authority
8
+ export const DEFAULT_AUTHORITY = "https://login.microsoftonline.com/common/";
9
+ export const DEFAULT_AUTHORITY_HOST = "login.microsoftonline.com";
10
+ export const DEFAULT_COMMON_TENANT = "common";
11
+ // ADFS String
12
+ export const ADFS = "adfs";
13
+ export const DSTS = "dstsv2";
14
+ // Default AAD Instance Discovery Endpoint
15
+ export const AAD_INSTANCE_DISCOVERY_ENDPT = `${DEFAULT_AUTHORITY}discovery/instance?api-version=1.1&authorization_endpoint=`;
16
+ // CIAM URL
17
+ export const CIAM_AUTH_URL = ".ciamlogin.com";
18
+ export const AAD_TENANT_DOMAIN_SUFFIX = ".onmicrosoft.com";
19
+ // Resource delimiter - used for certain cache entries
20
+ export const RESOURCE_DELIM = "|";
21
+ // Consumer UTID
22
+ export const CONSUMER_UTID = "9188040d-6c67-4c5b-b112-36a304b66dad";
23
+ // Default scopes
24
+ export const OPENID_SCOPE = "openid";
25
+ export const PROFILE_SCOPE = "profile";
26
+ export const OFFLINE_ACCESS_SCOPE = "offline_access";
27
+ export const EMAIL_SCOPE = "email";
28
+ export const CODE_GRANT_TYPE = "authorization_code";
29
+ export const S256_CODE_CHALLENGE_METHOD = "S256";
30
+ export const URL_FORM_CONTENT_TYPE =
31
+ "application/x-www-form-urlencoded;charset=utf-8";
32
+ export const AUTHORIZATION_PENDING = "authorization_pending";
33
+ export const NOT_APPLICABLE = "N/A";
34
+ export const NOT_AVAILABLE = "Not Available";
35
+ export const FORWARD_SLASH = "/";
36
+ export const IMDS_ENDPOINT =
37
+ "http://169.254.169.254/metadata/instance/compute/location";
38
+ export const IMDS_VERSION = "2020-06-01";
39
+ export const IMDS_TIMEOUT = 2000;
40
+ export const AZURE_REGION_AUTO_DISCOVER_FLAG = "TryAutoDetect";
41
+ export const REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX = "login.microsoft.com";
42
+ export const KNOWN_PUBLIC_CLOUDS = [
43
+ "login.microsoftonline.com",
44
+ "login.windows.net",
45
+ "login.microsoft.com",
46
+ "sts.windows.net",
47
+ ];
48
+ export const SHR_NONCE_VALIDITY = 240;
49
+ export const INVALID_INSTANCE = "invalid_instance";
50
+
51
+ export const HTTP_SUCCESS: number = 200;
52
+ export const HTTP_SUCCESS_RANGE_START: number = 200;
53
+ export const HTTP_SUCCESS_RANGE_END: number = 299;
54
+ export const HTTP_REDIRECT: number = 302;
55
+ export const HTTP_CLIENT_ERROR: number = 400;
56
+ export const HTTP_CLIENT_ERROR_RANGE_START: number = 400;
57
+ export const HTTP_BAD_REQUEST: number = 400;
58
+ export const HTTP_UNAUTHORIZED: number = 401;
59
+ export const HTTP_NOT_FOUND: number = 404;
60
+ export const HTTP_REQUEST_TIMEOUT: number = 408;
61
+ export const HTTP_GONE: number = 410;
62
+ export const HTTP_TOO_MANY_REQUESTS: number = 429;
63
+ export const HTTP_CLIENT_ERROR_RANGE_END: number = 499;
64
+ export const HTTP_SERVER_ERROR: number = 500;
65
+ export const HTTP_SERVER_ERROR_RANGE_START: number = 500;
66
+ export const HTTP_SERVICE_UNAVAILABLE: number = 503;
67
+ export const HTTP_GATEWAY_TIMEOUT: number = 504;
68
+ export const HTTP_SERVER_ERROR_RANGE_END: number = 599;
69
+ export const HTTP_MULTI_SIDED_ERROR: number = 600;
82
70
 
83
71
  export const HttpMethod = {
84
72
  GET: "GET",
@@ -87,12 +75,12 @@ export const HttpMethod = {
87
75
  export type HttpMethod = (typeof HttpMethod)[keyof typeof HttpMethod];
88
76
 
89
77
  export const OIDC_DEFAULT_SCOPES = [
90
- Constants.OPENID_SCOPE,
91
- Constants.PROFILE_SCOPE,
92
- Constants.OFFLINE_ACCESS_SCOPE,
78
+ OPENID_SCOPE,
79
+ PROFILE_SCOPE,
80
+ OFFLINE_ACCESS_SCOPE,
93
81
  ];
94
82
 
95
- export const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES, Constants.EMAIL_SCOPE];
83
+ export const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES, EMAIL_SCOPE];
96
84
 
97
85
  /**
98
86
  * Request header names
@@ -121,13 +109,12 @@ export type PersistentCacheKeys =
121
109
  /**
122
110
  * String constants related to AAD Authority
123
111
  */
124
- export const AADAuthorityConstants = {
112
+ export const AADAuthority = {
125
113
  COMMON: "common",
126
114
  ORGANIZATIONS: "organizations",
127
115
  CONSUMERS: "consumers",
128
116
  } as const;
129
- export type AADAuthorityConstants =
130
- (typeof AADAuthorityConstants)[keyof typeof AADAuthorityConstants];
117
+ export type AADAuthority = (typeof AADAuthority)[keyof typeof AADAuthority];
131
118
 
132
119
  /**
133
120
  * Claims request keys
@@ -172,17 +159,6 @@ export const OAuthResponseType = {
172
159
  export type OAuthResponseType =
173
160
  (typeof OAuthResponseType)[keyof typeof OAuthResponseType];
174
161
 
175
- /**
176
- * allowed values for server response type
177
- * @deprecated Use ResponseMode instead
178
- */
179
- export const ServerResponseType = {
180
- QUERY: "query",
181
- FRAGMENT: "fragment",
182
- } as const;
183
- export type ServerResponseType =
184
- (typeof ServerResponseType)[keyof typeof ServerResponseType];
185
-
186
162
  /**
187
163
  * allowed values for response_mode
188
164
  */
@@ -210,23 +186,16 @@ export type GrantType = (typeof GrantType)[keyof typeof GrantType];
210
186
  /**
211
187
  * Account types in Cache
212
188
  */
213
- export const CacheAccountType = {
214
- MSSTS_ACCOUNT_TYPE: "MSSTS",
215
- ADFS_ACCOUNT_TYPE: "ADFS",
216
- MSAV1_ACCOUNT_TYPE: "MSA",
217
- GENERIC_ACCOUNT_TYPE: "Generic", // NTLM, Kerberos, FBA, Basic etc
218
- } as const;
219
- export type CacheAccountType =
220
- (typeof CacheAccountType)[keyof typeof CacheAccountType];
189
+ export const CACHE_ACCOUNT_TYPE_MSSTS: string = "MSSTS";
190
+ export const CACHE_ACCOUNT_TYPE_ADFS: string = "ADFS";
191
+ export const CACHE_ACCOUNT_TYPE_MSAV1: string = "MSA";
192
+ export const CACHE_ACCOUNT_TYPE_GENERIC: string = "Generic";
221
193
 
222
194
  /**
223
195
  * Separators used in cache
224
196
  */
225
- export const Separators = {
226
- CACHE_KEY_SEPARATOR: "-",
227
- CLIENT_INFO_SEPARATOR: ".",
228
- } as const;
229
- export type Separators = (typeof Separators)[keyof typeof Separators];
197
+ export const CACHE_KEY_SEPARATOR: string = "-";
198
+ export const CLIENT_INFO_SEPARATOR: string = ".";
230
199
 
231
200
  /**
232
201
  * Credential Type stored in the cache
@@ -259,14 +228,12 @@ export type CacheType = (typeof CacheType)[keyof typeof CacheType];
259
228
  /**
260
229
  * More Cache related constants
261
230
  */
262
- export const APP_METADATA = "appmetadata";
263
- export const CLIENT_INFO = "client_info";
264
- export const THE_FAMILY_ID = "1";
231
+ export const APP_METADATA: string = "appmetadata";
232
+ export const CLIENT_INFO: string = "client_info";
233
+ export const THE_FAMILY_ID: string = "1";
265
234
 
266
- export const AUTHORITY_METADATA_CONSTANTS = {
267
- CACHE_KEY: "authority-metadata",
268
- REFRESH_TIME_SECONDS: 3600 * 24, // 24 Hours
269
- };
235
+ export const AUTHORITY_METADATA_CACHE_KEY: string = "authority-metadata";
236
+ export const AUTHORITY_METADATA_REFRESH_TIME_SECONDS: number = 3600 * 24; // 24 Hours
270
237
 
271
238
  export const AuthorityMetadataSource = {
272
239
  CONFIG: "config",
@@ -277,18 +244,16 @@ export const AuthorityMetadataSource = {
277
244
  export type AuthorityMetadataSource =
278
245
  (typeof AuthorityMetadataSource)[keyof typeof AuthorityMetadataSource];
279
246
 
280
- export const SERVER_TELEM_CONSTANTS = {
281
- SCHEMA_VERSION: 5,
282
- MAX_CUR_HEADER_BYTES: 80, // ESTS limit is 100B, set to 80 to provide a 20B buffer
283
- MAX_LAST_HEADER_BYTES: 330, // ESTS limit is 350B, set to 330 to provide a 20B buffer,
284
- MAX_CACHED_ERRORS: 50, // Limit the number of errors that can be stored to prevent uncontrolled size gains
285
- CACHE_KEY: "server-telemetry",
286
- CATEGORY_SEPARATOR: "|",
287
- VALUE_SEPARATOR: ",",
288
- OVERFLOW_TRUE: "1",
289
- OVERFLOW_FALSE: "0",
290
- UNKNOWN_ERROR: "unknown_error",
291
- };
247
+ export const SERVER_TELEM_SCHEMA_VERSION: number = 5;
248
+ export const SERVER_TELEM_MAX_CUR_HEADER_BYTES: number = 80; // ESTS limit is 100B, set to 80 to provide a 20B buffer
249
+ export const SERVER_TELEM_MAX_LAST_HEADER_BYTES: number = 330; // ESTS limit is 350B, set to 330 to provide a 20B buffer,
250
+ export const SERVER_TELEM_MAX_CACHED_ERRORS: number = 50; // Limit the number of errors that can be stored to prevent uncontrolled size gains
251
+ export const SERVER_TELEM_CACHE_KEY: string = "server-telemetry";
252
+ export const SERVER_TELEM_CATEGORY_SEPARATOR: string = "|";
253
+ export const SERVER_TELEM_VALUE_SEPARATOR: string = ",";
254
+ export const SERVER_TELEM_OVERFLOW_TRUE: string = "1";
255
+ export const SERVER_TELEM_OVERFLOW_FALSE: string = "0";
256
+ export const SERVER_TELEM_UNKNOWN_ERROR: string = "unknown_error";
292
257
 
293
258
  /**
294
259
  * Type of the authentication request
@@ -304,21 +269,19 @@ export type AuthenticationScheme =
304
269
  /**
305
270
  * Constants related to throttling
306
271
  */
307
- export const ThrottlingConstants = {
308
- // Default time to throttle RequestThumbprint in seconds
309
- DEFAULT_THROTTLE_TIME_SECONDS: 60,
310
- // Default maximum time to throttle in seconds, overrides what the server sends back
311
- DEFAULT_MAX_THROTTLE_TIME_SECONDS: 3600,
312
- // Prefix for storing throttling entries
313
- THROTTLING_PREFIX: "throttling",
314
- // Value assigned to the x-ms-lib-capability header to indicate to the server the library supports throttling
315
- X_MS_LIB_CAPABILITY_VALUE: "retry-after, h429",
316
- };
272
+ export const DEFAULT_THROTTLE_TIME_SECONDS: number = 60;
273
+ // Default maximum time to throttle in seconds, overrides what the server sends back
274
+ export const DEFAULT_MAX_THROTTLE_TIME_SECONDS: number = 3600;
275
+ // Prefix for storing throttling entries
276
+ export const THROTTLING_PREFIX: string = "throttling";
277
+ // Value assigned to the x-ms-lib-capability header to indicate to the server the library supports throttling
278
+ export const X_MS_LIB_CAPABILITY_VALUE: string = "retry-after, h429";
317
279
 
318
- export const Errors = {
319
- INVALID_GRANT_ERROR: "invalid_grant",
320
- CLIENT_MISMATCH_ERROR: "client_mismatch",
321
- };
280
+ /**
281
+ * Errors
282
+ */
283
+ export const INVALID_GRANT_ERROR: string = "invalid_grant";
284
+ export const CLIENT_MISMATCH_ERROR: string = "client_mismatch";
322
285
 
323
286
  /**
324
287
  * Password grant parameters