@azure/msal-common 14.4.1-beta.1 → 14.6.0-alpha.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 (209) hide show
  1. package/dist/account/AccountInfo.d.ts +27 -0
  2. package/dist/account/AccountInfo.d.ts.map +1 -1
  3. package/dist/account/AccountInfo.mjs +64 -0
  4. package/dist/account/AccountInfo.mjs.map +1 -0
  5. package/dist/account/AuthToken.mjs +1 -1
  6. package/dist/account/AuthToken.mjs.map +1 -1
  7. package/dist/account/CcsCredential.mjs +1 -1
  8. package/dist/account/CcsCredential.mjs.map +1 -1
  9. package/dist/account/ClientInfo.d.ts +1 -2
  10. package/dist/account/ClientInfo.d.ts.map +1 -1
  11. package/dist/account/ClientInfo.mjs +3 -3
  12. package/dist/account/ClientInfo.mjs.map +1 -1
  13. package/dist/account/TokenClaims.d.ts +18 -0
  14. package/dist/account/TokenClaims.d.ts.map +1 -1
  15. package/dist/account/TokenClaims.mjs +25 -0
  16. package/dist/account/TokenClaims.mjs.map +1 -0
  17. package/dist/authority/Authority.d.ts +7 -2
  18. package/dist/authority/Authority.d.ts.map +1 -1
  19. package/dist/authority/Authority.mjs +34 -7
  20. package/dist/authority/Authority.mjs.map +1 -1
  21. package/dist/authority/AuthorityFactory.mjs +1 -1
  22. package/dist/authority/AuthorityFactory.mjs.map +1 -1
  23. package/dist/authority/AuthorityMetadata.mjs +1 -1
  24. package/dist/authority/AuthorityMetadata.mjs.map +1 -1
  25. package/dist/authority/AuthorityOptions.mjs +1 -1
  26. package/dist/authority/AuthorityOptions.mjs.map +1 -1
  27. package/dist/authority/AuthorityType.mjs +1 -1
  28. package/dist/authority/AuthorityType.mjs.map +1 -1
  29. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  30. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs.map +1 -1
  31. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  32. package/dist/authority/CloudInstanceDiscoveryResponse.mjs.map +1 -1
  33. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  34. package/dist/authority/OpenIdConfigResponse.mjs.map +1 -1
  35. package/dist/authority/ProtocolMode.mjs +1 -1
  36. package/dist/authority/ProtocolMode.mjs.map +1 -1
  37. package/dist/authority/RegionDiscovery.mjs +1 -1
  38. package/dist/authority/RegionDiscovery.mjs.map +1 -1
  39. package/dist/cache/CacheManager.d.ts +50 -27
  40. package/dist/cache/CacheManager.d.ts.map +1 -1
  41. package/dist/cache/CacheManager.mjs +243 -107
  42. package/dist/cache/CacheManager.mjs.map +1 -1
  43. package/dist/cache/entities/AccountEntity.d.ts +9 -4
  44. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  45. package/dist/cache/entities/AccountEntity.mjs +56 -28
  46. package/dist/cache/entities/AccountEntity.mjs.map +1 -1
  47. package/dist/cache/entities/AppMetadataEntity.mjs +1 -1
  48. package/dist/cache/entities/AppMetadataEntity.mjs.map +1 -1
  49. package/dist/cache/entities/AuthorityMetadataEntity.mjs +1 -1
  50. package/dist/cache/entities/AuthorityMetadataEntity.mjs.map +1 -1
  51. package/dist/cache/entities/CacheRecord.mjs +1 -1
  52. package/dist/cache/entities/CacheRecord.mjs.map +1 -1
  53. package/dist/cache/entities/ThrottlingEntity.d.ts +2 -8
  54. package/dist/cache/entities/ThrottlingEntity.d.ts.map +1 -1
  55. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  56. package/dist/cache/persistence/TokenCacheContext.mjs.map +1 -1
  57. package/dist/cache/utils/CacheHelpers.d.ts +7 -1
  58. package/dist/cache/utils/CacheHelpers.d.ts.map +1 -1
  59. package/dist/cache/utils/CacheHelpers.mjs +20 -4
  60. package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
  61. package/dist/cache/utils/CacheTypes.d.ts +2 -0
  62. package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
  63. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  64. package/dist/client/AuthorizationCodeClient.mjs +10 -9
  65. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  66. package/dist/client/BaseClient.mjs +1 -1
  67. package/dist/client/BaseClient.mjs.map +1 -1
  68. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  69. package/dist/client/RefreshTokenClient.mjs +25 -11
  70. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  71. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  72. package/dist/client/SilentFlowClient.mjs +20 -9
  73. package/dist/client/SilentFlowClient.mjs.map +1 -1
  74. package/dist/config/ClientConfiguration.d.ts.map +1 -1
  75. package/dist/config/ClientConfiguration.mjs +2 -4
  76. package/dist/config/ClientConfiguration.mjs.map +1 -1
  77. package/dist/constants/AADServerParamKeys.d.ts +53 -0
  78. package/dist/constants/AADServerParamKeys.d.ts.map +1 -0
  79. package/dist/constants/AADServerParamKeys.mjs +61 -0
  80. package/dist/constants/AADServerParamKeys.mjs.map +1 -0
  81. package/dist/crypto/ICrypto.mjs +1 -1
  82. package/dist/crypto/ICrypto.mjs.map +1 -1
  83. package/dist/crypto/JoseHeader.mjs +1 -1
  84. package/dist/crypto/JoseHeader.mjs.map +1 -1
  85. package/dist/crypto/PopTokenGenerator.mjs +2 -2
  86. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  87. package/dist/error/AuthError.mjs +1 -1
  88. package/dist/error/AuthError.mjs.map +1 -1
  89. package/dist/error/AuthErrorCodes.mjs +1 -1
  90. package/dist/error/AuthErrorCodes.mjs.map +1 -1
  91. package/dist/error/ClientAuthError.mjs +1 -1
  92. package/dist/error/ClientAuthError.mjs.map +1 -1
  93. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  94. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
  95. package/dist/error/ClientConfigurationError.mjs +1 -1
  96. package/dist/error/ClientConfigurationError.mjs.map +1 -1
  97. package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
  98. package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -1
  99. package/dist/error/InteractionRequiredAuthError.d.ts +4 -0
  100. package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -1
  101. package/dist/error/InteractionRequiredAuthError.mjs +10 -3
  102. package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
  103. package/dist/error/InteractionRequiredAuthErrorCodes.d.ts +1 -0
  104. package/dist/error/InteractionRequiredAuthErrorCodes.d.ts.map +1 -1
  105. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +4 -3
  106. package/dist/error/InteractionRequiredAuthErrorCodes.mjs.map +1 -1
  107. package/dist/error/JoseHeaderError.mjs +1 -1
  108. package/dist/error/JoseHeaderError.mjs.map +1 -1
  109. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  110. package/dist/error/JoseHeaderErrorCodes.mjs.map +1 -1
  111. package/dist/error/ServerError.mjs +1 -1
  112. package/dist/error/ServerError.mjs.map +1 -1
  113. package/dist/index.cjs +797 -416
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.d.ts +5 -4
  116. package/dist/index.d.ts.map +1 -1
  117. package/dist/index.mjs +7 -4
  118. package/dist/index.mjs.map +1 -1
  119. package/dist/logger/Logger.mjs +1 -1
  120. package/dist/logger/Logger.mjs.map +1 -1
  121. package/dist/network/INetworkModule.mjs +1 -1
  122. package/dist/network/INetworkModule.mjs.map +1 -1
  123. package/dist/network/NetworkManager.mjs +1 -1
  124. package/dist/network/NetworkManager.mjs.map +1 -1
  125. package/dist/network/ThrottlingUtils.mjs +1 -1
  126. package/dist/network/ThrottlingUtils.mjs.map +1 -1
  127. package/dist/packageMetadata.d.ts +1 -1
  128. package/dist/packageMetadata.d.ts.map +1 -1
  129. package/dist/packageMetadata.mjs +2 -2
  130. package/dist/packageMetadata.mjs.map +1 -1
  131. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  132. package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
  133. package/dist/request/CommonRefreshTokenRequest.d.ts +0 -1
  134. package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
  135. package/dist/request/CommonSilentFlowRequest.d.ts +7 -1
  136. package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
  137. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  138. package/dist/request/RequestParameterBuilder.mjs +46 -45
  139. package/dist/request/RequestParameterBuilder.mjs.map +1 -1
  140. package/dist/request/RequestValidator.mjs +1 -1
  141. package/dist/request/RequestValidator.mjs.map +1 -1
  142. package/dist/request/ScopeSet.mjs +1 -1
  143. package/dist/request/ScopeSet.mjs.map +1 -1
  144. package/dist/response/ResponseHandler.d.ts +3 -1
  145. package/dist/response/ResponseHandler.d.ts.map +1 -1
  146. package/dist/response/ResponseHandler.mjs +56 -20
  147. package/dist/response/ResponseHandler.mjs.map +1 -1
  148. package/dist/response/ServerAuthorizationTokenResponse.d.ts +1 -0
  149. package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
  150. package/dist/telemetry/performance/IPerformanceClient.d.ts +6 -0
  151. package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  152. package/dist/telemetry/performance/PerformanceClient.d.ts +9 -2
  153. package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  154. package/dist/telemetry/performance/PerformanceClient.mjs +17 -13
  155. package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
  156. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  157. package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
  158. package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
  159. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  160. package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
  161. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  162. package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
  163. package/dist/url/UrlString.mjs +1 -1
  164. package/dist/url/UrlString.mjs.map +1 -1
  165. package/dist/utils/Constants.d.ts +2 -69
  166. package/dist/utils/Constants.d.ts.map +1 -1
  167. package/dist/utils/Constants.mjs +6 -70
  168. package/dist/utils/Constants.mjs.map +1 -1
  169. package/dist/utils/FunctionWrappers.mjs +1 -1
  170. package/dist/utils/FunctionWrappers.mjs.map +1 -1
  171. package/dist/utils/ProtocolUtils.mjs +1 -1
  172. package/dist/utils/ProtocolUtils.mjs.map +1 -1
  173. package/dist/utils/StringUtils.mjs +1 -1
  174. package/dist/utils/StringUtils.mjs.map +1 -1
  175. package/dist/utils/TimeUtils.mjs +1 -1
  176. package/dist/utils/TimeUtils.mjs.map +1 -1
  177. package/dist/utils/UrlUtils.mjs +1 -1
  178. package/dist/utils/UrlUtils.mjs.map +1 -1
  179. package/package.json +93 -92
  180. package/src/account/AccountInfo.ts +96 -0
  181. package/src/account/ClientInfo.ts +2 -3
  182. package/src/account/TokenClaims.ts +28 -0
  183. package/src/authority/Authority.ts +38 -5
  184. package/src/cache/CacheManager.ts +410 -162
  185. package/src/cache/entities/AccountEntity.ts +84 -33
  186. package/src/cache/entities/ThrottlingEntity.ts +2 -24
  187. package/src/cache/utils/CacheHelpers.ts +22 -2
  188. package/src/cache/utils/CacheTypes.ts +11 -0
  189. package/src/client/AuthorizationCodeClient.ts +4 -5
  190. package/src/client/RefreshTokenClient.ts +35 -14
  191. package/src/client/SilentFlowClient.ts +31 -11
  192. package/src/config/ClientConfiguration.ts +4 -4
  193. package/src/constants/AADServerParamKeys.ts +57 -0
  194. package/src/crypto/PopTokenGenerator.ts +1 -1
  195. package/src/error/InteractionRequiredAuthError.ts +12 -2
  196. package/src/error/InteractionRequiredAuthErrorCodes.ts +1 -0
  197. package/src/index.ts +18 -5
  198. package/src/packageMetadata.ts +1 -1
  199. package/src/request/CommonRefreshTokenRequest.ts +0 -1
  200. package/src/request/CommonSilentFlowRequest.ts +7 -1
  201. package/src/request/RequestParameterBuilder.ts +7 -5
  202. package/src/response/ResponseHandler.ts +109 -25
  203. package/src/response/ServerAuthorizationTokenResponse.ts +1 -0
  204. package/src/telemetry/performance/IPerformanceClient.ts +6 -0
  205. package/src/telemetry/performance/PerformanceClient.ts +24 -31
  206. package/src/telemetry/performance/StubPerformanceClient.ts +0 -1
  207. package/src/utils/Constants.ts +4 -72
  208. package/dist/cache/entities/ThrottlingEntity.mjs +0 -30
  209. package/dist/cache/entities/ThrottlingEntity.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionWrappers.mjs","sources":["../../src/utils/FunctionWrappers.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;AACA;AAEA;;;;;;;;;;AAUG;AAEH;AAmCA;;;;;;;;;;;AAWG,YAAA,MAAA,CAAA,KAAA,CAAA,CAAA,sBAAA,EAAA,SAAA,CAAA,CAAA,CAAA,CAAA;AAEH,YAAO,OAAA,MAAiB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"FunctionWrappers.mjs","sources":["../../src/utils/FunctionWrappers.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAKH;;;;;;;;;;AAUG;AACH;AACO,MAAM,MAAM,GAAG,CAClB,QAA2B,EAC3B,SAAiB,EACjB,MAAc,EACd,eAAoC,EACpC,aAAsB,KACtB;AACA,IAAA,OAAO,CAAC,GAAG,IAAO,KAAO;AACrB,QAAA,MAAM,CAAC,KAAK,CAAC,sBAAsB,SAAS,CAAA,CAAE,CAAC,CAAC;QAChD,MAAM,eAAe,GAAG,eAAe,EAAE,gBAAgB,CACrD,SAAS,EACT,aAAa,CAChB,CAAC;QACF,IAAI;AACA,YAAA,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;YACjC,eAAe,EAAE,GAAG,CAAC;AACjB,gBAAA,OAAO,EAAE,IAAI;AAChB,aAAA,CAAC,CAAC;AACH,YAAA,MAAM,CAAC,KAAK,CAAC,yBAAyB,SAAS,CAAA,CAA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,KAAI;AACT,YAAA,MAAM,CAAC,KAAK,CAAC,qBAAqB,SAAS,CAAA,CAAE,CAAC,CAAC;YAC/C,IAAI;gBACA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,aAAA;AAAC,YAAA,OAAO,CAAC,EAAE;AACR,gBAAA,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;AAClD,aAAA;YACD,eAAe,EAAE,GAAG,CAAC;AACjB,gBAAA,OAAO,EAAE,KAAK;AACjB,aAAA,CAAC,CAAC;AACH,YAAA,MAAM,CAAC,CAAC;AACZ,SAAC,CAAC,CAAC;AACX,KAAC,CAAC;AACN;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.4.1-beta.1 2023-11-14 */
1
+ /*! @azure/msal-common v14.6.0-alpha.0 2023-12-15 */
2
2
  'use strict';
3
3
  import { Constants } from './Constants.mjs';
4
4
  import { createClientAuthError } from '../error/ClientAuthError.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"ProtocolUtils.mjs","sources":["../../src/utils/ProtocolUtils.ts"],"sourcesContent":[null],"names":["ClientAuthErrorCodes.noCryptoObject"],"mappings":";;;;;;AAMA;AAMA;;;;AAMG;AACH;AACM,mBAAS,CAAA;;;AAIf;;AAEG;AACH,IAAM,OAAA,yBAA2B,EAAA,SAAA,EAAA,IAAA,EAAA;QACb,MAAA,eAAS,aAAA,CAAA,oBAAA,CAAA,SAAA,EAAA,IAAA,CAAA,CAAA;QACb,OAAA;cACd,CAAA,EAAA,YAAA,CAAA,EAAA,SAAA,CAAA,cAAA,CAAA,EAAA,SAAA,CAAA,CAAA;AAEF,cAAA,YAAA,CAAA;;AAEG;AACH;AACI;;;;AAIG,QAAA,IAAA,CAAA,SAAA,EAAA;uCAEmB,CAAAA,cAEL,CAAA,CAAA;AAWjB,SAAA;;;;AAIG,SAAA,CAAA;AACH,QAAA,IAA2B,IAAA,EAAA;AAsB3B,YAAA,QAAA,CAAA,IAAA,GAAA,IAAA,CAAA;;;;AAIG,KAAA;;AAiCN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ProtocolUtils.mjs","sources":["../../src/utils/ProtocolUtils.ts"],"sourcesContent":[null],"names":["ClientAuthErrorCodes.noCryptoObject","ClientAuthErrorCodes.invalidState"],"mappings":";;;;;;AAAA;;;AAGG;AA6BH;;AAEG;MACU,aAAa,CAAA;AACtB;;;;AAIG;AACH,IAAA,OAAO,eAAe,CAClB,SAAkB,EAClB,SAAkB,EAClB,IAA6B,EAAA;QAE7B,MAAM,YAAY,GAAG,aAAa,CAAC,oBAAoB,CACnD,SAAS,EACT,IAAI,CACP,CAAC;AACF,QAAA,OAAO,SAAS;cACV,GAAG,YAAY,CAAA,EAAG,SAAS,CAAC,cAAc,CAAG,EAAA,SAAS,CAAE,CAAA;cACxD,YAAY,CAAC;KACtB;AAED;;;;AAIG;AACH,IAAA,OAAO,oBAAoB,CACvB,SAAkB,EAClB,IAA6B,EAAA;QAE7B,IAAI,CAAC,SAAS,EAAE;AACZ,YAAA,MAAM,qBAAqB,CAACA,cAAmC,CAAC,CAAC;AACpE,SAAA;;AAGD,QAAA,MAAM,QAAQ,GAAuB;AACjC,YAAA,EAAE,EAAE,SAAS,CAAC,aAAa,EAAE;SAChC,CAAC;AAEF,QAAA,IAAI,IAAI,EAAE;AACN,YAAA,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;AACxB,SAAA;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE7C,QAAA,OAAO,SAAS,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;KAC9C;AAED;;;;AAIG;AACH,IAAA,OAAO,iBAAiB,CACpB,SAAkB,EAClB,KAAa,EAAA;QAEb,IAAI,CAAC,SAAS,EAAE;AACZ,YAAA,MAAM,qBAAqB,CAACA,cAAmC,CAAC,CAAC;AACpE,SAAA;QAED,IAAI,CAAC,KAAK,EAAE;AACR,YAAA,MAAM,qBAAqB,CAACC,YAAiC,CAAC,CAAC;AAClE,SAAA;QAED,IAAI;;YAEA,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;AACzD,YAAA,MAAM,YAAY,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AACnC,YAAA,MAAM,SAAS,GACX,UAAU,CAAC,MAAM,GAAG,CAAC;AACjB,kBAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC;AACpD,kBAAE,SAAS,CAAC,YAAY,CAAC;YACjC,MAAM,kBAAkB,GAAG,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;YAChE,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAC9B,kBAAkB,CACC,CAAC;YACxB,OAAO;AACH,gBAAA,gBAAgB,EAAE,SAAS,IAAI,SAAS,CAAC,YAAY;AACrD,gBAAA,YAAY,EAAE,eAAe;aAChC,CAAC;AACL,SAAA;AAAC,QAAA,OAAO,CAAC,EAAE;AACR,YAAA,MAAM,qBAAqB,CAACA,YAAiC,CAAC,CAAC;AAClE,SAAA;KACJ;AACJ;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.4.1-beta.1 2023-11-14 */
1
+ /*! @azure/msal-common v14.6.0-alpha.0 2023-12-15 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1 +1 @@
1
- {"version":3,"file":"StringUtils.mjs","sources":["../../src/utils/StringUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;;AAEG;AACH;AACI;;;AAGG,MAAA,WAAA,CAAA;;;;AAsBH;;;;AAIG,gBAAA,MAAA,GAAA,GAAA,IAAA,CAAA,KAAA,CAAA,MAAA,CAAA,CAAA;8BACuB,IAAI,CAAK,GAAA,CA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CAAC;AACnB,SAAC,CAAC,CAAC;KACN;AAED;;;AAGG;IACH,OAAO,eAAe,CAAI,GAAW,EAAA;QACjC,IAAI;AACA,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,CAAC;AAC/B,SAAA;AAAC,QAAA,OAAO,CAAC,EAAE;AACR,YAAA,OAAO,IAAI,CAAC;AACf,SAAA;KACJ;AAED;;;;AAIG;AACH,IAAA,OAAO,YAAY,CAAC,OAAe,EAAE,KAAa,EAAA;AAC9C;;;AAGG;;AAEH,QAAA,MAAM,KAAK,GAAW,IAAI,MAAM,CAC5B,OAAO;AACF,aAAA,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;AACtB,aAAA,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;AACvB,aAAA,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAC7B,CAAC;AAEF,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAC5B;AACJ;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.4.1-beta.1 2023-11-14 */
1
+ /*! @azure/msal-common v14.6.0-alpha.0 2023-12-15 */
2
2
  'use strict';
3
3
  /*
4
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1 +1 @@
1
- {"version":3,"file":"TimeUtils.mjs","sources":["../../src/utils/TimeUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;;AAEG;AACH;AACI;;AAEG;AACG,MAAW,SAAA,CAAA;AAKjB;;;AAGG,IAAA,OAAA,UAAA,GAAA;;AAUH,QAAA,OAAA,IAAA,CAAA,KAAA,CAAA,IAAA,IAAA,EAAA,CAAA,OAAA,EAAA,GAAA,MAAA,CAAA,CAAA;;;;;AAKG;AACH,IAAA,OAAO,cAAkB,CAAA,iBAAW,EAAA;AAMpC;;;;AAIG,QAAA,OAAA,oBAAA,GAAA,aAAA,CAAA;AACH,KAAA;AAGH;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"TimeUtils.mjs","sources":["../../src/utils/TimeUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;;AAEG;MACU,SAAS,CAAA;AAClB;;AAEG;AACH,IAAA,OAAO,UAAU,GAAA;;AAEb,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;KACpD;AAED;;;AAGG;AACH,IAAA,OAAO,cAAc,CAAC,SAAiB,EAAE,MAAc,EAAA;;QAEnD,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,oBAAoB,GAAG,SAAS,CAAC,UAAU,EAAE,GAAG,MAAM,CAAC;;QAG7D,OAAO,oBAAoB,GAAG,aAAa,CAAC;KAC/C;AAED;;;;;AAKG;IACH,OAAO,kBAAkB,CAAC,QAAgB,EAAA;AACtC,QAAA,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;AAErC,QAAA,OAAO,WAAW,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;KAC/C;AAED;;;;AAIG;AACH,IAAA,OAAO,KAAK,CAAI,CAAS,EAAE,KAAS,EAAA;QAChC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,UAAU,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KACxE;AACJ;;;;"}
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.4.1-beta.1 2023-11-14 */
1
+ /*! @azure/msal-common v14.6.0-alpha.0 2023-12-15 */
2
2
  'use strict';
3
3
  import { createClientAuthError } from '../error/ClientAuthError.mjs';
4
4
  import { hashNotDeserialized } from '../error/ClientAuthErrorCodes.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"UrlUtils.mjs","sources":["../../src/utils/UrlUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;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AE;AACR,QAAA,MAAM,qBAAqB,CAACA,mBAAwC,CAAC,CAAC;AACzE,KAAA;AAED,IAAA,OAAO,IAAI,CAAC;AAChB;;;;"}
package/package.json CHANGED
@@ -1,95 +1,96 @@
1
1
  {
2
- "name": "@azure/msal-common",
3
- "author": {
4
- "name": "Microsoft",
5
- "email": "nugetaad@microsoft.com",
6
- "url": "https://www.microsoft.com"
2
+ "name": "@azure/msal-common",
3
+ "author": {
4
+ "name": "Microsoft",
5
+ "email": "nugetaad@microsoft.com",
6
+ "url": "https://www.microsoft.com"
7
+ },
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
12
+ },
13
+ "version": "14.6.0-alpha.0",
14
+ "description": "Microsoft Authentication Library for js",
15
+ "keywords": [
16
+ "implicit",
17
+ "authorization code",
18
+ "PKCE",
19
+ "js",
20
+ "AAD",
21
+ "msal",
22
+ "oauth"
23
+ ],
24
+ "sideEffects": false,
25
+ "module": "./dist/index.mjs",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "module": "./dist/index.mjs",
31
+ "import": "./dist/index.mjs",
32
+ "require": "./dist/index.cjs",
33
+ "default": "./dist/index.mjs"
7
34
  },
8
- "license": "MIT",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
12
- },
13
- "version": "14.4.1-beta.1",
14
- "description": "Microsoft Authentication Library for js",
15
- "keywords": [
16
- "implicit",
17
- "authorization code",
18
- "PKCE",
19
- "js",
20
- "AAD",
21
- "msal",
22
- "oauth"
23
- ],
24
- "sideEffects": false,
25
- "module": "./dist/index.mjs",
26
- "types": "./dist/index.d.ts",
27
- "exports": {
28
- ".": {
29
- "types": "./dist/index.d.ts",
30
- "module": "./dist/index.mjs",
31
- "import": "./dist/index.mjs",
32
- "require": "./dist/index.cjs",
33
- "default": "./dist/index.mjs"
34
- },
35
- "./package.json": "./package.json"
36
- },
37
- "engines": {
38
- "node": ">=0.8.0"
39
- },
40
- "directories": {
41
- "test": "test"
42
- },
43
- "files": [
44
- "dist",
45
- "src"
46
- ],
47
- "scripts": {
48
- "clean": "shx rm -rf dist lib",
49
- "clean:coverage": "rimraf ../../.nyc_output/*",
50
- "lint": "eslint src --ext .ts",
51
- "lint:fix": "npm run lint -- --fix",
52
- "test": "jest",
53
- "test:coverage": "jest --coverage",
54
- "test:coverage:only": "npm run clean:coverage && npm run test:coverage",
55
- "build:modules": "rollup -c --strictDeprecations --bundleConfigAsCjs",
56
- "build:modules:watch": "rollup -cw --bundleConfigAsCjs",
57
- "build": "npm run clean && npm run build:modules",
58
- "build:all": "npm run build",
59
- "prepack": "npm run build",
60
- "metadata:check": "ts-node scripts/metadata.ts",
61
- "format:check": "npx prettier --ignore-path .gitignore --check src test",
62
- "format:fix": "npx prettier --ignore-path .gitignore --write src test"
63
- },
64
- "beachball": {
65
- "disallowedChangeTypes": [
66
- "major"
67
- ]
68
- },
69
- "devDependencies": {
70
- "@babel/core": "^7.7.2",
71
- "@babel/plugin-proposal-class-properties": "^7.7.0",
72
- "@babel/plugin-proposal-object-rest-spread": "^7.6.2",
73
- "@babel/preset-env": "^7.7.1",
74
- "@babel/preset-typescript": "^7.7.2",
75
- "@rollup/plugin-typescript": "^11.0.0",
76
- "@types/debug": "^4.1.5",
77
- "@types/jest": "^29.5.0",
78
- "@types/lodash": "^4.14.182",
79
- "@types/node": "^20.3.1",
80
- "@types/sinon": "^7.5.0",
81
- "eslint-config-msal": "^0.0.0",
82
- "jest": "^29.5.0",
83
- "lodash": "^4.17.21",
84
- "prettier": "2.8.7",
85
- "rimraf": "^3.0.2",
86
- "rollup": "^3.14.0",
87
- "shx": "^0.3.2",
88
- "sinon": "^7.5.0",
89
- "ts-jest": "^29.1.0",
90
- "ts-node": "^10.9.1",
91
- "tslib": "^1.10.0",
92
- "typescript": "^4.9.5",
93
- "yargs": "^17.5.1"
94
- }
35
+ "./package.json": "./package.json"
36
+ },
37
+ "engines": {
38
+ "node": ">=0.8.0"
39
+ },
40
+ "directories": {
41
+ "test": "test"
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "src"
46
+ ],
47
+ "scripts": {
48
+ "clean": "shx rm -rf dist lib",
49
+ "clean:coverage": "rimraf ../../.nyc_output/*",
50
+ "lint": "eslint src --ext .ts",
51
+ "lint:fix": "npm run lint -- --fix",
52
+ "test": "jest",
53
+ "test:coverage": "jest --coverage",
54
+ "test:coverage:only": "npm run clean:coverage && npm run test:coverage",
55
+ "build:modules": "rollup -c --strictDeprecations --bundleConfigAsCjs",
56
+ "build:modules:watch": "rollup -cw --bundleConfigAsCjs",
57
+ "build": "npm run clean && npm run build:modules",
58
+ "build:all": "npm run build",
59
+ "prepack": "npm run build",
60
+ "metadata:check": "ts-node scripts/metadata.ts",
61
+ "format:check": "npx prettier --ignore-path .gitignore --check src test",
62
+ "format:fix": "npx prettier --ignore-path .gitignore --write src test"
63
+ },
64
+ "beachball": {
65
+ "disallowedChangeTypes": [
66
+ "major"
67
+ ]
68
+ },
69
+ "devDependencies": {
70
+ "@babel/core": "^7.7.2",
71
+ "@babel/plugin-proposal-class-properties": "^7.7.0",
72
+ "@babel/plugin-proposal-object-rest-spread": "^7.6.2",
73
+ "@babel/preset-env": "^7.7.1",
74
+ "@babel/preset-typescript": "^7.7.2",
75
+ "@rollup/plugin-typescript": "^11.0.0",
76
+ "@types/debug": "^4.1.5",
77
+ "@types/jest": "^29.5.0",
78
+ "@types/lodash": "^4.14.182",
79
+ "@types/node": "^20.3.1",
80
+ "@types/sinon": "^7.5.0",
81
+ "eslint-config-msal": "^0.0.0",
82
+ "msal-test-utils": "^0.0.1",
83
+ "jest": "^29.5.0",
84
+ "lodash": "^4.17.21",
85
+ "prettier": "2.8.7",
86
+ "rimraf": "^3.0.2",
87
+ "rollup": "^3.14.0",
88
+ "shx": "^0.3.2",
89
+ "sinon": "^7.5.0",
90
+ "ts-jest": "^29.1.0",
91
+ "ts-node": "^10.9.1",
92
+ "tslib": "^1.10.0",
93
+ "typescript": "^4.9.5",
94
+ "yargs": "^17.5.1"
95
+ }
95
96
  }
