@azure/msal-common 16.0.0-alpha.0 → 16.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/dist/account/AccountInfo.d.ts +3 -0
  2. package/dist/account/AccountInfo.d.ts.map +1 -1
  3. package/dist/account/AccountInfo.mjs +1 -1
  4. package/dist/account/AccountInfo.mjs.map +1 -1
  5. package/dist/account/AuthToken.d.ts +6 -0
  6. package/dist/account/AuthToken.d.ts.map +1 -1
  7. package/dist/account/AuthToken.mjs +21 -2
  8. package/dist/account/AuthToken.mjs.map +1 -1
  9. package/dist/account/CcsCredential.mjs +1 -1
  10. package/dist/account/CcsCredential.mjs.map +1 -1
  11. package/dist/account/ClientInfo.d.ts +5 -1
  12. package/dist/account/ClientInfo.d.ts.map +1 -1
  13. package/dist/account/ClientInfo.mjs +1 -1
  14. package/dist/account/ClientInfo.mjs.map +1 -1
  15. package/dist/account/TokenClaims.d.ts +4 -0
  16. package/dist/account/TokenClaims.d.ts.map +1 -1
  17. package/dist/account/TokenClaims.mjs +1 -1
  18. package/dist/account/TokenClaims.mjs.map +1 -1
  19. package/dist/authority/Authority.mjs +1 -1
  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.d.ts.map +1 -1
  24. package/dist/authority/AuthorityMetadata.mjs +27 -24
  25. package/dist/authority/AuthorityMetadata.mjs.map +1 -1
  26. package/dist/authority/AuthorityOptions.mjs +1 -1
  27. package/dist/authority/AuthorityOptions.mjs.map +1 -1
  28. package/dist/authority/AuthorityType.mjs +1 -1
  29. package/dist/authority/AuthorityType.mjs.map +1 -1
  30. package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
  31. package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
  32. package/dist/authority/OpenIdConfigResponse.mjs +1 -1
  33. package/dist/authority/ProtocolMode.mjs +1 -1
  34. package/dist/authority/ProtocolMode.mjs.map +1 -1
  35. package/dist/authority/RegionDiscovery.mjs +1 -1
  36. package/dist/authority/RegionDiscovery.mjs.map +1 -1
  37. package/dist/cache/CacheManager.d.ts +5 -5
  38. package/dist/cache/CacheManager.d.ts.map +1 -1
  39. package/dist/cache/CacheManager.mjs +8 -8
  40. package/dist/cache/CacheManager.mjs.map +1 -1
  41. package/dist/cache/entities/AccountEntity.d.ts +2 -1
  42. package/dist/cache/entities/AccountEntity.d.ts.map +1 -1
  43. package/dist/cache/interface/ICacheManager.d.ts +5 -5
  44. package/dist/cache/interface/ICacheManager.d.ts.map +1 -1
  45. package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
  46. package/dist/cache/persistence/TokenCacheContext.mjs.map +1 -1
  47. package/dist/cache/utils/AccountEntityUtils.d.ts +0 -7
  48. package/dist/cache/utils/AccountEntityUtils.d.ts.map +1 -1
  49. package/dist/cache/utils/AccountEntityUtils.mjs +9 -29
  50. package/dist/cache/utils/AccountEntityUtils.mjs.map +1 -1
  51. package/dist/cache/utils/CacheHelpers.mjs +1 -1
  52. package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
  53. package/dist/client/AuthorizationCodeClient.d.ts +22 -3
  54. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -1
  55. package/dist/client/AuthorizationCodeClient.mjs +51 -19
  56. package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
  57. package/dist/client/RefreshTokenClient.d.ts +16 -3
  58. package/dist/client/RefreshTokenClient.d.ts.map +1 -1
  59. package/dist/client/RefreshTokenClient.mjs +31 -12
  60. package/dist/client/RefreshTokenClient.mjs.map +1 -1
  61. package/dist/client/SilentFlowClient.d.ts +16 -3
  62. package/dist/client/SilentFlowClient.d.ts.map +1 -1
  63. package/dist/client/SilentFlowClient.mjs +21 -4
  64. package/dist/client/SilentFlowClient.mjs.map +1 -1
  65. package/dist/config/ClientConfiguration.mjs +1 -1
  66. package/dist/config/ClientConfiguration.mjs.map +1 -1
  67. package/dist/constants/AADServerParamKeys.mjs +1 -1
  68. package/dist/crypto/ICrypto.mjs +1 -1
  69. package/dist/crypto/ICrypto.mjs.map +1 -1
  70. package/dist/crypto/JoseHeader.mjs +1 -1
  71. package/dist/crypto/JoseHeader.mjs.map +1 -1
  72. package/dist/crypto/PopTokenGenerator.mjs +1 -1
  73. package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
  74. package/dist/error/AuthError.d.ts +5 -0
  75. package/dist/error/AuthError.d.ts.map +1 -1
  76. package/dist/error/AuthError.mjs +1 -1
  77. package/dist/error/AuthError.mjs.map +1 -1
  78. package/dist/error/AuthErrorCodes.mjs +1 -1
  79. package/dist/error/CacheError.mjs +1 -1
  80. package/dist/error/CacheError.mjs.map +1 -1
  81. package/dist/error/CacheErrorCodes.mjs +1 -1
  82. package/dist/error/ClientAuthError.mjs +1 -1
  83. package/dist/error/ClientAuthError.mjs.map +1 -1
  84. package/dist/error/ClientAuthErrorCodes.d.ts +1 -0
  85. package/dist/error/ClientAuthErrorCodes.d.ts.map +1 -1
  86. package/dist/error/ClientAuthErrorCodes.mjs +4 -3
  87. package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
  88. package/dist/error/ClientConfigurationError.mjs +1 -1
  89. package/dist/error/ClientConfigurationError.mjs.map +1 -1
  90. package/dist/error/ClientConfigurationErrorCodes.d.ts +1 -0
  91. package/dist/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
  92. package/dist/error/ClientConfigurationErrorCodes.mjs +4 -3
  93. package/dist/error/ClientConfigurationErrorCodes.mjs.map +1 -1
  94. package/dist/error/InteractionRequiredAuthError.mjs +1 -1
  95. package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
  96. package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
  97. package/dist/error/JoseHeaderError.mjs +1 -1
  98. package/dist/error/JoseHeaderError.mjs.map +1 -1
  99. package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
  100. package/dist/error/NetworkError.mjs +1 -1
  101. package/dist/error/NetworkError.mjs.map +1 -1
  102. package/dist/error/PlatformBrokerError.d.ts +16 -0
  103. package/dist/error/PlatformBrokerError.d.ts.map +1 -0
  104. package/dist/error/PlatformBrokerError.mjs +49 -0
  105. package/dist/error/PlatformBrokerError.mjs.map +1 -0
  106. package/dist/error/ServerError.mjs +1 -1
  107. package/dist/error/ServerError.mjs.map +1 -1
  108. package/dist/exports-common.d.ts +4 -2
  109. package/dist/exports-common.d.ts.map +1 -1
  110. package/dist/exports-node-only.d.ts +1 -0
  111. package/dist/exports-node-only.d.ts.map +1 -1
  112. package/dist/index-node.mjs +7 -4
  113. package/dist/index-node.mjs.map +1 -1
  114. package/dist/index.mjs +7 -4
  115. package/dist/index.mjs.map +1 -1
  116. package/dist/logger/Logger.d.ts +24 -0
  117. package/dist/logger/Logger.d.ts.map +1 -1
  118. package/dist/logger/Logger.mjs +92 -4
  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/RequestThumbprint.mjs +2 -2
  123. package/dist/network/RequestThumbprint.mjs.map +1 -1
  124. package/dist/network/ThrottlingUtils.mjs +1 -1
  125. package/dist/network/ThrottlingUtils.mjs.map +1 -1
  126. package/dist/packageMetadata.d.ts +1 -1
  127. package/dist/packageMetadata.d.ts.map +1 -1
  128. package/dist/packageMetadata.mjs +2 -2
  129. package/dist/protocol/Authorize.mjs +1 -1
  130. package/dist/protocol/Authorize.mjs.map +1 -1
  131. package/dist/protocol/Token.d.ts +40 -0
  132. package/dist/protocol/Token.d.ts.map +1 -0
  133. package/dist/protocol/Token.mjs +129 -0
  134. package/dist/protocol/Token.mjs.map +1 -0
  135. package/dist/request/AuthenticationHeaderParser.mjs +1 -1
  136. package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
  137. package/dist/request/BaseAuthRequest.d.ts +7 -5
  138. package/dist/request/BaseAuthRequest.d.ts.map +1 -1
  139. package/dist/request/CommonAuthorizationCodeRequest.d.ts +2 -1
  140. package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
  141. package/dist/request/CommonAuthorizationUrlRequest.d.ts +2 -4
  142. package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
  143. package/dist/request/CommonRefreshTokenRequest.d.ts +2 -1
  144. package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -1
  145. package/dist/request/CommonSilentFlowRequest.d.ts +2 -1
  146. package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -1
  147. package/dist/request/RequestParameterBuilder.d.ts +3 -3
  148. package/dist/request/RequestParameterBuilder.d.ts.map +1 -1
  149. package/dist/request/RequestParameterBuilder.mjs +6 -6
  150. package/dist/request/RequestParameterBuilder.mjs.map +1 -1
  151. package/dist/request/ScopeSet.mjs +1 -1
  152. package/dist/request/ScopeSet.mjs.map +1 -1
  153. package/dist/response/ResponseHandler.d.ts +1 -1
  154. package/dist/response/ResponseHandler.d.ts.map +1 -1
  155. package/dist/response/ResponseHandler.mjs +5 -5
  156. package/dist/response/ResponseHandler.mjs.map +1 -1
  157. package/dist/telemetry/performance/IPerformanceClient.d.ts +2 -1
  158. package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  159. package/dist/telemetry/performance/PerformanceClient.d.ts +4 -1
  160. package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  161. package/dist/telemetry/performance/PerformanceClient.mjs +30 -16
  162. package/dist/telemetry/performance/PerformanceClient.mjs.map +1 -1
  163. package/dist/telemetry/performance/PerformanceEvent.d.ts +3 -0
  164. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  165. package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
  166. package/dist/telemetry/performance/PerformanceEvent.mjs.map +1 -1
  167. package/dist/telemetry/performance/PerformanceEvents.d.ts +1 -0
  168. package/dist/telemetry/performance/PerformanceEvents.d.ts.map +1 -1
  169. package/dist/telemetry/performance/PerformanceEvents.mjs +3 -2
  170. package/dist/telemetry/performance/PerformanceEvents.mjs.map +1 -1
  171. package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
  172. package/dist/telemetry/performance/StubPerformanceClient.mjs.map +1 -1
  173. package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
  174. package/dist/telemetry/server/ServerTelemetryManager.mjs.map +1 -1
  175. package/dist/url/UrlString.mjs +1 -1
  176. package/dist/url/UrlString.mjs.map +1 -1
  177. package/dist/utils/ClientAssertionUtils.mjs +1 -1
  178. package/dist/utils/ClientAssertionUtils.mjs.map +1 -1
  179. package/dist/utils/Constants.d.ts +5 -0
  180. package/dist/utils/Constants.d.ts.map +1 -1
  181. package/dist/utils/Constants.mjs +6 -2
  182. package/dist/utils/Constants.mjs.map +1 -1
  183. package/dist/utils/FunctionWrappers.mjs +1 -1
  184. package/dist/utils/FunctionWrappers.mjs.map +1 -1
  185. package/dist/utils/ProtocolUtils.d.ts +14 -35
  186. package/dist/utils/ProtocolUtils.d.ts.map +1 -1
  187. package/dist/utils/ProtocolUtils.mjs +56 -60
  188. package/dist/utils/ProtocolUtils.mjs.map +1 -1
  189. package/dist/utils/StateTypes.d.ts +15 -0
  190. package/dist/utils/StateTypes.d.ts.map +1 -0
  191. package/dist/utils/StringUtils.mjs +1 -1
  192. package/dist/utils/StringUtils.mjs.map +1 -1
  193. package/dist/utils/TimeUtils.mjs +1 -1
  194. package/dist/utils/TimeUtils.mjs.map +1 -1
  195. package/dist/utils/UrlUtils.mjs +1 -1
  196. package/dist/utils/UrlUtils.mjs.map +1 -1
  197. package/lib/index-browser.cjs +31 -17
  198. package/lib/index-browser.cjs.map +1 -1
  199. package/lib/{index-node-FrCFfFuh.js → index-node-B7mR4APO.js} +2427 -2237
  200. package/lib/index-node-B7mR4APO.js.map +1 -0
  201. package/lib/index-node.cjs +5 -3
  202. package/lib/index-node.cjs.map +1 -1
  203. package/lib/index.cjs +5 -3
  204. package/lib/index.cjs.map +1 -1
  205. package/lib/types/account/AccountInfo.d.ts +3 -0
  206. package/lib/types/account/AccountInfo.d.ts.map +1 -1
  207. package/lib/types/account/AuthToken.d.ts +6 -0
  208. package/lib/types/account/AuthToken.d.ts.map +1 -1
  209. package/lib/types/account/ClientInfo.d.ts +5 -1
  210. package/lib/types/account/ClientInfo.d.ts.map +1 -1
  211. package/lib/types/account/TokenClaims.d.ts +4 -0
  212. package/lib/types/account/TokenClaims.d.ts.map +1 -1
  213. package/lib/types/authority/AuthorityMetadata.d.ts.map +1 -1
  214. package/lib/types/cache/CacheManager.d.ts +5 -5
  215. package/lib/types/cache/CacheManager.d.ts.map +1 -1
  216. package/lib/types/cache/entities/AccountEntity.d.ts +2 -1
  217. package/lib/types/cache/entities/AccountEntity.d.ts.map +1 -1
  218. package/lib/types/cache/interface/ICacheManager.d.ts +5 -5
  219. package/lib/types/cache/interface/ICacheManager.d.ts.map +1 -1
  220. package/lib/types/cache/utils/AccountEntityUtils.d.ts +0 -7
  221. package/lib/types/cache/utils/AccountEntityUtils.d.ts.map +1 -1
  222. package/lib/types/client/AuthorizationCodeClient.d.ts +22 -3
  223. package/lib/types/client/AuthorizationCodeClient.d.ts.map +1 -1
  224. package/lib/types/client/RefreshTokenClient.d.ts +16 -3
  225. package/lib/types/client/RefreshTokenClient.d.ts.map +1 -1
  226. package/lib/types/client/SilentFlowClient.d.ts +16 -3
  227. package/lib/types/client/SilentFlowClient.d.ts.map +1 -1
  228. package/lib/types/error/AuthError.d.ts +5 -0
  229. package/lib/types/error/AuthError.d.ts.map +1 -1
  230. package/lib/types/error/ClientAuthErrorCodes.d.ts +1 -0
  231. package/lib/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
  232. package/lib/types/error/ClientConfigurationErrorCodes.d.ts +1 -0
  233. package/lib/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
  234. package/lib/types/error/PlatformBrokerError.d.ts +16 -0
  235. package/lib/types/error/PlatformBrokerError.d.ts.map +1 -0
  236. package/lib/types/exports-common.d.ts +4 -2
  237. package/lib/types/exports-common.d.ts.map +1 -1
  238. package/lib/types/exports-node-only.d.ts +1 -0
  239. package/lib/types/exports-node-only.d.ts.map +1 -1
  240. package/lib/types/logger/Logger.d.ts +24 -0
  241. package/lib/types/logger/Logger.d.ts.map +1 -1
  242. package/lib/types/packageMetadata.d.ts +1 -1
  243. package/lib/types/packageMetadata.d.ts.map +1 -1
  244. package/lib/types/protocol/Token.d.ts +40 -0
  245. package/lib/types/protocol/Token.d.ts.map +1 -0
  246. package/lib/types/request/BaseAuthRequest.d.ts +7 -5
  247. package/lib/types/request/BaseAuthRequest.d.ts.map +1 -1
  248. package/lib/types/request/CommonAuthorizationCodeRequest.d.ts +2 -1
  249. package/lib/types/request/CommonAuthorizationCodeRequest.d.ts.map +1 -1
  250. package/lib/types/request/CommonAuthorizationUrlRequest.d.ts +2 -4
  251. package/lib/types/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
  252. package/lib/types/request/CommonRefreshTokenRequest.d.ts +2 -1
  253. package/lib/types/request/CommonRefreshTokenRequest.d.ts.map +1 -1
  254. package/lib/types/request/CommonSilentFlowRequest.d.ts +2 -1
  255. package/lib/types/request/CommonSilentFlowRequest.d.ts.map +1 -1
  256. package/lib/types/request/RequestParameterBuilder.d.ts +3 -3
  257. package/lib/types/request/RequestParameterBuilder.d.ts.map +1 -1
  258. package/lib/types/response/ResponseHandler.d.ts +1 -1
  259. package/lib/types/response/ResponseHandler.d.ts.map +1 -1
  260. package/lib/types/telemetry/performance/IPerformanceClient.d.ts +2 -1
  261. package/lib/types/telemetry/performance/IPerformanceClient.d.ts.map +1 -1
  262. package/lib/types/telemetry/performance/PerformanceClient.d.ts +4 -1
  263. package/lib/types/telemetry/performance/PerformanceClient.d.ts.map +1 -1
  264. package/lib/types/telemetry/performance/PerformanceEvent.d.ts +3 -0
  265. package/lib/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  266. package/lib/types/telemetry/performance/PerformanceEvents.d.ts +1 -0
  267. package/lib/types/telemetry/performance/PerformanceEvents.d.ts.map +1 -1
  268. package/lib/types/utils/Constants.d.ts +5 -0
  269. package/lib/types/utils/Constants.d.ts.map +1 -1
  270. package/lib/types/utils/ProtocolUtils.d.ts +14 -35
  271. package/lib/types/utils/ProtocolUtils.d.ts.map +1 -1
  272. package/lib/types/utils/StateTypes.d.ts +15 -0
  273. package/lib/types/utils/StateTypes.d.ts.map +1 -0
  274. package/package.json +122 -120
  275. package/src/account/AccountInfo.ts +5 -0
  276. package/src/account/AuthToken.ts +22 -0
  277. package/src/account/ClientInfo.ts +5 -1
  278. package/src/account/TokenClaims.ts +4 -0
  279. package/src/authority/AuthorityMetadata.ts +33 -35
  280. package/src/cache/CacheManager.ts +19 -10
  281. package/src/cache/entities/AccountEntity.ts +2 -1
  282. package/src/cache/interface/ICacheManager.ts +12 -4
  283. package/src/cache/utils/AccountEntityUtils.ts +8 -37
  284. package/src/client/AuthorizationCodeClient.ts +128 -19
  285. package/src/client/RefreshTokenClient.ts +88 -13
  286. package/src/client/SilentFlowClient.ts +63 -5
  287. package/src/error/AuthError.ts +6 -0
  288. package/src/error/ClientAuthErrorCodes.ts +1 -0
  289. package/src/error/ClientConfigurationErrorCodes.ts +1 -0
  290. package/src/error/PlatformBrokerError.ts +67 -0
  291. package/src/exports-common.ts +5 -6
  292. package/src/exports-node-only.ts +4 -0
  293. package/src/logger/Logger.ts +150 -2
  294. package/src/network/RequestThumbprint.ts +1 -1
  295. package/src/packageMetadata.ts +1 -1
  296. package/src/protocol/Token.ts +230 -0
  297. package/src/request/BaseAuthRequest.ts +7 -5
  298. package/src/request/CommonAuthorizationCodeRequest.ts +2 -1
  299. package/src/request/CommonAuthorizationUrlRequest.ts +2 -4
  300. package/src/request/CommonRefreshTokenRequest.ts +2 -1
  301. package/src/request/CommonSilentFlowRequest.ts +2 -1
  302. package/src/request/RequestParameterBuilder.ts +5 -5
  303. package/src/response/ResponseHandler.ts +9 -3
  304. package/src/telemetry/performance/IPerformanceClient.ts +3 -1
  305. package/src/telemetry/performance/PerformanceClient.ts +39 -45
  306. package/src/telemetry/performance/PerformanceEvent.ts +7 -0
  307. package/src/telemetry/performance/PerformanceEvents.ts +1 -0
  308. package/src/utils/Constants.ts +6 -0
  309. package/src/utils/ProtocolUtils.ts +66 -92
  310. package/src/utils/StateTypes.ts +20 -0
  311. package/dist/client/BaseClient.d.ts +0 -59
  312. package/dist/client/BaseClient.d.ts.map +0 -1
  313. package/dist/client/BaseClient.mjs +0 -162
  314. package/dist/client/BaseClient.mjs.map +0 -1
  315. package/dist/index-browser.mjs +0 -75
  316. package/dist/index-browser.mjs.map +0 -1
  317. package/lib/index-node-FrCFfFuh.js.map +0 -1
  318. package/lib/types/client/BaseClient.d.ts +0 -59
  319. package/lib/types/client/BaseClient.d.ts.map +0 -1
  320. package/src/client/BaseClient.ts +0 -308
