@azure/msal-common 14.0.1 → 14.0.3

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 (295) hide show
  1. package/dist/account/AuthToken.d.ts +14 -17
  2. package/dist/account/AuthToken.d.ts.map +1 -1
  3. package/dist/account/AuthToken.mjs +48 -39
  4. package/dist/account/AuthToken.mjs.map +1 -1
  5. package/dist/account/CcsCredential.mjs +1 -1
  6. package/dist/account/CcsCredential.mjs.map +1 -1
  7. package/dist/account/ClientInfo.d.ts.map +1 -1
  8. package/dist/account/ClientInfo.mjs +3 -4
  9. package/dist/account/ClientInfo.mjs.map +1 -1
  10. package/dist/authority/Authority.d.ts +1 -0
  11. package/dist/authority/Authority.d.ts.map +1 -1
  12. package/dist/authority/Authority.mjs +4 -2
  13. package/dist/authority/Authority.mjs.map +1 -1
  14. package/dist/authority/AuthorityFactory.d.ts +1 -0
  15. package/dist/authority/AuthorityFactory.d.ts.map +1 -1
  16. package/dist/authority/AuthorityFactory.mjs +3 -3
  17. package/dist/authority/AuthorityFactory.mjs.map +1 -1
  18. package/dist/authority/AuthorityMetadata.mjs +1 -1
  19. package/dist/authority/AuthorityMetadata.mjs.map +1 -1
  20. package/dist/authority/AuthorityOptions.mjs +1 -1
  21. package/dist/authority/AuthorityOptions.mjs.map +1 -1
  22. package/dist/authority/AuthorityType.mjs +1 -1
  23. package/dist/authority/AuthorityType.mjs.map +1 -1
  24. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  25. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs.map +1 -1
  26. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  27. package/dist/authority/CloudInstanceDiscoveryResponse.mjs.map +1 -1
  28. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  29. package/dist/authority/OpenIdConfigResponse.mjs.map +1 -1
  30. package/dist/authority/ProtocolMode.mjs +1 -1
  31. package/dist/authority/ProtocolMode.mjs.map +1 -1
  32. package/dist/authority/RegionDiscovery.mjs +1 -1
  33. package/dist/authority/RegionDiscovery.mjs.map +1 -1
  34. package/dist/cache/CacheManager.d.ts +2 -0
  35. package/dist/cache/CacheManager.d.ts.map +1 -1
  36. package/dist/cache/CacheManager.mjs +7 -5
  37. package/dist/cache/CacheManager.mjs.map +1 -1
  38. package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
  39. package/dist/cache/entities/AccessTokenEntity.mjs +4 -7
  40. package/dist/cache/entities/AccessTokenEntity.mjs.map +1 -1
  41. package/dist/cache/entities/AccountEntity.d.ts +1 -0
  42. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  43. package/dist/cache/entities/AccountEntity.mjs +3 -4
  44. package/dist/cache/entities/AccountEntity.mjs.map +1 -1
  45. package/dist/cache/entities/AppMetadataEntity.mjs +1 -1
  46. package/dist/cache/entities/AppMetadataEntity.mjs.map +1 -1
  47. package/dist/cache/entities/AuthorityMetadataEntity.d.ts +1 -0
  48. package/dist/cache/entities/AuthorityMetadataEntity.d.ts.map +1 -1
  49. package/dist/cache/entities/AuthorityMetadataEntity.mjs +2 -1
  50. package/dist/cache/entities/AuthorityMetadataEntity.mjs.map +1 -1
  51. package/dist/cache/entities/CacheRecord.d.ts +1 -0
  52. package/dist/cache/entities/CacheRecord.d.ts.map +1 -1
  53. package/dist/cache/entities/CacheRecord.mjs +2 -1
  54. package/dist/cache/entities/CacheRecord.mjs.map +1 -1
  55. package/dist/cache/entities/CredentialEntity.mjs +1 -1
  56. package/dist/cache/entities/CredentialEntity.mjs.map +1 -1
  57. package/dist/cache/entities/IdTokenEntity.mjs +1 -1
  58. package/dist/cache/entities/IdTokenEntity.mjs.map +1 -1
  59. package/dist/cache/entities/RefreshTokenEntity.mjs +1 -1
  60. package/dist/cache/entities/RefreshTokenEntity.mjs.map +1 -1
  61. package/dist/cache/entities/ServerTelemetryEntity.mjs +1 -1
  62. package/dist/cache/entities/ServerTelemetryEntity.mjs.map +1 -1
  63. package/dist/cache/entities/ThrottlingEntity.mjs +1 -1
  64. package/dist/cache/entities/ThrottlingEntity.mjs.map +1 -1
  65. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  66. package/dist/cache/persistence/TokenCacheContext.mjs.map +1 -1
  67. package/dist/cache/utils/CacheTypes.d.ts +7 -0
  68. package/dist/cache/utils/CacheTypes.d.ts.map +1 -1
  69. package/dist/client/AuthorizationCodeClient.d.ts +1 -0
  70. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  71. package/dist/client/AuthorizationCodeClient.mjs +11 -39
  72. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  73. package/dist/client/BaseClient.d.ts +2 -1
  74. package/dist/client/BaseClient.d.ts.map +1 -1
  75. package/dist/client/BaseClient.mjs +9 -2
  76. package/dist/client/BaseClient.mjs.map +1 -1
  77. package/dist/client/RefreshTokenClient.d.ts +1 -0
  78. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  79. package/dist/client/RefreshTokenClient.mjs +3 -11
  80. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  81. package/dist/client/SilentFlowClient.d.ts +1 -0
  82. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  83. package/dist/client/SilentFlowClient.mjs +8 -7
  84. package/dist/client/SilentFlowClient.mjs.map +1 -1
  85. package/dist/config/ClientConfiguration.d.ts +2 -0
  86. package/dist/config/ClientConfiguration.d.ts.map +1 -1
  87. package/dist/config/ClientConfiguration.mjs +1 -1
  88. package/dist/config/ClientConfiguration.mjs.map +1 -1
  89. package/dist/crypto/ICrypto.mjs +1 -1
  90. package/dist/crypto/ICrypto.mjs.map +1 -1
  91. package/dist/crypto/JoseHeader.d.ts +1 -0
  92. package/dist/crypto/JoseHeader.d.ts.map +1 -1
  93. package/dist/crypto/JoseHeader.mjs +2 -1
  94. package/dist/crypto/JoseHeader.mjs.map +1 -1
  95. package/dist/crypto/PopTokenGenerator.d.ts +1 -0
  96. package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
  97. package/dist/crypto/PopTokenGenerator.mjs +2 -1
  98. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  99. package/dist/error/AuthError.mjs +1 -1
  100. package/dist/error/AuthError.mjs.map +1 -1
  101. package/dist/error/ClientAuthError.mjs +1 -1
  102. package/dist/error/ClientAuthError.mjs.map +1 -1
  103. package/dist/error/ClientConfigurationError.mjs +1 -1
  104. package/dist/error/ClientConfigurationError.mjs.map +1 -1
  105. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  106. package/dist/error/InteractionRequiredAuthError.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/ServerError.mjs +1 -1
  110. package/dist/error/ServerError.mjs.map +1 -1
  111. package/dist/index.cjs +1926 -1826
  112. package/dist/index.cjs.map +1 -1
  113. package/dist/index.d.ts +4 -3
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.mjs +5 -3
  116. package/dist/index.mjs.map +1 -1
  117. package/dist/logger/Logger.d.ts.map +1 -1
  118. package/dist/logger/Logger.mjs +2 -12
  119. package/dist/logger/Logger.mjs.map +1 -1
  120. package/dist/network/INetworkModule.mjs +1 -1
  121. package/dist/network/INetworkModule.mjs.map +1 -1
  122. package/dist/network/NetworkManager.d.ts +1 -0
  123. package/dist/network/NetworkManager.d.ts.map +1 -1
  124. package/dist/network/NetworkManager.mjs +2 -1
  125. package/dist/network/NetworkManager.mjs.map +1 -1
  126. package/dist/network/ThrottlingUtils.d.ts +1 -0
  127. package/dist/network/ThrottlingUtils.d.ts.map +1 -1
  128. package/dist/network/ThrottlingUtils.mjs +2 -1
  129. package/dist/network/ThrottlingUtils.mjs.map +1 -1
  130. package/dist/packageMetadata.d.ts +1 -1
  131. package/dist/packageMetadata.mjs +2 -2
  132. package/dist/packageMetadata.mjs.map +1 -1
  133. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  134. package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
  135. package/dist/request/RequestParameterBuilder.d.ts +1 -0
  136. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  137. package/dist/request/RequestParameterBuilder.mjs +7 -7
  138. package/dist/request/RequestParameterBuilder.mjs.map +1 -1
  139. package/dist/request/RequestValidator.d.ts.map +1 -1
  140. package/dist/request/RequestValidator.mjs +4 -6
  141. package/dist/request/RequestValidator.mjs.map +1 -1
  142. package/dist/request/ScopeSet.mjs +4 -4
  143. package/dist/request/ScopeSet.mjs.map +1 -1
  144. package/dist/response/AuthenticationResult.d.ts +3 -1
  145. package/dist/response/AuthenticationResult.d.ts.map +1 -1
  146. package/dist/response/ResponseHandler.d.ts +5 -3
  147. package/dist/response/ResponseHandler.d.ts.map +1 -1
  148. package/dist/response/ResponseHandler.mjs +58 -39
  149. package/dist/response/ResponseHandler.mjs.map +1 -1
  150. package/dist/response/ServerAuthorizationTokenResponse.d.ts +2 -0
  151. package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
  152. package/dist/telemetry/performance/IPerformanceClient.d.ts +4 -4
  153. package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  154. package/dist/telemetry/performance/PerformanceClient.d.ts +2 -2
  155. package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  156. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  157. package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
  158. package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -1
  159. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  160. package/dist/telemetry/performance/PerformanceEvent.mjs +9 -1
  161. package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
  162. package/dist/telemetry/performance/StubPerformanceClient.d.ts +3 -3
  163. package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
  164. package/dist/telemetry/performance/StubPerformanceClient.mjs +23 -3
  165. package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
  166. package/dist/telemetry/server/ServerTelemetryManager.d.ts +1 -0
  167. package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
  168. package/dist/telemetry/server/ServerTelemetryManager.mjs +4 -4
  169. package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
  170. package/dist/url/UrlString.d.ts.map +1 -1
  171. package/dist/url/UrlString.mjs +10 -12
  172. package/dist/url/UrlString.mjs.map +1 -1
  173. package/dist/utils/Constants.d.ts +10 -0
  174. package/dist/utils/Constants.d.ts.map +1 -1
  175. package/dist/utils/Constants.mjs +11 -2
  176. package/dist/utils/Constants.mjs.map +1 -1
  177. package/dist/utils/FunctionWrappers.d.ts +28 -0
  178. package/dist/utils/FunctionWrappers.d.ts.map +1 -0
  179. package/dist/utils/FunctionWrappers.mjs +90 -0
  180. package/dist/utils/FunctionWrappers.mjs.map +1 -0
  181. package/dist/utils/ProtocolUtils.d.ts.map +1 -1
  182. package/dist/utils/ProtocolUtils.mjs +4 -7
  183. package/dist/utils/ProtocolUtils.mjs.map +1 -1
  184. package/dist/utils/StringUtils.d.ts +0 -13
  185. package/dist/utils/StringUtils.d.ts.map +1 -1
  186. package/dist/utils/StringUtils.mjs +3 -34
  187. package/dist/utils/StringUtils.mjs.map +1 -1
  188. package/dist/utils/TimeUtils.mjs +1 -1
  189. package/dist/utils/TimeUtils.mjs.map +1 -1
  190. package/package.json +6 -4
  191. package/src/account/AccountInfo.ts +44 -0
  192. package/src/account/AuthToken.ts +70 -0
  193. package/src/account/CcsCredential.ts +16 -0
  194. package/src/account/ClientCredentials.ts +20 -0
  195. package/src/account/ClientInfo.ts +64 -0
  196. package/src/account/TokenClaims.ts +70 -0
  197. package/src/authority/Authority.ts +1225 -0
  198. package/src/authority/AuthorityFactory.ts +106 -0
  199. package/src/authority/AuthorityMetadata.ts +953 -0
  200. package/src/authority/AuthorityOptions.ts +40 -0
  201. package/src/authority/AuthorityType.ts +15 -0
  202. package/src/authority/AzureRegion.ts +7 -0
  203. package/src/authority/AzureRegionConfiguration.ts +16 -0
  204. package/src/authority/CloudDiscoveryMetadata.ts +10 -0
  205. package/src/authority/CloudInstanceDiscoveryErrorResponse.ts +26 -0
  206. package/src/authority/CloudInstanceDiscoveryResponse.ts +21 -0
  207. package/src/authority/ImdsOptions.ts +10 -0
  208. package/src/authority/OIDCOptions.ts +14 -0
  209. package/src/authority/OpenIdConfigResponse.ts +24 -0
  210. package/src/authority/ProtocolMode.ts +13 -0
  211. package/src/authority/RegionDiscovery.ts +193 -0
  212. package/src/authority/RegionDiscoveryMetadata.ts +15 -0
  213. package/src/broker/nativeBroker/INativeBrokerPlugin.ts +29 -0
  214. package/src/cache/CacheManager.ts +1619 -0
  215. package/src/cache/entities/AccessTokenEntity.ts +162 -0
  216. package/src/cache/entities/AccountEntity.ts +309 -0
  217. package/src/cache/entities/AppMetadataEntity.ts +91 -0
  218. package/src/cache/entities/AuthorityMetadataEntity.ts +112 -0
  219. package/src/cache/entities/CacheRecord.ts +33 -0
  220. package/src/cache/entities/CredentialEntity.ts +215 -0
  221. package/src/cache/entities/IdTokenEntity.ts +74 -0
  222. package/src/cache/entities/RefreshTokenEntity.ts +78 -0
  223. package/src/cache/entities/ServerTelemetryEntity.ts +38 -0
  224. package/src/cache/entities/ThrottlingEntity.ts +36 -0
  225. package/src/cache/interface/ICacheManager.ts +218 -0
  226. package/src/cache/interface/ICachePlugin.ts +11 -0
  227. package/src/cache/interface/ISerializableTokenCache.ts +9 -0
  228. package/src/cache/persistence/TokenCacheContext.ts +39 -0
  229. package/src/cache/utils/CacheTypes.ts +93 -0
  230. package/src/client/AuthorizationCodeClient.ts +714 -0
  231. package/src/client/BaseClient.ts +205 -0
  232. package/src/client/RefreshTokenClient.ts +442 -0
  233. package/src/client/SilentFlowClient.ts +186 -0
  234. package/src/config/AppTokenProvider.ts +47 -0
  235. package/src/config/ClientConfiguration.ts +287 -0
  236. package/src/crypto/ICrypto.ts +127 -0
  237. package/src/crypto/IGuidGenerator.ts +9 -0
  238. package/src/crypto/JoseHeader.ts +55 -0
  239. package/src/crypto/PopTokenGenerator.ts +155 -0
  240. package/src/crypto/SignedHttpRequest.ts +16 -0
  241. package/src/error/AuthError.ts +85 -0
  242. package/src/error/ClientAuthError.ts +738 -0
  243. package/src/error/ClientConfigurationError.ts +396 -0
  244. package/src/error/InteractionRequiredAuthError.ts +134 -0
  245. package/src/error/JoseHeaderError.ts +52 -0
  246. package/src/error/ServerError.ts +18 -0
  247. package/src/index.ts +215 -0
  248. package/src/logger/Logger.ts +272 -0
  249. package/src/network/INetworkModule.ts +57 -0
  250. package/src/network/NetworkManager.ts +76 -0
  251. package/src/network/RequestThumbprint.ts +22 -0
  252. package/src/network/ThrottlingUtils.ts +156 -0
  253. package/src/packageMetadata.ts +3 -0
  254. package/src/request/AuthenticationHeaderParser.ts +89 -0
  255. package/src/request/BaseAuthRequest.ts +46 -0
  256. package/src/request/CommonAuthorizationCodeRequest.ts +33 -0
  257. package/src/request/CommonAuthorizationUrlRequest.ts +56 -0
  258. package/src/request/CommonClientCredentialRequest.ts +23 -0
  259. package/src/request/CommonDeviceCodeRequest.ts +31 -0
  260. package/src/request/CommonEndSessionRequest.ts +27 -0
  261. package/src/request/CommonOnBehalfOfRequest.ts +19 -0
  262. package/src/request/CommonRefreshTokenRequest.ts +25 -0
  263. package/src/request/CommonSilentFlowRequest.ts +24 -0
  264. package/src/request/CommonUsernamePasswordRequest.ts +23 -0
  265. package/src/request/NativeRequest.ts +25 -0
  266. package/src/request/NativeSignOutRequest.ts +10 -0
  267. package/src/request/RequestParameterBuilder.ts +606 -0
  268. package/src/request/RequestValidator.ts +103 -0
  269. package/src/request/ScopeSet.ts +230 -0
  270. package/src/request/StoreInCache.ts +16 -0
  271. package/src/response/AuthenticationResult.ts +47 -0
  272. package/src/response/AuthorizationCodePayload.ts +18 -0
  273. package/src/response/DeviceCodeResponse.ts +31 -0
  274. package/src/response/ExternalTokenResponse.ts +24 -0
  275. package/src/response/IMDSBadResponse.ts +9 -0
  276. package/src/response/ResponseHandler.ts +614 -0
  277. package/src/response/ServerAuthorizationCodeResponse.ts +33 -0
  278. package/src/response/ServerAuthorizationTokenResponse.ts +54 -0
  279. package/src/telemetry/performance/IPerformanceClient.ts +71 -0
  280. package/src/telemetry/performance/IPerformanceMeasurement.ts +10 -0
  281. package/src/telemetry/performance/PerformanceClient.ts +635 -0
  282. package/src/telemetry/performance/PerformanceEvent.ts +542 -0
  283. package/src/telemetry/performance/StubPerformanceClient.ts +101 -0
  284. package/src/telemetry/server/ServerTelemetryManager.ts +274 -0
  285. package/src/telemetry/server/ServerTelemetryRequest.ts +13 -0
  286. package/src/url/IUri.ts +17 -0
  287. package/src/url/UrlString.ts +363 -0
  288. package/src/utils/Constants.ts +436 -0
  289. package/src/utils/FunctionWrappers.ts +105 -0
  290. package/src/utils/MsalTypes.ts +9 -0
  291. package/src/utils/ProtocolUtils.ts +124 -0
  292. package/src/utils/StringUtils.ts +106 -0
  293. package/src/utils/TimeUtils.ts +51 -0
  294. package/dist/account/DecodedAuthToken.d.ts +0 -9
  295. package/dist/account/DecodedAuthToken.d.ts.map +0 -1
