@azure/msal-common 14.0.2 → 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 (269) 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.mjs +1 -1
  11. package/dist/authority/Authority.mjs.map +1 -1
  12. package/dist/authority/AuthorityFactory.d.ts.map +1 -1
  13. package/dist/authority/AuthorityFactory.mjs +2 -3
  14. package/dist/authority/AuthorityFactory.mjs.map +1 -1
  15. package/dist/authority/AuthorityMetadata.mjs +1 -1
  16. package/dist/authority/AuthorityMetadata.mjs.map +1 -1
  17. package/dist/authority/AuthorityOptions.mjs +1 -1
  18. package/dist/authority/AuthorityOptions.mjs.map +1 -1
  19. package/dist/authority/AuthorityType.mjs +1 -1
  20. package/dist/authority/AuthorityType.mjs.map +1 -1
  21. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  22. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs.map +1 -1
  23. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  24. package/dist/authority/CloudInstanceDiscoveryResponse.mjs.map +1 -1
  25. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  26. package/dist/authority/OpenIdConfigResponse.mjs.map +1 -1
  27. package/dist/authority/ProtocolMode.mjs +1 -1
  28. package/dist/authority/ProtocolMode.mjs.map +1 -1
  29. package/dist/authority/RegionDiscovery.mjs +1 -1
  30. package/dist/authority/RegionDiscovery.mjs.map +1 -1
  31. package/dist/cache/CacheManager.d.ts.map +1 -1
  32. package/dist/cache/CacheManager.mjs +5 -5
  33. package/dist/cache/CacheManager.mjs.map +1 -1
  34. package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -1
  35. package/dist/cache/entities/AccessTokenEntity.mjs +4 -7
  36. package/dist/cache/entities/AccessTokenEntity.mjs.map +1 -1
  37. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  38. package/dist/cache/entities/AccountEntity.mjs +2 -4
  39. package/dist/cache/entities/AccountEntity.mjs.map +1 -1
  40. package/dist/cache/entities/AppMetadataEntity.mjs +1 -1
  41. package/dist/cache/entities/AppMetadataEntity.mjs.map +1 -1
  42. package/dist/cache/entities/AuthorityMetadataEntity.mjs +1 -1
  43. package/dist/cache/entities/AuthorityMetadataEntity.mjs.map +1 -1
  44. package/dist/cache/entities/CacheRecord.mjs +1 -1
  45. package/dist/cache/entities/CacheRecord.mjs.map +1 -1
  46. package/dist/cache/entities/CredentialEntity.mjs +1 -1
  47. package/dist/cache/entities/CredentialEntity.mjs.map +1 -1
  48. package/dist/cache/entities/IdTokenEntity.mjs +1 -1
  49. package/dist/cache/entities/IdTokenEntity.mjs.map +1 -1
  50. package/dist/cache/entities/RefreshTokenEntity.mjs +1 -1
  51. package/dist/cache/entities/RefreshTokenEntity.mjs.map +1 -1
  52. package/dist/cache/entities/ServerTelemetryEntity.mjs +1 -1
  53. package/dist/cache/entities/ServerTelemetryEntity.mjs.map +1 -1
  54. package/dist/cache/entities/ThrottlingEntity.mjs +1 -1
  55. package/dist/cache/entities/ThrottlingEntity.mjs.map +1 -1
  56. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  57. package/dist/cache/persistence/TokenCacheContext.mjs.map +1 -1
  58. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  59. package/dist/client/AuthorizationCodeClient.mjs +10 -39
  60. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  61. package/dist/client/BaseClient.d.ts +1 -1
  62. package/dist/client/BaseClient.d.ts.map +1 -1
  63. package/dist/client/BaseClient.mjs +8 -2
  64. package/dist/client/BaseClient.mjs.map +1 -1
  65. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  66. package/dist/client/RefreshTokenClient.mjs +2 -11
  67. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  68. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  69. package/dist/client/SilentFlowClient.mjs +7 -7
  70. package/dist/client/SilentFlowClient.mjs.map +1 -1
  71. package/dist/config/ClientConfiguration.mjs +1 -1
  72. package/dist/config/ClientConfiguration.mjs.map +1 -1
  73. package/dist/crypto/ICrypto.mjs +1 -1
  74. package/dist/crypto/ICrypto.mjs.map +1 -1
  75. package/dist/crypto/JoseHeader.mjs +1 -1
  76. package/dist/crypto/JoseHeader.mjs.map +1 -1
  77. package/dist/crypto/PopTokenGenerator.mjs +1 -1
  78. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  79. package/dist/error/AuthError.mjs +1 -1
  80. package/dist/error/AuthError.mjs.map +1 -1
  81. package/dist/error/ClientAuthError.mjs +1 -1
  82. package/dist/error/ClientAuthError.mjs.map +1 -1
  83. package/dist/error/ClientConfigurationError.mjs +1 -1
  84. package/dist/error/ClientConfigurationError.mjs.map +1 -1
  85. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  86. package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
  87. package/dist/error/JoseHeaderError.mjs +1 -1
  88. package/dist/error/JoseHeaderError.mjs.map +1 -1
  89. package/dist/error/ServerError.mjs +1 -1
  90. package/dist/error/ServerError.mjs.map +1 -1
  91. package/dist/index.cjs +1641 -1560
  92. package/dist/index.cjs.map +1 -1
  93. package/dist/index.d.ts +3 -3
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.mjs +5 -3
  96. package/dist/index.mjs.map +1 -1
  97. package/dist/logger/Logger.d.ts.map +1 -1
  98. package/dist/logger/Logger.mjs +2 -12
  99. package/dist/logger/Logger.mjs.map +1 -1
  100. package/dist/network/INetworkModule.mjs +1 -1
  101. package/dist/network/INetworkModule.mjs.map +1 -1
  102. package/dist/network/NetworkManager.mjs +1 -1
  103. package/dist/network/NetworkManager.mjs.map +1 -1
  104. package/dist/network/ThrottlingUtils.mjs +1 -1
  105. package/dist/network/ThrottlingUtils.mjs.map +1 -1
  106. package/dist/packageMetadata.d.ts +1 -1
  107. package/dist/packageMetadata.mjs +2 -2
  108. package/dist/packageMetadata.mjs.map +1 -1
  109. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  110. package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
  111. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  112. package/dist/request/RequestParameterBuilder.mjs +6 -7
  113. package/dist/request/RequestParameterBuilder.mjs.map +1 -1
  114. package/dist/request/RequestValidator.d.ts.map +1 -1
  115. package/dist/request/RequestValidator.mjs +4 -6
  116. package/dist/request/RequestValidator.mjs.map +1 -1
  117. package/dist/request/ScopeSet.mjs +4 -4
  118. package/dist/request/ScopeSet.mjs.map +1 -1
  119. package/dist/response/AuthenticationResult.d.ts +3 -1
  120. package/dist/response/AuthenticationResult.d.ts.map +1 -1
  121. package/dist/response/ResponseHandler.d.ts +4 -3
  122. package/dist/response/ResponseHandler.d.ts.map +1 -1
  123. package/dist/response/ResponseHandler.mjs +57 -39
  124. package/dist/response/ResponseHandler.mjs.map +1 -1
  125. package/dist/response/ServerAuthorizationTokenResponse.d.ts +2 -0
  126. package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -1
  127. package/dist/telemetry/performance/IPerformanceClient.d.ts +4 -4
  128. package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  129. package/dist/telemetry/performance/PerformanceClient.d.ts +2 -2
  130. package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  131. package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
  132. package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
  133. package/dist/telemetry/performance/PerformanceEvent.d.ts +8 -1
  134. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  135. package/dist/telemetry/performance/PerformanceEvent.mjs +9 -1
  136. package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
  137. package/dist/telemetry/performance/StubPerformanceClient.d.ts +3 -3
  138. package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
  139. package/dist/telemetry/performance/StubPerformanceClient.mjs +23 -3
  140. package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
  141. package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -1
  142. package/dist/telemetry/server/ServerTelemetryManager.mjs +3 -4
  143. package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
  144. package/dist/url/UrlString.d.ts.map +1 -1
  145. package/dist/url/UrlString.mjs +10 -12
  146. package/dist/url/UrlString.mjs.map +1 -1
  147. package/dist/utils/Constants.d.ts +10 -0
  148. package/dist/utils/Constants.d.ts.map +1 -1
  149. package/dist/utils/Constants.mjs +11 -2
  150. package/dist/utils/Constants.mjs.map +1 -1
  151. package/dist/utils/FunctionWrappers.d.ts +28 -0
  152. package/dist/utils/FunctionWrappers.d.ts.map +1 -0
  153. package/dist/utils/FunctionWrappers.mjs +90 -0
  154. package/dist/utils/FunctionWrappers.mjs.map +1 -0
  155. package/dist/utils/ProtocolUtils.d.ts.map +1 -1
  156. package/dist/utils/ProtocolUtils.mjs +4 -7
  157. package/dist/utils/ProtocolUtils.mjs.map +1 -1
  158. package/dist/utils/StringUtils.d.ts +0 -13
  159. package/dist/utils/StringUtils.d.ts.map +1 -1
  160. package/dist/utils/StringUtils.mjs +3 -34
  161. package/dist/utils/StringUtils.mjs.map +1 -1
  162. package/dist/utils/TimeUtils.mjs +1 -1
  163. package/dist/utils/TimeUtils.mjs.map +1 -1
  164. package/package.json +6 -4
  165. package/src/account/AccountInfo.ts +44 -0
  166. package/src/account/AuthToken.ts +70 -0
  167. package/src/account/CcsCredential.ts +16 -0
  168. package/src/account/ClientCredentials.ts +20 -0
  169. package/src/account/ClientInfo.ts +64 -0
  170. package/src/account/TokenClaims.ts +70 -0
  171. package/src/authority/Authority.ts +1225 -0
  172. package/src/authority/AuthorityFactory.ts +106 -0
  173. package/src/authority/AuthorityMetadata.ts +953 -0
  174. package/src/authority/AuthorityOptions.ts +40 -0
  175. package/src/authority/AuthorityType.ts +15 -0
  176. package/src/authority/AzureRegion.ts +7 -0
  177. package/src/authority/AzureRegionConfiguration.ts +16 -0
  178. package/src/authority/CloudDiscoveryMetadata.ts +10 -0
  179. package/src/authority/CloudInstanceDiscoveryErrorResponse.ts +26 -0
  180. package/src/authority/CloudInstanceDiscoveryResponse.ts +21 -0
  181. package/src/authority/ImdsOptions.ts +10 -0
  182. package/src/authority/OIDCOptions.ts +14 -0
  183. package/src/authority/OpenIdConfigResponse.ts +24 -0
  184. package/src/authority/ProtocolMode.ts +13 -0
  185. package/src/authority/RegionDiscovery.ts +193 -0
  186. package/src/authority/RegionDiscoveryMetadata.ts +15 -0
  187. package/src/broker/nativeBroker/INativeBrokerPlugin.ts +29 -0
  188. package/src/cache/CacheManager.ts +1619 -0
  189. package/src/cache/entities/AccessTokenEntity.ts +162 -0
  190. package/src/cache/entities/AccountEntity.ts +309 -0
  191. package/src/cache/entities/AppMetadataEntity.ts +91 -0
  192. package/src/cache/entities/AuthorityMetadataEntity.ts +112 -0
  193. package/src/cache/entities/CacheRecord.ts +33 -0
  194. package/src/cache/entities/CredentialEntity.ts +215 -0
  195. package/src/cache/entities/IdTokenEntity.ts +74 -0
  196. package/src/cache/entities/RefreshTokenEntity.ts +78 -0
  197. package/src/cache/entities/ServerTelemetryEntity.ts +38 -0
  198. package/src/cache/entities/ThrottlingEntity.ts +36 -0
  199. package/src/cache/interface/ICacheManager.ts +218 -0
  200. package/src/cache/interface/ICachePlugin.ts +11 -0
  201. package/src/cache/interface/ISerializableTokenCache.ts +9 -0
  202. package/src/cache/persistence/TokenCacheContext.ts +39 -0
  203. package/src/cache/utils/CacheTypes.ts +93 -0
  204. package/src/client/AuthorizationCodeClient.ts +714 -0
  205. package/src/client/BaseClient.ts +205 -0
  206. package/src/client/RefreshTokenClient.ts +442 -0
  207. package/src/client/SilentFlowClient.ts +186 -0
  208. package/src/config/AppTokenProvider.ts +47 -0
  209. package/src/config/ClientConfiguration.ts +287 -0
  210. package/src/crypto/ICrypto.ts +127 -0
  211. package/src/crypto/IGuidGenerator.ts +9 -0
  212. package/src/crypto/JoseHeader.ts +55 -0
  213. package/src/crypto/PopTokenGenerator.ts +155 -0
  214. package/src/crypto/SignedHttpRequest.ts +16 -0
  215. package/src/error/AuthError.ts +85 -0
  216. package/src/error/ClientAuthError.ts +738 -0
  217. package/src/error/ClientConfigurationError.ts +396 -0
  218. package/src/error/InteractionRequiredAuthError.ts +134 -0
  219. package/src/error/JoseHeaderError.ts +52 -0
  220. package/src/error/ServerError.ts +18 -0
  221. package/src/index.ts +215 -0
  222. package/src/logger/Logger.ts +272 -0
  223. package/src/network/INetworkModule.ts +57 -0
  224. package/src/network/NetworkManager.ts +76 -0
  225. package/src/network/RequestThumbprint.ts +22 -0
  226. package/src/network/ThrottlingUtils.ts +156 -0
  227. package/src/packageMetadata.ts +3 -0
  228. package/src/request/AuthenticationHeaderParser.ts +89 -0
  229. package/src/request/BaseAuthRequest.ts +46 -0
  230. package/src/request/CommonAuthorizationCodeRequest.ts +33 -0
  231. package/src/request/CommonAuthorizationUrlRequest.ts +56 -0
  232. package/src/request/CommonClientCredentialRequest.ts +23 -0
  233. package/src/request/CommonDeviceCodeRequest.ts +31 -0
  234. package/src/request/CommonEndSessionRequest.ts +27 -0
  235. package/src/request/CommonOnBehalfOfRequest.ts +19 -0
  236. package/src/request/CommonRefreshTokenRequest.ts +25 -0
  237. package/src/request/CommonSilentFlowRequest.ts +24 -0
  238. package/src/request/CommonUsernamePasswordRequest.ts +23 -0
  239. package/src/request/NativeRequest.ts +25 -0
  240. package/src/request/NativeSignOutRequest.ts +10 -0
  241. package/src/request/RequestParameterBuilder.ts +606 -0
  242. package/src/request/RequestValidator.ts +103 -0
  243. package/src/request/ScopeSet.ts +230 -0
  244. package/src/request/StoreInCache.ts +16 -0
  245. package/src/response/AuthenticationResult.ts +47 -0
  246. package/src/response/AuthorizationCodePayload.ts +18 -0
  247. package/src/response/DeviceCodeResponse.ts +31 -0
  248. package/src/response/ExternalTokenResponse.ts +24 -0
  249. package/src/response/IMDSBadResponse.ts +9 -0
  250. package/src/response/ResponseHandler.ts +614 -0
  251. package/src/response/ServerAuthorizationCodeResponse.ts +33 -0
  252. package/src/response/ServerAuthorizationTokenResponse.ts +54 -0
  253. package/src/telemetry/performance/IPerformanceClient.ts +71 -0
  254. package/src/telemetry/performance/IPerformanceMeasurement.ts +10 -0
  255. package/src/telemetry/performance/PerformanceClient.ts +635 -0
  256. package/src/telemetry/performance/PerformanceEvent.ts +542 -0
  257. package/src/telemetry/performance/StubPerformanceClient.ts +101 -0
  258. package/src/telemetry/server/ServerTelemetryManager.ts +274 -0
  259. package/src/telemetry/server/ServerTelemetryRequest.ts +13 -0
  260. package/src/url/IUri.ts +17 -0
  261. package/src/url/UrlString.ts +363 -0
  262. package/src/utils/Constants.ts +436 -0
  263. package/src/utils/FunctionWrappers.ts +105 -0
  264. package/src/utils/MsalTypes.ts +9 -0
  265. package/src/utils/ProtocolUtils.ts +124 -0
  266. package/src/utils/StringUtils.ts +106 -0
  267. package/src/utils/TimeUtils.ts +51 -0
  268. package/dist/account/DecodedAuthToken.d.ts +0 -9
  269. package/dist/account/DecodedAuthToken.d.ts.map +0 -1