@@ -1,59 +0,0 @@
1
- import { ClientConfiguration, CommonClientConfiguration } from "../config/ClientConfiguration.js";
2
- import { INetworkModule, NetworkRequestOptions } from "../network/INetworkModule.js";
3
- import { NetworkResponse } from "../network/NetworkResponse.js";
4
- import { ICrypto } from "../crypto/ICrypto.js";
5
- import { Authority } from "../authority/Authority.js";
6
- import { Logger } from "../logger/Logger.js";
7
- import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse.js";
8
- import { CacheManager } from "../cache/CacheManager.js";
9
- import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager.js";
10
- import { RequestThumbprint } from "../network/RequestThumbprint.js";
11
- import { CcsCredential } from "../account/CcsCredential.js";
12
- import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
13
- import { BaseAuthRequest } from "../request/BaseAuthRequest.js";
14
- /**
15
- * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
16
- * @internal
17
- */
18
- export declare abstract class BaseClient {
19
- logger: Logger;
20
- protected config: CommonClientConfiguration;
21
- protected cryptoUtils: ICrypto;
22
- protected cacheManager: CacheManager;
23
- protected networkClient: INetworkModule;
24
- protected serverTelemetryManager: ServerTelemetryManager | null;
25
- authority: Authority;
26
- protected performanceClient: IPerformanceClient;
27
- protected constructor(configuration: ClientConfiguration, performanceClient: IPerformanceClient);
28
- /**
29
- * Creates default headers for requests to token endpoint
30
- */
31
- protected createTokenRequestHeaders(ccsCred?: CcsCredential): Record<string, string>;
32
- /**
33
- * Http post to token endpoint
34
- * @param tokenEndpoint
35
- * @param queryString
36
- * @param headers
37
- * @param thumbprint
38
- */
39
- protected executePostToTokenEndpoint(tokenEndpoint: string, queryString: string, headers: Record<string, string>, thumbprint: RequestThumbprint, correlationId: string): Promise<NetworkResponse<ServerAuthorizationTokenResponse>>;
40
- /**
41
- * Wraps sendPostRequestAsync with necessary preflight and postflight logic
42
- * @param thumbprint - Request thumbprint for throttling
43
- * @param tokenEndpoint - Endpoint to make the POST to
44
- * @param options - Body and Headers to include on the POST request
45
- * @param correlationId - CorrelationId for telemetry
46
- */
47
- sendPostRequest<T extends ServerAuthorizationTokenResponse>(thumbprint: RequestThumbprint, tokenEndpoint: string, options: NetworkRequestOptions, correlationId: string): Promise<NetworkResponse<T>>;
48
- /**
49
- * Updates the authority object of the client. Endpoint discovery must be completed.
50
- * @param updatedAuthority
51
- */
52
- updateAuthority(cloudInstanceHostname: string, correlationId: string): Promise<void>;
53
- /**
54
- * Creates query string for the /token request
55
- * @param request
56
- */
57
- createTokenQueryParameters(request: BaseAuthRequest): string;
58
- }
59
- //# sourceMappingURL=BaseClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../../../src/client/BaseClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,mBAAmB,EAEnB,yBAAyB,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACH,cAAc,EACd,qBAAqB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAqB,MAAM,6BAA6B,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAGpF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAYhE;;;GAGG;AACH,8BAAsB,UAAU;IAErB,MAAM,EAAE,MAAM,CAAC;IAGtB,SAAS,CAAC,MAAM,EAAE,yBAAyB,CAAC;IAG5C,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC;IAG/B,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IAGrC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC;IAGxC,SAAS,CAAC,sBAAsB,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAGzD,SAAS,EAAE,SAAS,CAAC;IAG5B,SAAS,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IAEhD,SAAS,aACL,aAAa,EAAE,mBAAmB,EAClC,iBAAiB,EAAE,kBAAkB;IA2BzC;;OAEG;IACH,SAAS,CAAC,yBAAyB,CAC/B,OAAO,CAAC,EAAE,aAAa,GACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IA8BzB;;;;;;OAMG;cACa,0BAA0B,CACtC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,UAAU,EAAE,iBAAiB,EAC7B,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,eAAe,CAAC,gCAAgC,CAAC,CAAC;IAqB7D;;;;;;OAMG;IACG,eAAe,CAAC,CAAC,SAAS,gCAAgC,EAC5D,UAAU,EAAE,iBAAiB,EAC7B,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,qBAAqB,EAC9B,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAwE9B;;;OAGG;IACG,eAAe,CACjB,qBAAqB,EAAE,MAAM,EAC7B,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC;IAchB;;;OAGG;IACH,0BAA0B,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM;CA8B/D"}
@@ -1,308 +0,0 @@
1
- /*
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- import {
7
- ClientConfiguration,
8
- buildClientConfiguration,
9
- CommonClientConfiguration,
10
- } from "../config/ClientConfiguration.js";
11
- import {
12
- INetworkModule,
13
- NetworkRequestOptions,
14
- } from "../network/INetworkModule.js";
15
- import { NetworkResponse } from "../network/NetworkResponse.js";
16
- import { ICrypto } from "../crypto/ICrypto.js";
17
- import { Authority } from "../authority/Authority.js";
18
- import { Logger } from "../logger/Logger.js";
19
- import { HeaderNames, URL_FORM_CONTENT_TYPE } from "../utils/Constants.js";
20
- import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse.js";
21
- import { CacheManager } from "../cache/CacheManager.js";
22
- import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager.js";
23
- import { RequestThumbprint } from "../network/RequestThumbprint.js";
24
- import { version, name } from "../packageMetadata.js";
25
- import { CcsCredential, CcsCredentialType } from "../account/CcsCredential.js";
26
- import { buildClientInfoFromHomeAccountId } from "../account/ClientInfo.js";
27
- import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
28
- import * as RequestParameterBuilder from "../request/RequestParameterBuilder.js";
29
- import * as UrlUtils from "../utils/UrlUtils.js";
30
- import { BaseAuthRequest } from "../request/BaseAuthRequest.js";
31
- import { createDiscoveredInstance } from "../authority/AuthorityFactory.js";
32
- import * as PerformanceEvents from "../telemetry/performance/PerformanceEvents.js";
33
- import { ThrottlingUtils } from "../network/ThrottlingUtils.js";
34
- import { AuthError } from "../error/AuthError.js";
35
- import {
36
- ClientAuthErrorCodes,
37
- createClientAuthError,
38
- } from "../error/ClientAuthError.js";
39
- import { NetworkError } from "../error/NetworkError.js";
40
- import { invokeAsync } from "../utils/FunctionWrappers.js";
41
-
42
- /**
43
- * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
44
- * @internal
45
- */
46
- export abstract class BaseClient {
47
- // Logger object
48
- public logger: Logger;
49
-
50
- // Application config
51
- protected config: CommonClientConfiguration;
52
-
53
- // Crypto Interface
54
- protected cryptoUtils: ICrypto;
55
-
56
- // Storage Interface
57
- protected cacheManager: CacheManager;
58
-
59
- // Network Interface
60
- protected networkClient: INetworkModule;
61
-
62
- // Server Telemetry Manager
63
- protected serverTelemetryManager: ServerTelemetryManager | null;
64
-
65
- // Default authority object
66
- public authority: Authority;
67
-
68
- // Performance telemetry client
69
- protected performanceClient: IPerformanceClient;
70
-
71
- protected constructor(
72
- configuration: ClientConfiguration,
73
- performanceClient: IPerformanceClient
74
- ) {
75
- // Set the configuration
76
- this.config = buildClientConfiguration(configuration);
77
-
78
- // Initialize the logger
79
- this.logger = new Logger(this.config.loggerOptions, name, version);
80
-
81
- // Initialize crypto
82
- this.cryptoUtils = this.config.cryptoInterface;
83
-
84
- // Initialize storage interface
85
- this.cacheManager = this.config.storageInterface;
86
-
87
- // Set the network interface
88
- this.networkClient = this.config.networkInterface;
89
-
90
- // Set TelemetryManager
91
- this.serverTelemetryManager = this.config.serverTelemetryManager;
92
-
93
- // set Authority
94
- this.authority = this.config.authOptions.authority;
95
-
96
- // set performance telemetry client
97
- this.performanceClient = performanceClient;
98
- }
99
-
100
- /**
101
- * Creates default headers for requests to token endpoint
102
- */
103
- protected createTokenRequestHeaders(
104
- ccsCred?: CcsCredential
105
- ): Record<string, string> {
106
- const headers: Record<string, string> = {};
107
- headers[HeaderNames.CONTENT_TYPE] = URL_FORM_CONTENT_TYPE;
108
- if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {
109
- switch (ccsCred.type) {
110
- case CcsCredentialType.HOME_ACCOUNT_ID:
111
- try {
112
- const clientInfo = buildClientInfoFromHomeAccountId(
113
- ccsCred.credential
114
- );
115
- headers[
116
- HeaderNames.CCS_HEADER
117
- ] = `Oid:${clientInfo.uid}@${clientInfo.utid}`;
118
- } catch (e) {
119
- this.logger.verbose(
120
- `Could not parse home account ID for CCS Header: '${e}'`,
121
- ""
122
- );
123
- }
124
- break;
125
- case CcsCredentialType.UPN:
126
- headers[
127
- HeaderNames.CCS_HEADER
128
- ] = `UPN: ${ccsCred.credential}`;
129
- break;
130
- }
131
- }
132
- return headers;
133
- }
134
-
135
- /**
136
- * Http post to token endpoint
137
- * @param tokenEndpoint
138
- * @param queryString
139
- * @param headers
140
- * @param thumbprint
141
- */
142
- protected async executePostToTokenEndpoint(
143
- tokenEndpoint: string,
144
- queryString: string,
145
- headers: Record<string, string>,
146
- thumbprint: RequestThumbprint,
147
- correlationId: string
148
- ): Promise<NetworkResponse<ServerAuthorizationTokenResponse>> {
149
- const response =
150
- await this.sendPostRequest<ServerAuthorizationTokenResponse>(
151
- thumbprint,
152
- tokenEndpoint,
153
- { body: queryString, headers: headers },
154
- correlationId
155
- );
156
-
157
- if (
158
- this.config.serverTelemetryManager &&
159
- response.status < 500 &&
160
- response.status !== 429
161
- ) {
162
- // Telemetry data successfully logged by server, clear Telemetry cache
163
- this.config.serverTelemetryManager.clearTelemetryCache();
164
- }
165
-
166
- return response;
167
- }
168
-
169
- /**
170
- * Wraps sendPostRequestAsync with necessary preflight and postflight logic
171
- * @param thumbprint - Request thumbprint for throttling
172
- * @param tokenEndpoint - Endpoint to make the POST to
173
- * @param options - Body and Headers to include on the POST request
174
- * @param correlationId - CorrelationId for telemetry
175
- */
176
- async sendPostRequest<T extends ServerAuthorizationTokenResponse>(
177
- thumbprint: RequestThumbprint,
178
- tokenEndpoint: string,
179
- options: NetworkRequestOptions,
180
- correlationId: string
181
- ): Promise<NetworkResponse<T>> {
182
- ThrottlingUtils.preProcess(
183
- this.cacheManager,
184
- thumbprint,
185
- correlationId
186
- );
187
-
188
- let response;
189
- try {
190
- response = await invokeAsync(
191
- this.networkClient.sendPostRequestAsync.bind(
192
- this.networkClient
193
- )<T>,
194
- PerformanceEvents.NetworkClientSendPostRequestAsync,
195
- this.logger,
196
- this.performanceClient,
197
- correlationId
198
- )(tokenEndpoint, options);
199
- const responseHeaders = response.headers || {};
200
- this.performanceClient?.addFields(
201
- {
202
- refreshTokenSize: response.body.refresh_token?.length || 0,
203
- httpVerToken:
204
- responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
205
- requestId:
206
- responseHeaders[HeaderNames.X_MS_REQUEST_ID] || "",
207
- },
208
- correlationId
209
- );
210
- } catch (e) {
211
- if (e instanceof NetworkError) {
212
- const responseHeaders = e.responseHeaders;
213
- if (responseHeaders) {
214
- this.performanceClient?.addFields(
215
- {
216
- httpVerToken:
217
- responseHeaders[
218
- HeaderNames.X_MS_HTTP_VERSION
219
- ] || "",
220
- requestId:
221
- responseHeaders[HeaderNames.X_MS_REQUEST_ID] ||
222
- "",
223
- contentTypeHeader:
224
- responseHeaders[HeaderNames.CONTENT_TYPE] ||
225
- undefined,
226
- contentLengthHeader:
227
- responseHeaders[HeaderNames.CONTENT_LENGTH] ||
228
- undefined,
229
- httpStatus: e.httpStatus,
230
- },
231
- correlationId
232
- );
233
- }
234
- throw e.error;
235
- }
236
- if (e instanceof AuthError) {
237
- throw e;
238
- } else {
239
- throw createClientAuthError(ClientAuthErrorCodes.networkError);
240
- }
241
- }
242
-
243
- ThrottlingUtils.postProcess(
244
- this.cacheManager,
245
- thumbprint,
246
- response,
247
- correlationId
248
- );
249
-
250
- return response;
251
- }
252
-
253
- /**
254
- * Updates the authority object of the client. Endpoint discovery must be completed.
255
- * @param updatedAuthority
256
- */
257
- async updateAuthority(
258
- cloudInstanceHostname: string,
259
- correlationId: string
260
- ): Promise<void> {
261
- const cloudInstanceAuthorityUri = `https://${cloudInstanceHostname}/${this.authority.tenant}/`;
262
- const cloudInstanceAuthority = await createDiscoveredInstance(
263
- cloudInstanceAuthorityUri,
264
- this.networkClient,
265
- this.cacheManager,
266
- this.authority.options,
267
- this.logger,
268
- correlationId,
269
- this.performanceClient
270
- );
271
- this.authority = cloudInstanceAuthority;
272
- }
273
-
274
- /**
275
- * Creates query string for the /token request
276
- * @param request
277
- */
278
- createTokenQueryParameters(request: BaseAuthRequest): string {
279
- const parameters = new Map<string, string>();
280
-
281
- if (request.embeddedClientId) {
282
- RequestParameterBuilder.addBrokerParameters(
283
- parameters,
284
- this.config.authOptions.clientId,
285
- this.config.authOptions.redirectUri
286
- );
287
- }
288
-
289
- if (request.tokenQueryParameters) {
290
- RequestParameterBuilder.addExtraQueryParameters(
291
- parameters,
292
- request.tokenQueryParameters
293
- );
294
- }
295
-
296
- RequestParameterBuilder.addCorrelationId(
297
- parameters,
298
- request.correlationId
299
- );
300
-
301
- RequestParameterBuilder.instrumentBrokerParams(
302
- parameters,
303
- request.correlationId,
304
- this.performanceClient
305
- );
306
- return UrlUtils.mapToQueryString(parameters);
307
- }
308
- }