@@ -1,7 +1,5 @@
1
- /*! @azure/msal-common v14.0.1 2023-08-11 */
1
+ /*! @azure/msal-common v14.0.3 2023-09-05 */
2
2
  'use strict';
3
- import { ClientAuthError } from '../error/ClientAuthError.mjs';
4
-
5
3
  /*
6
4
  * Copyright (c) Microsoft Corporation. All rights reserved.
7
5
  * Licensed under the MIT License.
@@ -10,41 +8,12 @@ import { ClientAuthError } from '../error/ClientAuthError.mjs';
10
8
  * @hidden
11
9
  */
12
10
  class StringUtils {
13
- /**
14
- * decode a JWT
15
- *
16
- * @param authToken
17
- */
18
- static decodeAuthToken(authToken) {
19
- if (StringUtils.isEmpty(authToken)) {
20
- throw ClientAuthError.createTokenNullOrEmptyError(authToken);
21
- }
22
- const tokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/;
23
- const matches = tokenPartsRegex.exec(authToken);
24
- if (!matches || matches.length < 4) {
25
- throw ClientAuthError.createTokenParsingError(`Given token is malformed: ${JSON.stringify(authToken)}`);
26
- }
27
- const crackedToken = {
28
- header: matches[1],
29
- JWSPayload: matches[2],
30
- JWSSig: matches[3],
31
- };
32
- return crackedToken;
33
- }
34
- /**
35
- * Check if a string is empty.
36
- *
37
- * @param str
38
- */
39
- static isEmpty(str) {
40
- return typeof str === "undefined" || !str || 0 === str.length;
41
- }
42
11
  /**
43
12
  * Check if stringified object is empty
44
13
  * @param strObj
45
14
  */
46
15
  static isEmptyObj(strObj) {
47
- if (strObj && !StringUtils.isEmpty(strObj)) {
16
+ if (strObj) {
48
17
  try {
49
18
  const obj = JSON.parse(strObj);
50
19
  return Object.keys(obj).length === 0;
@@ -93,7 +62,7 @@ class StringUtils {
93
62
  */
94
63
  static removeEmptyStringsFromArray(arr) {
95
64
  return arr.filter((entry) => {
96
- return !StringUtils.isEmpty(entry);
65
+ return !!entry;
97
66
  });
98
67
  }
99
68
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"StringUtils.mjs","sources":["../../src/utils/StringUtils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AAKH;;AAEG;MACU,WAAW,CAAA;AACpB;;;;AAIG;IACH,OAAO,eAAe,CAAC,SAAiB,EAAA;AACpC,QAAA,IAAI,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;AAChC,YAAA,MAAM,eAAe,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC;AAChE,SAAA;QACD,MAAM,eAAe,GAAG,sCAAsC,CAAC;QAC/D,MAAM,OAAO,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;AAChC,YAAA,MAAM,eAAe,CAAC,uBAAuB,CACzC,CAA6B,0BAAA,EAAA,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA,CAA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 @@
1
- /*! @azure/msal-common v14.0.1 2023-08-11 */
1
+ /*! @azure/msal-common v14.0.3 2023-09-05 */
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":";;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
+ {"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;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
12
12
  },
13
- "version": "14.0.1",
13
+ "version": "14.0.3",
14
14
  "description": "Microsoft Authentication Library for js",
15
15
  "keywords": [
16
16
  "implicit",
@@ -41,13 +41,14 @@
41
41
  "test": "test"
42
42
  },
43
43
  "files": [
44
- "dist"
44
+ "dist",
45
+ "src"
45
46
  ],
46
47
  "scripts": {
47
48
  "clean": "shx rm -rf dist lib",
48
49
  "clean:coverage": "rimraf ../../.nyc_output/*",
49
- "lint": "cd ../../ && npm run lint:common",
50
- "lint:fix": "npm run lint -- -- --fix",
50
+ "lint": "eslint src --ext .ts",
51
+ "lint:fix": "npm run lint -- --fix",
51
52
  "test": "jest",
52
53
  "test:coverage": "jest --coverage",
53
54
  "test:coverage:only": "npm run clean:coverage && npm run test:coverage",
@@ -77,6 +78,7 @@
77
78
  "@types/lodash": "^4.14.182",
78
79
  "@types/node": "^20.3.1",
79
80
  "@types/sinon": "^7.5.0",
81
+ "eslint-config-msal": "^0.0.0",
80
82
  "jest": "^29.5.0",
81
83
  "lodash": "^4.17.21",
82
84
  "prettier": "2.8.7",
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { TokenClaims } from "./TokenClaims";
7
+ /**
8
+ * Account object with the following signature:
9
+ * - homeAccountId - Home account identifier for this account object
10
+ * - environment - Entity which issued the token represented by the domain of the issuer (e.g. login.microsoftonline.com)
11
+ * - tenantId - Full tenant or organizational id that this account belongs to
12
+ * - username - preferred_username claim of the id_token that represents this account
13
+ * - localAccountId - Local, tenant-specific account identifer for this account object, usually used in legacy cases
14
+ * - name - Full name for the account, including given name and family name
15
+ * - idToken - raw ID token
16
+ * - idTokenClaims - Object contains claims from ID token
17
+ * - localAccountId - The user's account ID
18
+ * - nativeAccountId - The user's native account ID
19
+ */
20
+ export type AccountInfo = {
21
+ homeAccountId: string;
22
+ environment: string;
23
+ tenantId: string;
24
+ username: string;
25
+ localAccountId: string;
26
+ name?: string;
27
+ idToken?: string;
28
+ idTokenClaims?: TokenClaims & {
29
+ [key: string]:
30
+ | string
31
+ | number
32
+ | string[]
33
+ | object
34
+ | undefined
35
+ | unknown;
36
+ };
37
+ nativeAccountId?: string;
38
+ authorityType?: string;
39
+ };
40
+
41
+ export type ActiveAccountFilters = {
42
+ homeAccountId: string;
43
+ localAccountId: string;
44
+ };
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { TokenClaims } from "./TokenClaims";
7
+ import { ClientAuthError } from "../error/ClientAuthError";
8
+
9
+ /**
10
+ * Extract token by decoding the rawToken
11
+ *
12
+ * @param encodedToken
13
+ */
14
+ export function extractTokenClaims(
15
+ encodedToken: string,
16
+ base64Decode: (input: string) => string
17
+ ): TokenClaims {
18
+ const jswPayload = getJWSPayload(encodedToken);
19
+
20
+ // token will be decoded to get the username
21
+ try {
22
+ // base64Decode() should throw an error if there is an issue
23
+ const base64Decoded = base64Decode(jswPayload);
24
+ return JSON.parse(base64Decoded) as TokenClaims;
25
+ } catch (err) {
26
+ throw ClientAuthError.createTokenParsingError(err as string);
27
+ }
28
+ }
29
+
30
+ /**
31
+ * decode a JWT
32
+ *
33
+ * @param authToken
34
+ */
35
+ export function getJWSPayload(authToken: string): string {
36
+ if (!authToken) {
37
+ throw ClientAuthError.createTokenNullOrEmptyError(authToken);
38
+ }
39
+ const tokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/;
40
+ const matches = tokenPartsRegex.exec(authToken);
41
+ if (!matches || matches.length < 4) {
42
+ throw ClientAuthError.createTokenParsingError(
43
+ `Given token is malformed: ${JSON.stringify(authToken)}`
44
+ );
45
+ }
46
+ /**
47
+ * const crackedToken = {
48
+ * header: matches[1],
49
+ * JWSPayload: matches[2],
50
+ * JWSSig: matches[3],
51
+ * };
52
+ */
53
+
54
+ return matches[2];
55
+ }
56
+
57
+ /**
58
+ * Determine if the token's max_age has transpired
59
+ */
60
+ export function checkMaxAge(authTime: number, maxAge: number): void {
61
+ /*
62
+ * per https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
63
+ * To force an immediate re-authentication: If an app requires that a user re-authenticate prior to access,
64
+ * provide a value of 0 for the max_age parameter and the AS will force a fresh login.
65
+ */
66
+ const fiveMinuteSkew = 300000; // five minutes in milliseconds
67
+ if (maxAge === 0 || Date.now() - fiveMinuteSkew > authTime + maxAge) {
68
+ throw ClientAuthError.createMaxAgeTranspiredError();
69
+ }
70
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ export type CcsCredential = {
7
+ credential: string;
8
+ type: CcsCredentialType;
9
+ };
10
+
11
+ export const CcsCredentialType = {
12
+ HOME_ACCOUNT_ID: "home_account_id",
13
+ UPN: "UPN",
14
+ } as const;
15
+ export type CcsCredentialType =
16
+ (typeof CcsCredentialType)[keyof typeof CcsCredentialType];
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Client Assertion credential for Confidential Clients
8
+ */
9
+ export type ClientAssertion = {
10
+ assertion: string;
11
+ assertionType: string;
12
+ };
13
+
14
+ /**
15
+ * Client Credentials set for Confidential Clients
16
+ */
17
+ export type ClientCredentials = {
18
+ clientSecret?: string;
19
+ clientAssertion?: ClientAssertion;
20
+ };
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { ClientAuthError } from "../error/ClientAuthError";
7
+ import { ICrypto } from "../crypto/ICrypto";
8
+ import { Separators, Constants } from "../utils/Constants";
9
+
10
+ /**
11
+ * Client info object which consists of two IDs. Need to add more info here.
12
+ */
13
+ export type ClientInfo = {
14
+ uid: string;
15
+ utid: string;
16
+ };
17
+
18
+ /**
19
+ * Function to build a client info object from server clientInfo string
20
+ * @param rawClientInfo
21
+ * @param crypto
22
+ */
23
+ export function buildClientInfo(
24
+ rawClientInfo: string,
25
+ crypto: ICrypto
26
+ ): ClientInfo {
27
+ if (!rawClientInfo) {
28
+ throw ClientAuthError.createClientInfoEmptyError();
29
+ }
30
+
31
+ try {
32
+ const decodedClientInfo: string = crypto.base64Decode(rawClientInfo);
33
+ return JSON.parse(decodedClientInfo) as ClientInfo;
34
+ } catch (e) {
35
+ throw ClientAuthError.createClientInfoDecodingError(
36
+ (e as ClientAuthError).message
37
+ );
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Function to build a client info object from cached homeAccountId string
43
+ * @param homeAccountId
44
+ */
45
+ export function buildClientInfoFromHomeAccountId(
46
+ homeAccountId: string
47
+ ): ClientInfo {
48
+ if (!homeAccountId) {
49
+ throw ClientAuthError.createClientInfoDecodingError(
50
+ "Home account ID was empty."
51
+ );
52
+ }
53
+ const clientInfoParts: string[] = homeAccountId.split(
54
+ Separators.CLIENT_INFO_SEPARATOR,
55
+ 2
56
+ );
57
+ return {
58
+ uid: clientInfoParts[0],
59
+ utid:
60
+ clientInfoParts.length < 2
61
+ ? Constants.EMPTY_STRING
62
+ : clientInfoParts[1],
63
+ };
64
+ }
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Type which describes Id Token claims known by MSAL.
8
+ */
9
+ export type TokenClaims = {
10
+ /**
11
+ * Audience
12
+ */
13
+ aud?: string;
14
+ /**
15
+ * Issuer
16
+ */
17
+ iss?: string;
18
+ /**
19
+ * Issued at
20
+ */
21
+ iat?: number;
22
+ /**
23
+ * Not valid before
24
+ */
25
+ nbf?: number;
26
+ /**
27
+ * Immutable object identifier, this ID uniquely identifies the user across applications
28
+ */
29
+ oid?: string;
30
+ /**
31
+ * Immutable subject identifier, this is a pairwise identifier - it is unique to a particular application ID
32
+ */
33
+ sub?: string;
34
+ /**
35
+ * Users' tenant or '9188040d-6c67-4c5b-b112-36a304b66dad' for personal accounts.
36
+ */
37
+ tid?: string;
38
+ ver?: string;
39
+ upn?: string;
40
+ preferred_username?: string;
41
+ login_hint?: string;
42
+ emails?: string[];
43
+ name?: string;
44
+ nonce?: string;
45
+ /**
46
+ * Expiration
47
+ */
48
+ exp?: number;
49
+ home_oid?: string;
50
+ sid?: string;
51
+ cloud_instance_host_name?: string;
52
+ cnf?: {
53
+ kid: string;
54
+ };
55
+ x5c_ca?: string[];
56
+ ts?: number;
57
+ at?: string;
58
+ u?: string;
59
+ p?: string;
60
+ m?: string;
61
+ roles?: string[];
62
+ amr?: string[];
63
+ idp?: string;
64
+ auth_time?: number;
65
+ /**
66
+ * Region of the resource tenant
67
+ */
68
+ tenant_region_scope?: string;
69
+ tenant_region_sub_scope?: string;
70
+ };