@@ -15,6 +15,7 @@ import { TokenClaims } from "./TokenClaims";
15
15
  * - idToken - raw ID token
16
16
  * - idTokenClaims - Object contains claims from ID token
17
17
  * - nativeAccountId - The user's native account ID
18
+ * - tenantProfiles - Map of tenant profile objects for each tenant that the account has authenticated with in the browser
18
19
  */
19
20
  export type AccountInfo = {
20
21
  homeAccountId: string;
@@ -35,9 +36,104 @@ export type AccountInfo = {
35
36
  };
36
37
  nativeAccountId?: string;
37
38
  authorityType?: string;
39
+ tenantProfiles?: Map<string, TenantProfile>;
40
+ };
41
+
42
+ /**
43
+ * Account details that vary across tenants for the same user
44
+ */
45
+ export type TenantProfile = Pick<
46
+ AccountInfo,
47
+ "tenantId" | "localAccountId" | "name"
48
+ > & {
49
+ /**
50
+ * - isHomeTenant - True if this is the home tenant profile of the account, false if it's a guest tenant profile
51
+ */
52
+ isHomeTenant?: boolean;
38
53
  };
39
54
 
40
55
  export type ActiveAccountFilters = {
41
56
  homeAccountId: string;
42
57
  localAccountId: string;
58
+ tenantId?: string;
43
59
  };