@@ -0,0 +1,542 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.
8
+ *
9
+ * @export
10
+ * @enum {number}
11
+ */
12
+ export const PerformanceEvents = {
13
+ /**
14
+ * acquireTokenByCode API (msal-browser and msal-node).
15
+ * Used to acquire tokens by trading an authorization code against the token endpoint.
16
+ */
17
+ AcquireTokenByCode: "acquireTokenByCode",
18
+
19
+ /**
20
+ * acquireTokenByRefreshToken API (msal-browser and msal-node).
21
+ * Used to renew an access token using a refresh token against the token endpoint.
22
+ */
23
+ AcquireTokenByRefreshToken: "acquireTokenByRefreshToken",
24
+
25
+ /**
26
+ * acquireTokenSilent API (msal-browser and msal-node).
27
+ * Used to silently acquire a new access token (from the cache or the network).
28
+ */
29
+ AcquireTokenSilent: "acquireTokenSilent",
30
+
31
+ /**
32
+ * acquireTokenSilentAsync (msal-browser).
33
+ * Internal API for acquireTokenSilent.
34
+ */
35
+ AcquireTokenSilentAsync: "acquireTokenSilentAsync",
36
+
37
+ /**
38
+ * acquireTokenPopup (msal-browser).
39
+ * Used to acquire a new access token interactively through pop ups
40
+ */
41
+ AcquireTokenPopup: "acquireTokenPopup",
42
+
43
+ /**
44
+ * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
45
+ * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
46
+ */
47
+ CryptoOptsGetPublicKeyThumbprint: "cryptoOptsGetPublicKeyThumbprint",
48
+
49
+ /**
50
+ * signJwt API in CryptoOpts class (msal-browser).
51
+ * Used to signed a pop token.
52
+ */
53
+ CryptoOptsSignJwt: "cryptoOptsSignJwt",
54
+
55
+ /**
56
+ * acquireToken API in the SilentCacheClient class (msal-browser).
57
+ * Used to read access tokens from the cache.
58
+ */
59
+ SilentCacheClientAcquireToken: "silentCacheClientAcquireToken",
60
+
61
+ /**
62
+ * acquireToken API in the SilentIframeClient class (msal-browser).
63
+ * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
64
+ */
65
+ SilentIframeClientAcquireToken: "silentIframeClientAcquireToken",
66
+
67
+ /**
68
+ * acquireToken API in SilentRereshClient (msal-browser).
69
+ * Used to acquire a new set of tokens from the token endpoint using a refresh token.
70
+ */
71
+ SilentRefreshClientAcquireToken: "silentRefreshClientAcquireToken",
72
+
73
+ /**
74
+ * ssoSilent API (msal-browser).
75
+ * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
76
+ */
77
+ SsoSilent: "ssoSilent",
78
+
79
+ /**
80
+ * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
81
+ * Used to load authority metadata for a request.
82
+ */
83
+ StandardInteractionClientGetDiscoveredAuthority:
84
+ "standardInteractionClientGetDiscoveredAuthority",
85
+
86
+ /**
87
+ * acquireToken APIs in msal-browser.
88
+ * Used to make an /authorize endpoint call with native brokering enabled.
89
+ */
90
+ FetchAccountIdWithNativeBroker: "fetchAccountIdWithNativeBroker",
91
+
92
+ /**
93
+ * acquireToken API in NativeInteractionClient class (msal-browser).
94
+ * Used to acquire a token from Native component when native brokering is enabled.
95
+ */
96
+ NativeInteractionClientAcquireToken: "nativeInteractionClientAcquireToken",
97
+ /**
98
+ * Time spent creating default headers for requests to token endpoint
99
+ */
100
+ BaseClientCreateTokenRequestHeaders: "baseClientCreateTokenRequestHeaders",
101
+ /**
102
+ * Time spent sending/waiting for the response of a request to the token endpoint
103
+ */
104
+ BaseClientExecutePostToTokenEndpoint:
105
+ "baseClientExecutePostToTokenEndpoint",
106
+ /**
107
+ * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
108
+ */
109
+ BrokerHandhshake: "brokerHandshake",
110
+ /**
111
+ * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
112
+ */
113
+ AcquireTokenByRefreshTokenInBroker: "acquireTokenByRefreshTokenInBroker",
114
+ /**
115
+ * Time taken for token acquisition by broker
116
+ */
117
+ AcquireTokenByBroker: "acquireTokenByBroker",
118
+
119
+ /**
120
+ * Time spent on the network for refresh token acquisition
121
+ */
122
+ RefreshTokenClientExecuteTokenRequest:
123
+ "refreshTokenClientExecuteTokenRequest",
124
+
125
+ /**
126
+ * Time taken for acquiring refresh token , records RT size
127
+ */
128
+ RefreshTokenClientAcquireToken: "refreshTokenClientAcquireToken",
129
+
130
+ /**
131
+ * Time taken for acquiring cached refresh token
132
+ */
133
+ RefreshTokenClientAcquireTokenWithCachedRefreshToken:
134
+ "refreshTokenClientAcquireTokenWithCachedRefreshToken",
135
+
136
+ /**
137
+ * acquireTokenByRefreshToken API in RefreshTokenClient (msal-common).
138
+ */
139
+ RefreshTokenClientAcquireTokenByRefreshToken:
140
+ "refreshTokenClientAcquireTokenByRefreshToken",
141
+
142
+ /**
143
+ * Helper function to create token request body in RefreshTokenClient (msal-common).
144
+ */
145
+ RefreshTokenClientCreateTokenRequestBody:
146
+ "refreshTokenClientCreateTokenRequestBody",
147
+
148
+ /**
149
+ * acquireTokenFromCache (msal-browser).
150
+ * Internal API for acquiring token from cache
151
+ */
152
+ AcquireTokenFromCache: "acquireTokenFromCache",
153
+
154
+ /**
155
+ * acquireTokenBySilentIframe (msal-browser).
156
+ * Internal API for acquiring token by silent Iframe
157
+ */
158
+ AcquireTokenBySilentIframe: "acquireTokenBySilentIframe",
159
+
160
+ /**
161
+ * Internal API for initializing base request in BaseInteractionClient (msal-browser)
162
+ */
163
+ InitializeBaseRequest: "initializeBaseRequest",
164
+
165
+ /**
166
+ * Internal API for initializing silent request in SilentCacheClient (msal-browser)
167
+ */
168
+ InitializeSilentRequest: "initializeSilentRequest",
169
+
170
+ InitializeClientApplication: "initializeClientApplication",
171
+
172
+ /**
173
+ * Helper function in SilentIframeClient class (msal-browser).
174
+ */
175
+ SilentIframeClientTokenHelper: "silentIframeClientTokenHelper",
176
+
177
+ /**
178
+ * SilentHandler
179
+ */
180
+ SilentHandlerInitiateAuthRequest: "silentHandlerInitiateAuthRequest",
181
+ SilentHandlerMonitorIframeForHash: "silentHandlerMonitorIframeForHash",
182
+ SilentHandlerLoadFrame: "silentHandlerLoadFrame",
183
+
184
+ /**
185
+ * Helper functions in StandardInteractionClient class (msal-browser)
186
+ */
187
+ StandardInteractionClientCreateAuthCodeClient:
188
+ "standardInteractionClientCreateAuthCodeClient",
189
+ StandardInteractionClientGetClientConfiguration:
190
+ "standardInteractionClientGetClientConfiguration",
191
+ StandardInteractionClientInitializeAuthorizationRequest:
192
+ "standardInteractionClientInitializeAuthorizationRequest",
193
+ StandardInteractionClientInitializeAuthorizationCodeRequest:
194
+ "standardInteractionClientInitializeAuthorizationCodeRequest",
195
+
196
+ /**
197
+ * getAuthCodeUrl API (msal-browser and msal-node).
198
+ */
199
+ GetAuthCodeUrl: "getAuthCodeUrl",
200
+
201
+ /**
202
+ * Functions from InteractionHandler (msal-browser)
203
+ */
204
+ HandleCodeResponseFromServer: "handleCodeResponseFromServer",
205
+ HandleCodeResponseFromHash: "handleCodeResponseFromHash",
206
+ UpdateTokenEndpointAuthority: "updateTokenEndpointAuthority",
207
+
208
+ /**
209
+ * APIs in Authorization Code Client (msal-common)
210
+ */
211
+ AuthClientAcquireToken: "authClientAcquireToken",
212
+ AuthClientExecuteTokenRequest: "authClientExecuteTokenRequest",
213
+ AuthClientCreateTokenRequestBody: "authClientCreateTokenRequestBody",
214
+ AuthClientCreateQueryString: "authClientCreateQueryString",
215
+
216
+ /**
217
+ * Generate functions in PopTokenGenerator (msal-common)
218
+ */
219
+ PopTokenGenerateCnf: "popTokenGenerateCnf",
220
+ PopTokenGenerateKid: "popTokenGenerateKid",
221
+
222
+ /**
223
+ * handleServerTokenResponse API in ResponseHandler (msal-common)
224
+ */
225
+ HandleServerTokenResponse: "handleServerTokenResponse",
226
+
227
+ /**
228
+ * Authority functions
229
+ */
230
+ AuthorityFactoryCreateDiscoveredInstance:
231
+ "authorityFactoryCreateDiscoveredInstance",
232
+ AuthorityResolveEndpointsAsync: "authorityResolveEndpointsAsync",
233
+ AuthorityGetCloudDiscoveryMetadataFromNetwork:
234
+ "authorityGetCloudDiscoveryMetadataFromNetwork",
235
+ AuthorityUpdateCloudDiscoveryMetadata:
236
+ "authorityUpdateCloudDiscoveryMetadata",
237
+ AuthorityGetEndpointMetadataFromNetwork:
238
+ "authorityGetEndpointMetadataFromNetwork",
239
+ AuthorityUpdateEndpointMetadata: "authorityUpdateEndpointMetadata",
240
+ AuthorityUpdateMetadataWithRegionalInformation:
241
+ "authorityUpdateMetadataWithRegionalInformation",
242
+
243
+ /**
244
+ * Region Discovery functions
245
+ */
246
+ RegionDiscoveryDetectRegion: "regionDiscoveryDetectRegion",
247
+ RegionDiscoveryGetRegionFromIMDS: "regionDiscoveryGetRegionFromIMDS",
248
+ RegionDiscoveryGetCurrentVersion: "regionDiscoveryGetCurrentVersion",
249
+
250
+ AcquireTokenByCodeAsync: "acquireTokenByCodeAsync",
251
+
252
+ GetEndpointMetadataFromNetwork: "getEndpointMetadataFromNetwork",
253
+ GetCloudDiscoveryMetadataFromNetworkMeasurement:
254
+ "getCloudDiscoveryMetadataFromNetworkMeasurement",
255
+
256
+ HandleRedirectPromiseMeasurement: "handleRedirectPromiseMeasurement",
257
+
258
+ UpdateCloudDiscoveryMetadataMeasurement:
259
+ "updateCloudDiscoveryMetadataMeasurement",
260
+
261
+ UsernamePasswordClientAcquireToken: "usernamePasswordClientAcquireToken",
262
+
263
+ NativeMessageHandlerHandshake: "nativeMessageHandlerHandshake",
264
+
265
+ NativeGenerateAuthResult: "nativeGenerateAuthResult",
266
+
267
+ /**
268
+ * Cache operations
269
+ */
270
+ ClearTokensAndKeysWithClaims: "clearTokensAndKeysWithClaims",
271
+ } as const;
272
+ export type PerformanceEvents =
273
+ (typeof PerformanceEvents)[keyof typeof PerformanceEvents];
274
+
275
+ /**
276
+ * State of the performance event.
277
+ *
278
+ * @export
279
+ * @enum {number}
280
+ */
281
+ export const PerformanceEventStatus = {
282
+ NotStarted: 0,
283
+ InProgress: 1,
284
+ Completed: 2,
285
+ } as const;
286
+ export type PerformanceEventStatus =
287
+ (typeof PerformanceEventStatus)[keyof typeof PerformanceEventStatus];
288
+
289
+ export type SubMeasurement = {
290
+ name: string;
291
+ startTimeMs: number;
292
+ };
293
+
294
+ /**
295
+ * Performance measurement taken by the library, including metadata about the request and application.
296
+ *
297
+ * @export
298
+ * @typedef {PerformanceEvent}
299
+ */
300
+ export type PerformanceEvent = {
301
+ /**
302
+ * Unique id for the event
303
+ *
304
+ * @type {string}
305
+ */
306
+ eventId: string;
307
+
308
+ /**
309
+ * State of the perforance measure.
310
+ *
311
+ * @type {PerformanceEventStatus}
312
+ */
313
+ status: PerformanceEventStatus;
314
+
315
+ /**
316
+ * Login authority used for the request
317
+ *
318
+ * @type {string}
319
+ */
320
+ authority: string;
321
+
322
+ /**
323
+ * Client id for the application
324
+ *
325
+ * @type {string}
326
+ */
327
+ clientId: string;
328
+
329
+ /**
330
+ * Correlation ID used for the request
331
+ *
332
+ * @type {string}
333
+ */
334
+ correlationId: string;
335
+
336
+ /**
337
+ * End-to-end duration in milliseconds.
338
+ * @date 3/22/2022 - 3:40:05 PM
339
+ *
340
+ * @type {number}
341
+ */
342
+ durationMs?: number;
343
+
344
+ /**
345
+ * Visibility of the page when the event completed.
346
+ * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API
347
+ *
348
+ * @type {?(string | null)}
349
+ */
350
+ endPageVisibility?: string | null;
351
+
352
+ /**
353
+ * Whether the result was retrieved from the cache.
354
+ *
355
+ * @type {(boolean | null)}
356
+ */
357
+ fromCache?: boolean | null;
358
+
359
+ /**
360
+ * Event name (usually in the form of classNameFunctionName)
361
+ *
362
+ * @type {string}
363
+ */
364
+ name: string;
365
+
366
+ /**
367
+ * Visibility of the page when the event completed.
368
+ * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API
369
+ *
370
+ * @type {?(string | null)}
371
+ */
372
+ startPageVisibility?: string | null;
373
+
374
+ /**
375
+ * Unix millisecond timestamp when the event was initiated.
376
+ *
377
+ * @type {number}
378
+ */
379
+ startTimeMs: number;
380
+
381
+ /**
382
+ * Whether or the operation completed successfully.
383
+ *
384
+ * @type {(boolean | null)}
385
+ */
386
+ success?: boolean | null;
387
+
388
+ /**
389
+ * Add specific error code in case of failure
390
+ *
391
+ * @type {string}
392
+ */
393
+ errorCode?: string;
394
+
395
+ /**
396
+ * Add specific sub error code in case of failure
397
+ *
398
+ * @type {string}
399
+ */
400
+ subErrorCode?: string;
401
+
402
+ /**
403
+ * Name of the library used for the operation.
404
+ *
405
+ * @type {string}
406
+ */
407
+ libraryName: string;
408
+
409
+ /**
410
+ * Version of the library used for the operation.
411
+ *
412
+ * @type {string}
413
+ */
414
+ libraryVersion: string;
415
+
416
+ /**
417
+ * Whether the response is from a native component (e.g., WAM)
418
+ *
419
+ * @type {?boolean}
420
+ */
421
+ isNativeBroker?: boolean;
422
+
423
+ /**
424
+ * Request ID returned from the response
425
+ *
426
+ * @type {?string}
427
+ */
428
+ requestId?: string;
429
+
430
+ /**
431
+ * Cache lookup policy
432
+ *
433
+ * @type {?number}
434
+ */
435
+ cacheLookupPolicy?: number | undefined;
436
+
437
+ /**
438
+ * Amount of time spent in the JS queue in milliseconds.
439
+ *
440
+ * @type {?number}
441
+ */
442
+ queuedTimeMs?: number;
443
+
444
+ /**
445
+ * Sub-measurements for internal use. To be deleted before flushing.
446
+ */
447
+ incompleteSubMeasurements?: Map<string, SubMeasurement>;
448
+
449
+ visibilityChangeCount?: number;
450
+ incompleteSubsCount?: number;
451
+ /**
452
+ * Amount of times queued in the JS event queue.
453
+ *
454
+ * @type {?number}
455
+ */
456
+ queuedCount?: number;
457
+ /**
458
+ * Amount of manually completed queue events.
459
+ *
460
+ * @type {?number}
461
+ */
462
+ queuedManuallyCompletedCount?: number;
463
+
464
+ /**
465
+ * Size of the id token
466
+ *
467
+ * @type {number}
468
+ */
469
+ idTokenSize?: number;
470
+
471
+ /**
472
+ *
473
+ * Size of the access token
474
+ *
475
+ * @type {number}
476
+ */
477
+
478
+ accessTokenSize?: number;
479
+
480
+ /**
481
+ *
482
+ * Size of the refresh token
483
+ *
484
+ * @type {number}
485
+ */
486
+
487
+ refreshTokenSize?: number | undefined;
488
+
489
+ /**
490
+ * Application name as specified by the app.
491
+ *
492
+ * @type {?string}
493
+ */
494
+ appName?: string;
495
+
496
+ /**
497
+ * Application version as specified by the app.
498
+ *
499
+ * @type {?string}
500
+ */
501
+ appVersion?: string;
502
+
503
+ /**
504
+ * The following are fields that may be emitted in native broker scenarios
505
+ */
506
+ extensionId?: string;
507
+ extensionVersion?: string;
508
+ matsBrokerVersion?: string;
509
+ matsAccountJoinOnStart?: string;
510
+ matsAccountJoinOnEnd?: string;
511
+ matsDeviceJoin?: string;
512
+ matsPromptBehavior?: string;
513
+ matsApiErrorCode?: number;
514
+ matsUiVisible?: boolean;
515
+ matsSilentCode?: number;
516
+ matsSilentBiSubCode?: number;
517
+ matsSilentMessage?: string;
518
+ matsSilentStatus?: number;
519
+ matsHttpStatus?: number;
520
+ matsHttpEventCount?: number;
521
+ httpVerToken?: string;
522
+
523
+ /**
524
+ * Native broker fields
525
+ */
526
+ allowNativeBroker?: boolean;
527
+ extensionInstalled?: boolean;
528
+ extensionHandshakeTimeoutMs?: number;
529
+ extensionHandshakeTimedOut?: boolean;
530
+ };
531
+
532
+ export const IntFields: ReadonlySet<string> = new Set([
533
+ "accessTokenSize",
534
+ "durationMs",
535
+ "idTokenSize",
536
+ "matsSilentStatus",
537
+ "matsHttpStatus",
538
+ "refreshTokenSize",
539
+ "queuedTimeMs",
540
+ "startTimeMs",
541
+ "status",
542
+ ]);
@@ -0,0 +1,101 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ IPerformanceClient,
8
+ InProgressPerformanceEvent,
9
+ } from "./IPerformanceClient";
10
+ import { IPerformanceMeasurement } from "./IPerformanceMeasurement";
11
+ import { PerformanceEvent, PerformanceEventStatus } from "./PerformanceEvent";
12
+
13
+ export class StubPerformanceMeasurement implements IPerformanceMeasurement {
14
+ startMeasurement(): void {
15
+ return;
16
+ }
17
+ endMeasurement(): void {
18
+ return;
19
+ }
20
+ flushMeasurement(): number | null {
21
+ return null;
22
+ }
23
+ }
24
+
25
+ export class StubPerformanceClient implements IPerformanceClient {
26
+ generateId(): string {
27
+ return "callback-id";
28
+ }
29
+
30
+ startMeasurement(
31
+ measureName: string,
32
+ correlationId?: string | undefined
33
+ ): InProgressPerformanceEvent {
34
+ return {
35
+ end: () => null,
36
+ discard: () => {},
37
+ add: () => {},
38
+ increment: () => {},
39
+ event: {
40
+ eventId: this.generateId(),
41
+ status: PerformanceEventStatus.InProgress,
42
+ authority: "",
43
+ libraryName: "",
44
+ libraryVersion: "",
45
+ clientId: "",
46
+ name: measureName,
47
+ startTimeMs: Date.now(),
48
+ correlationId: correlationId || "",
49
+ },
50
+ measurement: new StubPerformanceMeasurement(),
51
+ };
52
+ }
53
+
54
+ startPerformanceMeasurement(): IPerformanceMeasurement {
55
+ return new StubPerformanceMeasurement();
56
+ }
57
+
58
+ calculateQueuedTime(): number {
59
+ return 0;
60
+ }
61
+
62
+ addQueueMeasurement(): void {
63
+ return;
64
+ }
65
+
66
+ setPreQueueTime(): void {
67
+ return;
68
+ }
69
+
70
+ endMeasurement(): PerformanceEvent | null {
71
+ return null;
72
+ }
73
+
74
+ discardMeasurements(): void {
75
+ return;
76
+ }
77
+
78
+ removePerformanceCallback(): boolean {
79
+ return true;
80
+ }
81
+
82
+ addPerformanceCallback(): string {
83
+ return "";
84
+ }
85
+
86
+ emitEvents(): void {
87
+ return;
88
+ }
89
+
90
+ addFields(): void {
91
+ return;
92
+ }
93
+
94
+ incrementFields(): void {
95
+ return;
96
+ }
97
+
98
+ cacheEventByCorrelationId(): void {
99
+ return;
100
+ }
101
+ }