60
+
61
+ /**
62
+ * Returns true if tenantId matches the utid portion of homeAccountId
63
+ * @param tenantId
64
+ * @param homeAccountId
65
+ * @returns
66
+ */
67
+ export function tenantIdMatchesHomeTenant(
68
+ tenantId?: string,
69
+ homeAccountId?: string
70
+ ): boolean {
71
+ return (
72
+ !!tenantId &&
73
+ !!homeAccountId &&
74
+ tenantId === homeAccountId.split(".")[1]
75
+ );
76
+ }
77
+
78
+ export function buildTenantProfileFromIdTokenClaims(
79
+ homeAccountId: string,
80
+ idTokenClaims: TokenClaims
81
+ ): TenantProfile {
82
+ const { oid, sub, tid, name, tfp, acr } = idTokenClaims;
83
+
84
+ /**
85
+ * Since there is no way to determine if the authority is AAD or B2C, we exhaust all the possible claims that can serve as tenant ID with the following precedence:
86
+ * tid - TenantID claim that identifies the tenant that issued the token in AAD. Expected in all AAD ID tokens, not present in B2C ID Tokens.
87
+ * tfp - Trust Framework Policy claim that identifies the policy that was used to authenticate the user. Functions as tenant for B2C scenarios.
88
+ * acr - Authentication Context Class Reference claim used only with older B2C policies. Fallback in case tfp is not present, but likely won't be present anyway.
89
+ */
90
+ const tenantId = tid || tfp || acr || "";
91
+
92
+ return {
93
+ tenantId: tenantId,
94
+ localAccountId: oid || sub || "",
95
+ name: name,
96
+ isHomeTenant: tenantIdMatchesHomeTenant(tenantId, homeAccountId),
97
+ };
98
+ }
99
+
100
+ /**
101
+ * Replaces account info that varies by tenant profile sourced from the ID token claims passed in with the tenant-specific account info
102
+ * @param baseAccountInfo
103
+ * @param idTokenClaims
104
+ * @returns
105
+ */
106
+ export function updateAccountTenantProfileData(
107
+ baseAccountInfo: AccountInfo,
108
+ tenantProfile?: TenantProfile,
109
+ idTokenClaims?: TokenClaims
110
+ ): AccountInfo {
111
+ let updatedAccountInfo = baseAccountInfo;
112
+ // Tenant Profile overrides passed in account info
113
+ if (tenantProfile) {
114
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
115
+ const { isHomeTenant, ...tenantProfileOverride } = tenantProfile;
116
+ updatedAccountInfo = { ...baseAccountInfo, ...tenantProfileOverride };
117
+ }
118
+
119
+ // ID token claims override passed in account info and tenant profile
120
+ if (idTokenClaims) {
121
+ // Ignore isHomeTenant, loginHint, and sid which are part of tenant profile but not base account info
122
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
123
+ const { isHomeTenant, ...claimsSourcedTenantProfile } =
124
+ buildTenantProfileFromIdTokenClaims(
125
+ baseAccountInfo.homeAccountId,
126
+ idTokenClaims
127
+ );
128
+
129
+ updatedAccountInfo = {
130
+ ...updatedAccountInfo,
131
+ ...claimsSourcedTenantProfile,
132
+ idTokenClaims: idTokenClaims,
133
+ };
134
+
135
+ return updatedAccountInfo;
136
+ }
137
+
138
+ return updatedAccountInfo;
139
+ }
@@ -7,7 +7,6 @@ import {
7
7
  createClientAuthError,
8
8
  ClientAuthErrorCodes,
9
9
  } from "../error/ClientAuthError";
10
- import { ICrypto } from "../crypto/ICrypto";
11
10
  import { Separators, Constants } from "../utils/Constants";
12
11
 
13
12
  /**
@@ -25,14 +24,14 @@ export type ClientInfo = {
25
24
  */
26
25
  export function buildClientInfo(
27
26
  rawClientInfo: string,
28
- crypto: ICrypto
27
+ base64Decode: (input: string) => string
29
28
  ): ClientInfo {
30
29
  if (!rawClientInfo) {
31
30
  throw createClientAuthError(ClientAuthErrorCodes.clientInfoEmptyError);
32
31
  }
33
32
 
34
33
  try {
35
- const decodedClientInfo: string = crypto.base64Decode(rawClientInfo);
34
+ const decodedClientInfo: string = base64Decode(rawClientInfo);
36
35
  return JSON.parse(decodedClientInfo) as ClientInfo;
37
36
  } catch (e) {
38
37
  throw createClientAuthError(
@@ -35,6 +35,14 @@ export type TokenClaims = {
35
35
  * Users' tenant or '9188040d-6c67-4c5b-b112-36a304b66dad' for personal accounts.
36
36
  */
37
37
  tid?: string;
38
+ /**
39
+ * Trusted Framework Policy (B2C) The name of the policy that was used to acquire the ID token.
40
+ */
41
+ tfp?: string;
42
+ /**
43
+ * Authentication Context Class Reference (B2C) Used only with older policies.
44
+ */
45
+ acr?: string;
38
46
  ver?: string;
39
47
  upn?: string;
40
48
  preferred_username?: string;
@@ -68,3 +76,23 @@ export type TokenClaims = {
68
76
  tenant_region_scope?: string;
69
77
  tenant_region_sub_scope?: string;
70
78
  };
79
+
80
+ /**
81
+ * Gets tenantId from available ID token claims to set as credential realm with the following precedence:
82
+ * 1. tid - if the token is acquired from an Azure AD tenant tid will be present
83
+ * 2. tfp - if the token is acquired from a modern B2C tenant tfp should be present
84
+ * 3. acr - if the token is acquired from a legacy B2C tenant acr should be present
85
+ * Downcased to match the realm case-insensitive comparison requirements
86
+ * @param idTokenClaims
87
+ * @returns
88
+ */
89
+ export function getTenantIdFromIdTokenClaims(
90
+ idTokenClaims?: TokenClaims
91
+ ): string | null {
92
+ if (idTokenClaims) {
93
+ const tenantId =
94
+ idTokenClaims.tid || idTokenClaims.tfp || idTokenClaims.acr;
95
+ return tenantId || null;
96
+ }
97
+ return null;
98
+ }
@@ -86,6 +86,8 @@ export class Authority {
86
86
  protected performanceClient: IPerformanceClient | undefined;
87
87
  // Correlation Id
88
88
  protected correlationId: string | undefined;
89
+ // Indicates if the authority is fake, for the purpose of a Managed Identity Application
90
+ private managedIdentity: boolean;
89
91
  // Reserved tenant domain names that will not be replaced with tenant id
90
92
  private static reservedTenantDomains: Set<string> = new Set([
91
93
  "{tenant}",
@@ -102,7 +104,8 @@ export class Authority {
102
104
  authorityOptions: AuthorityOptions,
103
105
  logger: Logger,
104
106
  performanceClient?: IPerformanceClient,
105
- correlationId?: string
107
+ correlationId?: string,
108
+ managedIdentity?: boolean
106
109
  ) {
107
110
  this.canonicalAuthority = authority;
108
111
  this._canonicalAuthority.validateAsUri();
@@ -117,6 +120,7 @@ export class Authority {
117
120
  this.logger = logger;
118
121
  this.performanceClient = performanceClient;
119
122
  this.correlationId = correlationId;
123
+ this.managedIdentity = managedIdentity || false;
120
124
  this.regionDiscovery = new RegionDiscovery(
121
125
  networkInterface,
122
126
  this.logger,
@@ -382,7 +386,7 @@ export class Authority {
382
386
  }
383
387
 
384
388
  /**
385
- * Boolean that returns whethr or not tenant discovery has been completed.
389
+ * Boolean that returns whether or not tenant discovery has been completed.
386
390
  */
387
391
  discoveryComplete(): boolean {
388
392
  return !!this.metadata;
@@ -1066,12 +1070,12 @@ export class Authority {
1066
1070
  const matches = this.authorityOptions.knownAuthorities.filter(
1067
1071
  (authority) => {
1068
1072
  return (
1073
+ authority &&
1069
1074
  UrlString.getDomainFromUrl(authority).toLowerCase() ===
1070
- this.hostnameAndPort
1075
+ this.hostnameAndPort
1071
1076
  );
1072
1077
  }
1073
1078
  );
1074
-
1075
1079
  return matches.length > 0;
1076
1080
  }
1077
1081
 
@@ -1119,7 +1123,9 @@ export class Authority {
1119
1123
  * helper function to generate environment from authority object
1120
1124
  */
1121
1125
  getPreferredCache(): string {
1122
- if (this.discoveryComplete()) {
1126
+ if (this.managedIdentity) {
1127
+ return Constants.DEFAULT_AUTHORITY_HOST;
1128
+ } else if (this.discoveryComplete()) {
1123
1129
  return this.metadata.preferred_cache;
1124
1130
  } else {
1125
1131
  throw createClientAuthError(
@@ -1253,6 +1259,33 @@ export class Authority {
1253
1259
  }
1254
1260
  }
1255
1261
 
1262
+ /**
1263
+ * Extract tenantId from authority
1264
+ */
1265
+ export function getTenantFromAuthorityString(
1266
+ authority: string
1267
+ ): string | undefined {
1268
+ const authorityUrl = new UrlString(authority);
1269
+ const authorityUrlComponents = authorityUrl.getUrlComponents();
1270
+ /**
1271
+ * For credential matching purposes, tenantId is the last path segment of the authority URL:
1272
+ * AAD Authority - domain/tenantId -> Credentials are cached with realm = tenantId
1273
+ * B2C Authority - domain/{tenantId}?/.../policy -> Credentials are cached with realm = policy
1274
+ * tenantId is downcased because B2C policies can have mixed case but tfp claim is downcased
1275
+ */
1276
+ const tenantId =
1277
+ authorityUrlComponents.PathSegments.slice(-1)[0].toLowerCase();
1278
+
1279
+ switch (tenantId) {
1280
+ case AADAuthorityConstants.COMMON:
1281
+ case AADAuthorityConstants.ORGANIZATIONS:
1282
+ case AADAuthorityConstants.CONSUMERS:
1283
+ return undefined;
1284
+ default:
1285
+ return tenantId;
1286
+ }
1287
+ }
1288
+
1256
1289
  export function formatAuthorityUri(authorityUri: string): string {
1257
1290
  return authorityUri.endsWith(Constants.FORWARD_SLASH)
1258
1291
  ? authorityUri