@azure/msal-common 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/dist/_virtual/_tslib.js +90 -0
  4. package/dist/_virtual/_tslib.js.map +1 -0
  5. package/dist/account/AccountInfo.d.ts +30 -0
  6. package/dist/account/AccountInfo.d.ts.map +1 -0
  7. package/dist/account/AuthToken.d.ts +17 -0
  8. package/dist/account/AuthToken.d.ts.map +1 -0
  9. package/dist/account/AuthToken.js +43 -0
  10. package/dist/account/AuthToken.js.map +1 -0
  11. package/dist/account/CcsCredential.d.ts +9 -0
  12. package/dist/account/CcsCredential.d.ts.map +1 -0
  13. package/dist/account/CcsCredential.js +14 -0
  14. package/dist/account/CcsCredential.js.map +1 -0
  15. package/dist/account/ClientCredentials.d.ts +15 -0
  16. package/dist/account/ClientCredentials.d.ts.map +1 -0
  17. package/dist/account/ClientInfo.d.ts +20 -0
  18. package/dist/account/ClientInfo.d.ts.map +1 -0
  19. package/dist/account/ClientInfo.js +44 -0
  20. package/dist/account/ClientInfo.js.map +1 -0
  21. package/dist/account/DecodedAuthToken.d.ts +9 -0
  22. package/dist/account/DecodedAuthToken.d.ts.map +1 -0
  23. package/dist/account/TokenClaims.d.ts +60 -0
  24. package/dist/account/TokenClaims.d.ts.map +1 -0
  25. package/dist/authority/Authority.d.ts +200 -0
  26. package/dist/authority/Authority.d.ts.map +1 -0
  27. package/dist/authority/Authority.js +678 -0
  28. package/dist/authority/Authority.js.map +1 -0
  29. package/dist/authority/AuthorityFactory.d.ts +29 -0
  30. package/dist/authority/AuthorityFactory.d.ts.map +1 -0
  31. package/dist/authority/AuthorityFactory.js +69 -0
  32. package/dist/authority/AuthorityFactory.js.map +1 -0
  33. package/dist/authority/AuthorityMetadata.d.ts +623 -0
  34. package/dist/authority/AuthorityMetadata.d.ts.map +1 -0
  35. package/dist/authority/AuthorityMetadata.js +12 -0
  36. package/dist/authority/AuthorityMetadata.js.map +1 -0
  37. package/dist/authority/AuthorityOptions.d.ts +19 -0
  38. package/dist/authority/AuthorityOptions.d.ts.map +1 -0
  39. package/dist/authority/AuthorityOptions.js +24 -0
  40. package/dist/authority/AuthorityOptions.js.map +1 -0
  41. package/dist/authority/AuthorityType.d.ts +8 -0
  42. package/dist/authority/AuthorityType.d.ts.map +1 -0
  43. package/dist/authority/AuthorityType.js +17 -0
  44. package/dist/authority/AuthorityType.js.map +1 -0
  45. package/dist/authority/AzureRegion.d.ts +2 -0
  46. package/dist/authority/AzureRegion.d.ts.map +1 -0
  47. package/dist/authority/AzureRegionConfiguration.d.ts +6 -0
  48. package/dist/authority/AzureRegionConfiguration.d.ts.map +1 -0
  49. package/dist/authority/CloudDiscoveryMetadata.d.ts +6 -0
  50. package/dist/authority/CloudDiscoveryMetadata.d.ts.map +1 -0
  51. package/dist/authority/CloudInstanceDiscoveryResponse.d.ts +10 -0
  52. package/dist/authority/CloudInstanceDiscoveryResponse.d.ts.map +1 -0
  53. package/dist/authority/CloudInstanceDiscoveryResponse.js +13 -0
  54. package/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -0
  55. package/dist/authority/ImdsOptions.d.ts +7 -0
  56. package/dist/authority/ImdsOptions.d.ts.map +1 -0
  57. package/dist/authority/OpenIdConfigResponse.d.ts +12 -0
  58. package/dist/authority/OpenIdConfigResponse.d.ts.map +1 -0
  59. package/dist/authority/OpenIdConfigResponse.js +15 -0
  60. package/dist/authority/OpenIdConfigResponse.js.map +1 -0
  61. package/dist/authority/ProtocolMode.d.ts +8 -0
  62. package/dist/authority/ProtocolMode.d.ts.map +1 -0
  63. package/dist/authority/ProtocolMode.js +17 -0
  64. package/dist/authority/ProtocolMode.js.map +1 -0
  65. package/dist/authority/RegionDiscovery.d.ts +28 -0
  66. package/dist/authority/RegionDiscovery.d.ts.map +1 -0
  67. package/dist/authority/RegionDiscovery.js +127 -0
  68. package/dist/authority/RegionDiscovery.js.map +1 -0
  69. package/dist/authority/RegionDiscoveryMetadata.d.ts +7 -0
  70. package/dist/authority/RegionDiscoveryMetadata.d.ts.map +1 -0
  71. package/dist/cache/CacheManager.d.ts +393 -0
  72. package/dist/cache/CacheManager.d.ts.map +1 -0
  73. package/dist/cache/CacheManager.js +885 -0
  74. package/dist/cache/CacheManager.js.map +1 -0
  75. package/dist/cache/entities/AccessTokenEntity.d.ts +57 -0
  76. package/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -0
  77. package/dist/cache/entities/AccessTokenEntity.js +124 -0
  78. package/dist/cache/entities/AccessTokenEntity.js.map +1 -0
  79. package/dist/cache/entities/AccountEntity.d.ts +100 -0
  80. package/dist/cache/entities/AccountEntity.d.ts.map +1 -0
  81. package/dist/cache/entities/AccountEntity.js +243 -0
  82. package/dist/cache/entities/AccountEntity.js.map +1 -0
  83. package/dist/cache/entities/AppMetadataEntity.d.ts +40 -0
  84. package/dist/cache/entities/AppMetadataEntity.d.ts.map +1 -0
  85. package/dist/cache/entities/AppMetadataEntity.js +74 -0
  86. package/dist/cache/entities/AppMetadataEntity.js.map +1 -0
  87. package/dist/cache/entities/AuthorityMetadataEntity.d.ts +48 -0
  88. package/dist/cache/entities/AuthorityMetadataEntity.d.ts.map +1 -0
  89. package/dist/cache/entities/AuthorityMetadataEntity.js +82 -0
  90. package/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -0
  91. package/dist/cache/entities/CacheRecord.d.ts +14 -0
  92. package/dist/cache/entities/CacheRecord.d.ts.map +1 -0
  93. package/dist/cache/entities/CacheRecord.js +19 -0
  94. package/dist/cache/entities/CacheRecord.js.map +1 -0
  95. package/dist/cache/entities/CredentialEntity.d.ts +94 -0
  96. package/dist/cache/entities/CredentialEntity.d.ts.map +1 -0
  97. package/dist/cache/entities/CredentialEntity.js +164 -0
  98. package/dist/cache/entities/CredentialEntity.js.map +1 -0
  99. package/dist/cache/entities/IdTokenEntity.d.ts +35 -0
  100. package/dist/cache/entities/IdTokenEntity.d.ts.map +1 -0
  101. package/dist/cache/entities/IdTokenEntity.js +70 -0
  102. package/dist/cache/entities/IdTokenEntity.js.map +1 -0
  103. package/dist/cache/entities/RefreshTokenEntity.d.ts +37 -0
  104. package/dist/cache/entities/RefreshTokenEntity.d.ts.map +1 -0
  105. package/dist/cache/entities/RefreshTokenEntity.js +73 -0
  106. package/dist/cache/entities/RefreshTokenEntity.js.map +1 -0
  107. package/dist/cache/entities/ServerTelemetryEntity.d.ts +13 -0
  108. package/dist/cache/entities/ServerTelemetryEntity.d.ts.map +1 -0
  109. package/dist/cache/entities/ServerTelemetryEntity.js +35 -0
  110. package/dist/cache/entities/ServerTelemetryEntity.js.map +1 -0
  111. package/dist/cache/entities/ThrottlingEntity.d.ts +14 -0
  112. package/dist/cache/entities/ThrottlingEntity.d.ts.map +1 -0
  113. package/dist/cache/entities/ThrottlingEntity.js +32 -0
  114. package/dist/cache/entities/ThrottlingEntity.js.map +1 -0
  115. package/dist/cache/interface/ICacheManager.d.ts +157 -0
  116. package/dist/cache/interface/ICacheManager.d.ts.map +1 -0
  117. package/dist/cache/interface/ICachePlugin.d.ts +6 -0
  118. package/dist/cache/interface/ICachePlugin.d.ts.map +1 -0
  119. package/dist/cache/interface/ISerializableTokenCache.d.ts +5 -0
  120. package/dist/cache/interface/ISerializableTokenCache.d.ts.map +1 -0
  121. package/dist/cache/persistence/TokenCacheContext.d.ts +24 -0
  122. package/dist/cache/persistence/TokenCacheContext.d.ts.map +1 -0
  123. package/dist/cache/persistence/TokenCacheContext.js +39 -0
  124. package/dist/cache/persistence/TokenCacheContext.js.map +1 -0
  125. package/dist/cache/utils/CacheTypes.d.ts +60 -0
  126. package/dist/cache/utils/CacheTypes.d.ts.map +1 -0
  127. package/dist/client/AuthorizationCodeClient.d.ts +76 -0
  128. package/dist/client/AuthorizationCodeClient.d.ts.map +1 -0
  129. package/dist/client/AuthorizationCodeClient.js +468 -0
  130. package/dist/client/AuthorizationCodeClient.js.map +1 -0
  131. package/dist/client/BaseClient.d.ts +45 -0
  132. package/dist/client/BaseClient.d.ts.map +1 -0
  133. package/dist/client/BaseClient.js +103 -0
  134. package/dist/client/BaseClient.js.map +1 -0
  135. package/dist/client/ClientCredentialClient.d.ts +39 -0
  136. package/dist/client/ClientCredentialClient.d.ts.map +1 -0
  137. package/dist/client/ClientCredentialClient.js +202 -0
  138. package/dist/client/ClientCredentialClient.js.map +1 -0
  139. package/dist/client/DeviceCodeClient.d.ts +52 -0
  140. package/dist/client/DeviceCodeClient.d.ts.map +1 -0
  141. package/dist/client/DeviceCodeClient.js +232 -0
  142. package/dist/client/DeviceCodeClient.js.map +1 -0
  143. package/dist/client/OnBehalfOfClient.d.ts +51 -0
  144. package/dist/client/OnBehalfOfClient.d.ts.map +1 -0
  145. package/dist/client/OnBehalfOfClient.js +244 -0
  146. package/dist/client/OnBehalfOfClient.js.map +1 -0
  147. package/dist/client/RefreshTokenClient.d.ts +40 -0
  148. package/dist/client/RefreshTokenClient.d.ts.map +1 -0
  149. package/dist/client/RefreshTokenClient.js +255 -0
  150. package/dist/client/RefreshTokenClient.js.map +1 -0
  151. package/dist/client/SilentFlowClient.d.ts +25 -0
  152. package/dist/client/SilentFlowClient.d.ts.map +1 -0
  153. package/dist/client/SilentFlowClient.js +128 -0
  154. package/dist/client/SilentFlowClient.js.map +1 -0
  155. package/dist/client/UsernamePasswordClient.d.ts +29 -0
  156. package/dist/client/UsernamePasswordClient.d.ts.map +1 -0
  157. package/dist/client/UsernamePasswordClient.js +120 -0
  158. package/dist/client/UsernamePasswordClient.js.map +1 -0
  159. package/dist/config/AppTokenProvider.d.ts +39 -0
  160. package/dist/config/AppTokenProvider.d.ts.map +1 -0
  161. package/dist/config/ClientConfiguration.d.ts +135 -0
  162. package/dist/config/ClientConfiguration.d.ts.map +1 -0
  163. package/dist/config/ClientConfiguration.js +105 -0
  164. package/dist/config/ClientConfiguration.js.map +1 -0
  165. package/dist/crypto/ICrypto.d.ts +63 -0
  166. package/dist/crypto/ICrypto.d.ts.map +1 -0
  167. package/dist/crypto/ICrypto.js +80 -0
  168. package/dist/crypto/ICrypto.js.map +1 -0
  169. package/dist/crypto/IGuidGenerator.d.ts +5 -0
  170. package/dist/crypto/IGuidGenerator.d.ts.map +1 -0
  171. package/dist/crypto/JoseHeader.d.ts +22 -0
  172. package/dist/crypto/JoseHeader.d.ts.map +1 -0
  173. package/dist/crypto/JoseHeader.js +45 -0
  174. package/dist/crypto/JoseHeader.js.map +1 -0
  175. package/dist/crypto/PopTokenGenerator.d.ts +56 -0
  176. package/dist/crypto/PopTokenGenerator.d.ts.map +1 -0
  177. package/dist/crypto/PopTokenGenerator.js +107 -0
  178. package/dist/crypto/PopTokenGenerator.js.map +1 -0
  179. package/dist/crypto/SignedHttpRequest.d.ts +12 -0
  180. package/dist/crypto/SignedHttpRequest.d.ts.map +1 -0
  181. package/dist/error/AuthError.d.ts +48 -0
  182. package/dist/error/AuthError.d.ts.map +1 -0
  183. package/dist/error/AuthError.js +61 -0
  184. package/dist/error/AuthError.js.map +1 -0
  185. package/dist/error/ClientAuthError.d.ts +372 -0
  186. package/dist/error/ClientAuthError.d.ts.map +1 -0
  187. package/dist/error/ClientAuthError.js +477 -0
  188. package/dist/error/ClientAuthError.js.map +1 -0
  189. package/dist/error/ClientConfigurationError.d.ts +199 -0
  190. package/dist/error/ClientConfigurationError.d.ts.map +1 -0
  191. package/dist/error/ClientConfigurationError.js +260 -0
  192. package/dist/error/ClientConfigurationError.js.map +1 -0
  193. package/dist/error/InteractionRequiredAuthError.d.ts +42 -0
  194. package/dist/error/InteractionRequiredAuthError.d.ts.map +1 -0
  195. package/dist/error/InteractionRequiredAuthError.js +80 -0
  196. package/dist/error/InteractionRequiredAuthError.js.map +1 -0
  197. package/dist/error/JoseHeaderError.d.ts +29 -0
  198. package/dist/error/JoseHeaderError.d.ts.map +1 -0
  199. package/dist/error/JoseHeaderError.js +50 -0
  200. package/dist/error/JoseHeaderError.js.map +1 -0
  201. package/dist/error/ServerError.d.ts +8 -0
  202. package/dist/error/ServerError.d.ts.map +1 -0
  203. package/dist/error/ServerError.js +25 -0
  204. package/dist/error/ServerError.js.map +1 -0
  205. package/dist/index.cjs.js +8441 -0
  206. package/dist/index.cjs.js.map +1 -0
  207. package/dist/index.d.ts +90 -0
  208. package/dist/index.d.ts.map +1 -0
  209. package/dist/index.js +53 -0
  210. package/dist/index.js.map +1 -0
  211. package/dist/logger/Logger.d.ts +95 -0
  212. package/dist/logger/Logger.d.ts.map +1 -0
  213. package/dist/logger/Logger.js +185 -0
  214. package/dist/logger/Logger.js.map +1 -0
  215. package/dist/network/INetworkModule.d.ts +31 -0
  216. package/dist/network/INetworkModule.d.ts.map +1 -0
  217. package/dist/network/INetworkModule.js +21 -0
  218. package/dist/network/INetworkModule.js.map +1 -0
  219. package/dist/network/NetworkManager.d.ts +21 -0
  220. package/dist/network/NetworkManager.d.ts.map +1 -0
  221. package/dist/network/NetworkManager.js +56 -0
  222. package/dist/network/NetworkManager.js.map +1 -0
  223. package/dist/network/RequestThumbprint.d.ts +17 -0
  224. package/dist/network/RequestThumbprint.d.ts.map +1 -0
  225. package/dist/network/ThrottlingUtils.d.ts +42 -0
  226. package/dist/network/ThrottlingUtils.d.ts.map +1 -0
  227. package/dist/network/ThrottlingUtils.js +101 -0
  228. package/dist/network/ThrottlingUtils.js.map +1 -0
  229. package/dist/packageMetadata.d.ts +3 -0
  230. package/dist/packageMetadata.d.ts.map +1 -0
  231. package/dist/packageMetadata.js +8 -0
  232. package/dist/packageMetadata.js.map +1 -0
  233. package/dist/request/AuthenticationHeaderParser.d.ts +20 -0
  234. package/dist/request/AuthenticationHeaderParser.d.ts.map +1 -0
  235. package/dist/request/AuthenticationHeaderParser.js +64 -0
  236. package/dist/request/AuthenticationHeaderParser.js.map +1 -0
  237. package/dist/request/BaseAuthRequest.d.ts +34 -0
  238. package/dist/request/BaseAuthRequest.d.ts.map +1 -0
  239. package/dist/request/CommonAuthorizationCodeRequest.d.ts +28 -0
  240. package/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -0
  241. package/dist/request/CommonAuthorizationUrlRequest.d.ts +51 -0
  242. package/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -0
  243. package/dist/request/CommonClientCredentialRequest.d.ts +17 -0
  244. package/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
  245. package/dist/request/CommonDeviceCodeRequest.d.ts +19 -0
  246. package/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
  247. package/dist/request/CommonEndSessionRequest.d.ts +21 -0
  248. package/dist/request/CommonEndSessionRequest.d.ts.map +1 -0
  249. package/dist/request/CommonOnBehalfOfRequest.d.ts +13 -0
  250. package/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
  251. package/dist/request/CommonRefreshTokenRequest.d.ts +21 -0
  252. package/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -0
  253. package/dist/request/CommonSilentFlowRequest.d.ts +20 -0
  254. package/dist/request/CommonSilentFlowRequest.d.ts.map +1 -0
  255. package/dist/request/CommonUsernamePasswordRequest.d.ts +17 -0
  256. package/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
  257. package/dist/request/RequestParameterBuilder.d.ts +217 -0
  258. package/dist/request/RequestParameterBuilder.d.ts.map +1 -0
  259. package/dist/request/RequestParameterBuilder.js +387 -0
  260. package/dist/request/RequestParameterBuilder.js.map +1 -0
  261. package/dist/request/RequestValidator.d.ts +34 -0
  262. package/dist/request/RequestValidator.d.ts.map +1 -0
  263. package/dist/request/RequestValidator.js +92 -0
  264. package/dist/request/RequestValidator.js.map +1 -0
  265. package/dist/request/ScopeSet.d.ts +83 -0
  266. package/dist/request/ScopeSet.d.ts.map +1 -0
  267. package/dist/request/ScopeSet.js +192 -0
  268. package/dist/request/ScopeSet.js.map +1 -0
  269. package/dist/response/AuthenticationResult.d.ts +38 -0
  270. package/dist/response/AuthenticationResult.d.ts.map +1 -0
  271. package/dist/response/AuthorizationCodePayload.d.ts +14 -0
  272. package/dist/response/AuthorizationCodePayload.d.ts.map +1 -0
  273. package/dist/response/DeviceCodeResponse.d.ts +26 -0
  274. package/dist/response/DeviceCodeResponse.d.ts.map +1 -0
  275. package/dist/response/ExternalTokenResponse.d.ts +15 -0
  276. package/dist/response/ExternalTokenResponse.d.ts.map +1 -0
  277. package/dist/response/IMDSBadResponse.d.ts +5 -0
  278. package/dist/response/IMDSBadResponse.d.ts.map +1 -0
  279. package/dist/response/ResponseHandler.d.ts +71 -0
  280. package/dist/response/ResponseHandler.d.ts.map +1 -0
  281. package/dist/response/ResponseHandler.js +293 -0
  282. package/dist/response/ResponseHandler.js.map +1 -0
  283. package/dist/response/ServerAuthorizationCodeResponse.d.ts +22 -0
  284. package/dist/response/ServerAuthorizationCodeResponse.d.ts.map +1 -0
  285. package/dist/response/ServerAuthorizationTokenResponse.d.ts +43 -0
  286. package/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -0
  287. package/dist/telemetry/performance/IPerformanceClient.d.ts +22 -0
  288. package/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -0
  289. package/dist/telemetry/performance/IPerformanceMeasurement.d.ts +6 -0
  290. package/dist/telemetry/performance/IPerformanceMeasurement.d.ts.map +1 -0
  291. package/dist/telemetry/performance/PerformanceClient.d.ts +125 -0
  292. package/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -0
  293. package/dist/telemetry/performance/PerformanceClient.js +281 -0
  294. package/dist/telemetry/performance/PerformanceClient.js.map +1 -0
  295. package/dist/telemetry/performance/PerformanceEvent.d.ts +249 -0
  296. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -0
  297. package/dist/telemetry/performance/PerformanceEvent.js +121 -0
  298. package/dist/telemetry/performance/PerformanceEvent.js.map +1 -0
  299. package/dist/telemetry/performance/StubPerformanceClient.d.ts +13 -0
  300. package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -0
  301. package/dist/telemetry/performance/StubPerformanceClient.js +37 -0
  302. package/dist/telemetry/performance/StubPerformanceClient.js.map +1 -0
  303. package/dist/telemetry/server/ServerTelemetryManager.d.ts +67 -0
  304. package/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -0
  305. package/dist/telemetry/server/ServerTelemetryManager.js +168 -0
  306. package/dist/telemetry/server/ServerTelemetryManager.js.map +1 -0
  307. package/dist/telemetry/server/ServerTelemetryRequest.d.ts +9 -0
  308. package/dist/telemetry/server/ServerTelemetryRequest.d.ts.map +1 -0
  309. package/dist/url/IUri.d.ts +13 -0
  310. package/dist/url/IUri.d.ts.map +1 -0
  311. package/dist/url/UrlString.d.ts +62 -0
  312. package/dist/url/UrlString.d.ts.map +1 -0
  313. package/dist/url/UrlString.js +208 -0
  314. package/dist/url/UrlString.js.map +1 -0
  315. package/dist/utils/Constants.d.ts +340 -0
  316. package/dist/utils/Constants.d.ts.map +1 -0
  317. package/dist/utils/Constants.js +381 -0
  318. package/dist/utils/Constants.js.map +1 -0
  319. package/dist/utils/MsalTypes.d.ts +7 -0
  320. package/dist/utils/MsalTypes.d.ts.map +1 -0
  321. package/dist/utils/ProtocolUtils.d.ts +43 -0
  322. package/dist/utils/ProtocolUtils.d.ts.map +1 -0
  323. package/dist/utils/ProtocolUtils.js +77 -0
  324. package/dist/utils/ProtocolUtils.js.map +1 -0
  325. package/dist/utils/StringUtils.d.ts +54 -0
  326. package/dist/utils/StringUtils.d.ts.map +1 -0
  327. package/dist/utils/StringUtils.js +129 -0
  328. package/dist/utils/StringUtils.js.map +1 -0
  329. package/dist/utils/TimeUtils.d.ts +28 -0
  330. package/dist/utils/TimeUtils.d.ts.map +1 -0
  331. package/dist/utils/TimeUtils.js +53 -0
  332. package/dist/utils/TimeUtils.js.map +1 -0
  333. package/package.json +76 -0
@@ -0,0 +1,34 @@
1
+ import { StringDict } from "../utils/MsalTypes";
2
+ /**
3
+ * Validates server consumable params from the "request" objects
4
+ */
5
+ export declare class RequestValidator {
6
+ /**
7
+ * Utility to check if the `redirectUri` in the request is a non-null value
8
+ * @param redirectUri
9
+ */
10
+ static validateRedirectUri(redirectUri: string): void;
11
+ /**
12
+ * Utility to validate prompt sent by the user in the request
13
+ * @param prompt
14
+ */
15
+ static validatePrompt(prompt: string): void;
16
+ static validateClaims(claims: string): void;
17
+ /**
18
+ * Utility to validate code_challenge and code_challenge_method
19
+ * @param codeChallenge
20
+ * @param codeChallengeMethod
21
+ */
22
+ static validateCodeChallengeParams(codeChallenge: string, codeChallengeMethod: string): void;
23
+ /**
24
+ * Utility to validate code_challenge_method
25
+ * @param codeChallengeMethod
26
+ */
27
+ static validateCodeChallengeMethod(codeChallengeMethod: string): void;
28
+ /**
29
+ * Removes unnecessary or duplicate query parameters from extraQueryParameters
30
+ * @param request
31
+ */
32
+ static sanitizeEQParams(eQParams: StringDict, queryParams: Map<string, string>): StringDict;
33
+ }
34
+ //# sourceMappingURL=RequestValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestValidator.d.ts","sourceRoot":"","sources":["../../src/request/RequestValidator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,qBAAa,gBAAgB;IAEzB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAI,IAAI;IAMtD;;;OAGG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAI,IAAI;IAY5C,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAI,IAAI;IAQ5C;;;;OAIG;IACH,MAAM,CAAC,2BAA2B,CAAC,aAAa,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,GAAI,IAAI;IAQ7F;;;OAGG;IACH,MAAM,CAAC,2BAA2B,CAAC,mBAAmB,EAAE,MAAM,GAAI,IAAI;IAWtE;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAI,UAAU;CAc/F"}
@@ -0,0 +1,92 @@
1
+ /*! @azure/msal-common v0.0.1-alpha.0 2022-08-02 */
2
+ 'use strict';
3
+ import { StringUtils } from '../utils/StringUtils.js';
4
+ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
5
+ import { CodeChallengeMethodValues, PromptValue } from '../utils/Constants.js';
6
+
7
+ /*
8
+ * Copyright (c) Microsoft Corporation. All rights reserved.
9
+ * Licensed under the MIT License.
10
+ */
11
+ /**
12
+ * Validates server consumable params from the "request" objects
13
+ */
14
+ var RequestValidator = /** @class */ (function () {
15
+ function RequestValidator() {
16
+ }
17
+ /**
18
+ * Utility to check if the `redirectUri` in the request is a non-null value
19
+ * @param redirectUri
20
+ */
21
+ RequestValidator.validateRedirectUri = function (redirectUri) {
22
+ if (StringUtils.isEmpty(redirectUri)) {
23
+ throw ClientConfigurationError.createRedirectUriEmptyError();
24
+ }
25
+ };
26
+ /**
27
+ * Utility to validate prompt sent by the user in the request
28
+ * @param prompt
29
+ */
30
+ RequestValidator.validatePrompt = function (prompt) {
31
+ var promptValues = [];
32
+ for (var value in PromptValue) {
33
+ promptValues.push(PromptValue[value]);
34
+ }
35
+ if (promptValues.indexOf(prompt) < 0) {
36
+ throw ClientConfigurationError.createInvalidPromptError(prompt);
37
+ }
38
+ };
39
+ RequestValidator.validateClaims = function (claims) {
40
+ try {
41
+ JSON.parse(claims);
42
+ }
43
+ catch (e) {
44
+ throw ClientConfigurationError.createInvalidClaimsRequestError();
45
+ }
46
+ };
47
+ /**
48
+ * Utility to validate code_challenge and code_challenge_method
49
+ * @param codeChallenge
50
+ * @param codeChallengeMethod
51
+ */
52
+ RequestValidator.validateCodeChallengeParams = function (codeChallenge, codeChallengeMethod) {
53
+ if (StringUtils.isEmpty(codeChallenge) || StringUtils.isEmpty(codeChallengeMethod)) {
54
+ throw ClientConfigurationError.createInvalidCodeChallengeParamsError();
55
+ }
56
+ else {
57
+ this.validateCodeChallengeMethod(codeChallengeMethod);
58
+ }
59
+ };
60
+ /**
61
+ * Utility to validate code_challenge_method
62
+ * @param codeChallengeMethod
63
+ */
64
+ RequestValidator.validateCodeChallengeMethod = function (codeChallengeMethod) {
65
+ if ([
66
+ CodeChallengeMethodValues.PLAIN,
67
+ CodeChallengeMethodValues.S256
68
+ ].indexOf(codeChallengeMethod) < 0) {
69
+ throw ClientConfigurationError.createInvalidCodeChallengeMethodError();
70
+ }
71
+ };
72
+ /**
73
+ * Removes unnecessary or duplicate query parameters from extraQueryParameters
74
+ * @param request
75
+ */
76
+ RequestValidator.sanitizeEQParams = function (eQParams, queryParams) {
77
+ if (!eQParams) {
78
+ return {};
79
+ }
80
+ // Remove any query parameters already included in SSO params
81
+ queryParams.forEach(function (value, key) {
82
+ if (eQParams[key]) {
83
+ delete eQParams[key];
84
+ }
85
+ });
86
+ return eQParams;
87
+ };
88
+ return RequestValidator;
89
+ }());
90
+
91
+ export { RequestValidator };
92
+ //# sourceMappingURL=RequestValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestValidator.js","sources":["../../src/request/RequestValidator.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { PromptValue, CodeChallengeMethodValues} from \"../utils/Constants\";\nimport { StringDict } from \"../utils/MsalTypes\";\n\n/**\n * Validates server consumable params from the \"request\" objects\n */\nexport class RequestValidator {\n\n /**\n * Utility to check if the `redirectUri` in the request is a non-null value\n * @param redirectUri\n */\n static validateRedirectUri(redirectUri: string) : void {\n if (StringUtils.isEmpty(redirectUri)) {\n throw ClientConfigurationError.createRedirectUriEmptyError();\n }\n }\n\n /**\n * Utility to validate prompt sent by the user in the request\n * @param prompt\n */\n static validatePrompt(prompt: string) : void {\n const promptValues = [];\n\n for (const value in PromptValue) {\n promptValues.push(PromptValue[value]);\n }\n\n if (promptValues.indexOf(prompt) < 0) {\n throw ClientConfigurationError.createInvalidPromptError(prompt);\n }\n }\n\n static validateClaims(claims: string) : void {\n try {\n JSON.parse(claims);\n } catch(e) {\n throw ClientConfigurationError.createInvalidClaimsRequestError();\n }\n }\n\n /**\n * Utility to validate code_challenge and code_challenge_method\n * @param codeChallenge\n * @param codeChallengeMethod\n */\n static validateCodeChallengeParams(codeChallenge: string, codeChallengeMethod: string) : void {\n if (StringUtils.isEmpty(codeChallenge) || StringUtils.isEmpty(codeChallengeMethod)) {\n throw ClientConfigurationError.createInvalidCodeChallengeParamsError();\n } else {\n this.validateCodeChallengeMethod(codeChallengeMethod);\n }\n }\n\n /**\n * Utility to validate code_challenge_method\n * @param codeChallengeMethod\n */\n static validateCodeChallengeMethod(codeChallengeMethod: string) : void {\n if (\n [\n CodeChallengeMethodValues.PLAIN,\n CodeChallengeMethodValues.S256\n ].indexOf(codeChallengeMethod) < 0\n ) {\n throw ClientConfigurationError.createInvalidCodeChallengeMethodError();\n }\n }\n\n /**\n * Removes unnecessary or duplicate query parameters from extraQueryParameters\n * @param request\n */\n static sanitizeEQParams(eQParams: StringDict, queryParams: Map<string, string>) : StringDict {\n if (!eQParams) {\n return {};\n }\n\n // Remove any query parameters already included in SSO params\n queryParams.forEach((value, key) => {\n if (eQParams[key]) {\n delete eQParams[key];\n }\n });\n\n return eQParams;\n }\n}\n"],"names":[],"mappings":";;;;;;AAAA;;;AAGG;AAOH;;AAEG;AACH,IAAA,gBAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,gBAAA,GAAA;KAkFC;AAhFG;;;AAGG;IACI,gBAAmB,CAAA,mBAAA,GAA1B,UAA2B,WAAmB,EAAA;AAC1C,QAAA,IAAI,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;AAClC,YAAA,MAAM,wBAAwB,CAAC,2BAA2B,EAAE,CAAC;AAChE,SAAA;KACJ,CAAA;AAED;;;AAGG;IACI,gBAAc,CAAA,cAAA,GAArB,UAA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AAA,CAAA,gBAAgB,GAAvB,UAAwB,QAAoB,EAAE,WAAgC,EAAA;QAC1E,IAAI,CAAC,QAAQ,EAAE;AACX,YAAA,OAAO,EAAE,CAAC;AACb,SAAA;;AAGD,QAAA,WAAW,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,GAAG,EAAA;AAC3B,YAAA,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE;AACf,gBAAA,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;AACxB,aAAA;AACL,SAAC,CAAC,CAAC;AAEH,QAAA,OAAO,QAAQ,CAAC;KACnB,CAAA;IACL,OAAC,gBAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes
3
+ * the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions
4
+ * to ensure uniqueness of strings.
5
+ */
6
+ export declare class ScopeSet {
7
+ private scopes;
8
+ constructor(inputScopes: Array<string>);
9
+ /**
10
+ * Factory method to create ScopeSet from space-delimited string
11
+ * @param inputScopeString
12
+ * @param appClientId
13
+ * @param scopesRequired
14
+ */
15
+ static fromString(inputScopeString: string): ScopeSet;
16
+ /**
17
+ * Used to validate the scopes input parameter requested by the developer.
18
+ * @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.
19
+ * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not
20
+ */
21
+ private validateInputScopes;
22
+ /**
23
+ * Check if a given scope is present in this set of scopes.
24
+ * @param scope
25
+ */
26
+ containsScope(scope: string): boolean;
27
+ /**
28
+ * Check if a set of scopes is present in this set of scopes.
29
+ * @param scopeSet
30
+ */
31
+ containsScopeSet(scopeSet: ScopeSet): boolean;
32
+ /**
33
+ * Check if set of scopes contains only the defaults
34
+ */
35
+ containsOnlyOIDCScopes(): boolean;
36
+ /**
37
+ * Appends single scope if passed
38
+ * @param newScope
39
+ */
40
+ appendScope(newScope: string): void;
41
+ /**
42
+ * Appends multiple scopes if passed
43
+ * @param newScopes
44
+ */
45
+ appendScopes(newScopes: Array<string>): void;
46
+ /**
47
+ * Removes element from set of scopes.
48
+ * @param scope
49
+ */
50
+ removeScope(scope: string): void;
51
+ /**
52
+ * Removes default scopes from set of scopes
53
+ * Primarily used to prevent cache misses if the default scopes are not returned from the server
54
+ */
55
+ removeOIDCScopes(): void;
56
+ /**
57
+ * Combines an array of scopes with the current set of scopes.
58
+ * @param otherScopes
59
+ */
60
+ unionScopeSets(otherScopes: ScopeSet): Set<string>;
61
+ /**
62
+ * Check if scopes intersect between this set and another.
63
+ * @param otherScopes
64
+ */
65
+ intersectingScopeSets(otherScopes: ScopeSet): boolean;
66
+ /**
67
+ * Returns size of set of scopes.
68
+ */
69
+ getScopeCount(): number;
70
+ /**
71
+ * Returns the scopes as an array of string values
72
+ */
73
+ asArray(): Array<string>;
74
+ /**
75
+ * Prints scopes into a space-delimited string
76
+ */
77
+ printScopes(): string;
78
+ /**
79
+ * Prints scopes into a space-delimited lower-case string (used for caching)
80
+ */
81
+ printScopesLowerCase(): string;
82
+ }
83
+ //# sourceMappingURL=ScopeSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopeSet.d.ts","sourceRoot":"","sources":["../../src/request/ScopeSet.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,qBAAa,QAAQ;IAEjB,OAAO,CAAC,MAAM,CAAc;gBAEhB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;IAYtC;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ;IAMrD;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAOrC;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;IAQ7C;;OAEG;IACH,sBAAsB,IAAI,OAAO;IAWjC;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMnC;;;OAGG;IACH,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;IAQ5C;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOhC;;;OAGG;IACH,gBAAgB,IAAI,IAAI;IAMxB;;;OAGG;IACH,cAAc,CAAC,WAAW,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC;IAUlD;;;OAGG;IACH,qBAAqB,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO;IAgBrD;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC;IAMxB;;OAEG;IACH,WAAW,IAAI,MAAM;IAQrB;;OAEG;IACH,oBAAoB,IAAI,MAAM;CAGjC"}
@@ -0,0 +1,192 @@
1
+ /*! @azure/msal-common v0.0.1-alpha.0 2022-08-02 */
2
+ 'use strict';
3
+ import { __spreadArrays } from '../_virtual/_tslib.js';
4
+ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';
5
+ import { StringUtils } from '../utils/StringUtils.js';
6
+ import { ClientAuthError } from '../error/ClientAuthError.js';
7
+ import { OIDC_SCOPES, Constants } from '../utils/Constants.js';
8
+
9
+ /*
10
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11
+ * Licensed under the MIT License.
12
+ */
13
+ /**
14
+ * The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes
15
+ * the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions
16
+ * to ensure uniqueness of strings.
17
+ */
18
+ var ScopeSet = /** @class */ (function () {
19
+ function ScopeSet(inputScopes) {
20
+ var _this = this;
21
+ // Filter empty string and null/undefined array items
22
+ var scopeArr = inputScopes ? StringUtils.trimArrayEntries(__spreadArrays(inputScopes)) : [];
23
+ var filteredInput = scopeArr ? StringUtils.removeEmptyStringsFromArray(scopeArr) : [];
24
+ // Validate and filter scopes (validate function throws if validation fails)
25
+ this.validateInputScopes(filteredInput);
26
+ this.scopes = new Set(); // Iterator in constructor not supported by IE11
27
+ filteredInput.forEach(function (scope) { return _this.scopes.add(scope); });
28
+ }
29
+ /**
30
+ * Factory method to create ScopeSet from space-delimited string
31
+ * @param inputScopeString
32
+ * @param appClientId
33
+ * @param scopesRequired
34
+ */
35
+ ScopeSet.fromString = function (inputScopeString) {
36
+ var scopeString = inputScopeString || Constants.EMPTY_STRING;
37
+ var inputScopes = scopeString.split(" ");
38
+ return new ScopeSet(inputScopes);
39
+ };
40
+ /**
41
+ * Used to validate the scopes input parameter requested by the developer.
42
+ * @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.
43
+ * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not
44
+ */
45
+ ScopeSet.prototype.validateInputScopes = function (inputScopes) {
46
+ // Check if scopes are required but not given or is an empty array
47
+ if (!inputScopes || inputScopes.length < 1) {
48
+ throw ClientConfigurationError.createEmptyScopesArrayError();
49
+ }
50
+ };
51
+ /**
52
+ * Check if a given scope is present in this set of scopes.
53
+ * @param scope
54
+ */
55
+ ScopeSet.prototype.containsScope = function (scope) {
56
+ var lowerCaseScopes = this.printScopesLowerCase().split(" ");
57
+ var lowerCaseScopesSet = new ScopeSet(lowerCaseScopes);
58
+ // compare lowercase scopes
59
+ return !StringUtils.isEmpty(scope) ? lowerCaseScopesSet.scopes.has(scope.toLowerCase()) : false;
60
+ };
61
+ /**
62
+ * Check if a set of scopes is present in this set of scopes.
63
+ * @param scopeSet
64
+ */
65
+ ScopeSet.prototype.containsScopeSet = function (scopeSet) {
66
+ var _this = this;
67
+ if (!scopeSet || scopeSet.scopes.size <= 0) {
68
+ return false;
69
+ }
70
+ return (this.scopes.size >= scopeSet.scopes.size && scopeSet.asArray().every(function (scope) { return _this.containsScope(scope); }));
71
+ };
72
+ /**
73
+ * Check if set of scopes contains only the defaults
74
+ */
75
+ ScopeSet.prototype.containsOnlyOIDCScopes = function () {
76
+ var _this = this;
77
+ var defaultScopeCount = 0;
78
+ OIDC_SCOPES.forEach(function (defaultScope) {
79
+ if (_this.containsScope(defaultScope)) {
80
+ defaultScopeCount += 1;
81
+ }
82
+ });
83
+ return this.scopes.size === defaultScopeCount;
84
+ };
85
+ /**
86
+ * Appends single scope if passed
87
+ * @param newScope
88
+ */
89
+ ScopeSet.prototype.appendScope = function (newScope) {
90
+ if (!StringUtils.isEmpty(newScope)) {
91
+ this.scopes.add(newScope.trim());
92
+ }
93
+ };
94
+ /**
95
+ * Appends multiple scopes if passed
96
+ * @param newScopes
97
+ */
98
+ ScopeSet.prototype.appendScopes = function (newScopes) {
99
+ var _this = this;
100
+ try {
101
+ newScopes.forEach(function (newScope) { return _this.appendScope(newScope); });
102
+ }
103
+ catch (e) {
104
+ throw ClientAuthError.createAppendScopeSetError(e);
105
+ }
106
+ };
107
+ /**
108
+ * Removes element from set of scopes.
109
+ * @param scope
110
+ */
111
+ ScopeSet.prototype.removeScope = function (scope) {
112
+ if (StringUtils.isEmpty(scope)) {
113
+ throw ClientAuthError.createRemoveEmptyScopeFromSetError(scope);
114
+ }
115
+ this.scopes.delete(scope.trim());
116
+ };
117
+ /**
118
+ * Removes default scopes from set of scopes
119
+ * Primarily used to prevent cache misses if the default scopes are not returned from the server
120
+ */
121
+ ScopeSet.prototype.removeOIDCScopes = function () {
122
+ var _this = this;
123
+ OIDC_SCOPES.forEach(function (defaultScope) {
124
+ _this.scopes.delete(defaultScope);
125
+ });
126
+ };
127
+ /**
128
+ * Combines an array of scopes with the current set of scopes.
129
+ * @param otherScopes
130
+ */
131
+ ScopeSet.prototype.unionScopeSets = function (otherScopes) {
132
+ if (!otherScopes) {
133
+ throw ClientAuthError.createEmptyInputScopeSetError();
134
+ }
135
+ var unionScopes = new Set(); // Iterator in constructor not supported in IE11
136
+ otherScopes.scopes.forEach(function (scope) { return unionScopes.add(scope.toLowerCase()); });
137
+ this.scopes.forEach(function (scope) { return unionScopes.add(scope.toLowerCase()); });
138
+ return unionScopes;
139
+ };
140
+ /**
141
+ * Check if scopes intersect between this set and another.
142
+ * @param otherScopes
143
+ */
144
+ ScopeSet.prototype.intersectingScopeSets = function (otherScopes) {
145
+ if (!otherScopes) {
146
+ throw ClientAuthError.createEmptyInputScopeSetError();
147
+ }
148
+ // Do not allow OIDC scopes to be the only intersecting scopes
149
+ if (!otherScopes.containsOnlyOIDCScopes()) {
150
+ otherScopes.removeOIDCScopes();
151
+ }
152
+ var unionScopes = this.unionScopeSets(otherScopes);
153
+ var sizeOtherScopes = otherScopes.getScopeCount();
154
+ var sizeThisScopes = this.getScopeCount();
155
+ var sizeUnionScopes = unionScopes.size;
156
+ return sizeUnionScopes < (sizeThisScopes + sizeOtherScopes);
157
+ };
158
+ /**
159
+ * Returns size of set of scopes.
160
+ */
161
+ ScopeSet.prototype.getScopeCount = function () {
162
+ return this.scopes.size;
163
+ };
164
+ /**
165
+ * Returns the scopes as an array of string values
166
+ */
167
+ ScopeSet.prototype.asArray = function () {
168
+ var array = [];
169
+ this.scopes.forEach(function (val) { return array.push(val); });
170
+ return array;
171
+ };
172
+ /**
173
+ * Prints scopes into a space-delimited string
174
+ */
175
+ ScopeSet.prototype.printScopes = function () {
176
+ if (this.scopes) {
177
+ var scopeArr = this.asArray();
178
+ return scopeArr.join(" ");
179
+ }
180
+ return Constants.EMPTY_STRING;
181
+ };
182
+ /**
183
+ * Prints scopes into a space-delimited lower-case string (used for caching)
184
+ */
185
+ ScopeSet.prototype.printScopesLowerCase = function () {
186
+ return this.printScopes().toLowerCase();
187
+ };
188
+ return ScopeSet;
189
+ }());
190
+
191
+ export { ScopeSet };
192
+ //# sourceMappingURL=ScopeSet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopeSet.js","sources":["../../src/request/ScopeSet.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\nimport { StringUtils } from \"../utils/StringUtils\";\nimport { ClientAuthError } from \"../error/ClientAuthError\";\nimport { Constants, OIDC_SCOPES } from \"../utils/Constants\";\n\n/**\n * The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes\n * the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions\n * to ensure uniqueness of strings.\n */\nexport class ScopeSet {\n // Scopes as a Set of strings\n private scopes: Set<string>;\n\n constructor(inputScopes: Array<string>) {\n // Filter empty string and null/undefined array items\n const scopeArr = inputScopes ? StringUtils.trimArrayEntries([...inputScopes]) : [];\n const filteredInput = scopeArr ? StringUtils.removeEmptyStringsFromArray(scopeArr) : [];\n\n // Validate and filter scopes (validate function throws if validation fails)\n this.validateInputScopes(filteredInput);\n\n this.scopes = new Set<string>(); // Iterator in constructor not supported by IE11\n filteredInput.forEach(scope => this.scopes.add(scope));\n }\n\n /**\n * Factory method to create ScopeSet from space-delimited string\n * @param inputScopeString\n * @param appClientId\n * @param scopesRequired\n */\n static fromString(inputScopeString: string): ScopeSet {\n const scopeString = inputScopeString || Constants.EMPTY_STRING;\n const inputScopes: Array<string> = scopeString.split(\" \");\n return new ScopeSet(inputScopes);\n }\n\n /**\n * Used to validate the scopes input parameter requested by the developer.\n * @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\n * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not\n */\n private validateInputScopes(inputScopes: Array<string>): void {\n // Check if scopes are required but not given or is an empty array\n if (!inputScopes || inputScopes.length < 1) {\n throw ClientConfigurationError.createEmptyScopesArrayError();\n }\n }\n\n /**\n * Check if a given scope is present in this set of scopes.\n * @param scope\n */\n containsScope(scope: string): boolean {\n const lowerCaseScopes = this.printScopesLowerCase().split(\" \");\n const lowerCaseScopesSet = new ScopeSet(lowerCaseScopes);\n // compare lowercase scopes\n return !StringUtils.isEmpty(scope) ? lowerCaseScopesSet.scopes.has(scope.toLowerCase()) : false;\n }\n\n /**\n * Check if a set of scopes is present in this set of scopes.\n * @param scopeSet\n */\n containsScopeSet(scopeSet: ScopeSet): boolean {\n if (!scopeSet || scopeSet.scopes.size <= 0) {\n return false;\n }\n\n return (this.scopes.size >= scopeSet.scopes.size && scopeSet.asArray().every(scope => this.containsScope(scope)));\n }\n\n /**\n * Check if set of scopes contains only the defaults\n */\n containsOnlyOIDCScopes(): boolean {\n let defaultScopeCount = 0;\n OIDC_SCOPES.forEach((defaultScope: string) => {\n if (this.containsScope(defaultScope)) {\n defaultScopeCount += 1;\n }\n });\n\n return this.scopes.size === defaultScopeCount;\n }\n\n /**\n * Appends single scope if passed\n * @param newScope\n */\n appendScope(newScope: string): void {\n if (!StringUtils.isEmpty(newScope)) {\n this.scopes.add(newScope.trim());\n }\n }\n\n /**\n * Appends multiple scopes if passed\n * @param newScopes\n */\n appendScopes(newScopes: Array<string>): void {\n try {\n newScopes.forEach(newScope => this.appendScope(newScope));\n } catch (e) {\n throw ClientAuthError.createAppendScopeSetError(e);\n }\n }\n\n /**\n * Removes element from set of scopes.\n * @param scope\n */\n removeScope(scope: string): void {\n if (StringUtils.isEmpty(scope)) {\n throw ClientAuthError.createRemoveEmptyScopeFromSetError(scope);\n }\n this.scopes.delete(scope.trim());\n }\n\n /**\n * Removes default scopes from set of scopes\n * Primarily used to prevent cache misses if the default scopes are not returned from the server\n */\n removeOIDCScopes(): void {\n OIDC_SCOPES.forEach((defaultScope: string) => {\n this.scopes.delete(defaultScope);\n });\n }\n\n /**\n * Combines an array of scopes with the current set of scopes.\n * @param otherScopes\n */\n unionScopeSets(otherScopes: ScopeSet): Set<string> {\n if (!otherScopes) {\n throw ClientAuthError.createEmptyInputScopeSetError();\n }\n const unionScopes = new Set<string>(); // Iterator in constructor not supported in IE11\n otherScopes.scopes.forEach(scope => unionScopes.add(scope.toLowerCase()));\n this.scopes.forEach(scope => unionScopes.add(scope.toLowerCase()));\n return unionScopes;\n }\n\n /**\n * Check if scopes intersect between this set and another.\n * @param otherScopes\n */\n intersectingScopeSets(otherScopes: ScopeSet): boolean {\n if (!otherScopes) {\n throw ClientAuthError.createEmptyInputScopeSetError();\n }\n \n // Do not allow OIDC scopes to be the only intersecting scopes\n if (!otherScopes.containsOnlyOIDCScopes()) {\n otherScopes.removeOIDCScopes();\n }\n const unionScopes = this.unionScopeSets(otherScopes);\n const sizeOtherScopes = otherScopes.getScopeCount();\n const sizeThisScopes = this.getScopeCount();\n const sizeUnionScopes = unionScopes.size;\n return sizeUnionScopes < (sizeThisScopes + sizeOtherScopes);\n }\n\n /**\n * Returns size of set of scopes.\n */\n getScopeCount(): number {\n return this.scopes.size;\n }\n\n /**\n * Returns the scopes as an array of string values\n */\n asArray(): Array<string> {\n const array: Array<string> = [];\n this.scopes.forEach(val => array.push(val));\n return array;\n }\n\n /**\n * Prints scopes into a space-delimited string\n */\n printScopes(): string {\n if (this.scopes) {\n const scopeArr = this.asArray();\n return scopeArr.join(\" \");\n }\n return Constants.EMPTY_STRING;\n }\n\n /**\n * Prints scopes into a space-delimited lower-case string (used for caching)\n */\n printScopesLowerCase(): string {\n return this.printScopes().toLowerCase();\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;AAGG;AAOH;;;;AAIG;AACH,IAAA,QAAA,kBAAA,YAAA;AAII,IAAA,SAAA,QAAA,CAAY,WAA0B,EAAA;QAAtC,IAUC,KAAA,GAAA,IAAA,CAAA;;AARG,QAAA,IAAM,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC,gBAAgB,CAAA,cAAA,CAAK,WAAW,CAAE,CAAA,GAAG,EAAE,CAAC;AACnF,QAAA,IAAM,aAAa,GAAG,QAAQ,GAAG,WAAW,CAAC,2BAA2B,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;;AAGxF,QAAA,IAAI,CAAC,mBAAmB,CAAC,aAAa,C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C,CAAC;AAC7B,SAAA;QACD,OAAO,SAAS,CAAC,YAAY,CAAC;KACjC,CAAA;AAED;;AAEG;AACH,IAAA,QAAA,CAAA,SAAA,CAAA,oBAAoB,GAApB,YAAA;AACI,QAAA,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,CAAC;KAC3C,CAAA;IACL,OAAC,QAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
@@ -0,0 +1,38 @@
1
+ import { AccountInfo } from "../account/AccountInfo";
2
+ /**
3
+ * Result returned from the authority's token endpoint.
4
+ * - uniqueId - `oid` or `sub` claim from ID token
5
+ * - tenantId - `tid` claim from ID token
6
+ * - scopes - Scopes that are validated for the respective token
7
+ * - account - An account object representation of the currently signed-in user
8
+ * - idToken - Id token received as part of the response
9
+ * - idTokenClaims - MSAL-relevant ID token claims
10
+ * - accessToken - Access token or SSH certificate received as part of the response
11
+ * - fromCache - Boolean denoting whether token came from cache
12
+ * - expiresOn - Javascript Date object representing relative expiration of access token
13
+ * - extExpiresOn - Javascript Date object representing extended relative expiration of access token in case of server outage
14
+ * - state - Value passed in by user in request
15
+ * - familyId - Family ID identifier, usually only used for refresh tokens
16
+ */
17
+ export declare type AuthenticationResult = {
18
+ authority: string;
19
+ uniqueId: string;
20
+ tenantId: string;
21
+ scopes: Array<string>;
22
+ account: AccountInfo | null;
23
+ idToken: string;
24
+ idTokenClaims: object;
25
+ accessToken: string;
26
+ fromCache: boolean;
27
+ expiresOn: Date | null;
28
+ tokenType: string;
29
+ correlationId: string;
30
+ extExpiresOn?: Date;
31
+ state?: string;
32
+ familyId?: string;
33
+ cloudGraphHostName?: string;
34
+ msGraphHost?: string;
35
+ code?: string;
36
+ fromNativeBroker?: boolean;
37
+ };
38
+ //# sourceMappingURL=AuthenticationResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticationResult.d.ts","sourceRoot":"","sources":["../../src/response/AuthenticationResult.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,oBAAY,oBAAoB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Response returned after processing the code response query string or fragment.
3
+ */
4
+ export declare type AuthorizationCodePayload = {
5
+ code: string;
6
+ cloud_instance_name?: string;
7
+ cloud_instance_host_name?: string;
8
+ cloud_graph_host_name?: string;
9
+ msgraph_host?: string;
10
+ state?: string;
11
+ nonce?: string;
12
+ client_info?: string;
13
+ };
14
+ //# sourceMappingURL=AuthorizationCodePayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthorizationCodePayload.d.ts","sourceRoot":"","sources":["../../src/response/AuthorizationCodePayload.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,wBAAwB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * DeviceCode returned by the security token service device code endpoint containing information necessary for device code flow.
3
+ * - userCode: code which user needs to provide when authenticating at the verification URI
4
+ * - deviceCode: code which should be included in the request for the access token
5
+ * - verificationUri: URI where user can authenticate
6
+ * - expiresIn: expiration time of the device code in seconds
7
+ * - interval: interval at which the STS should be polled at
8
+ * - message: message which should be displayed to the user
9
+ */
10
+ export declare type DeviceCodeResponse = {
11
+ userCode: string;
12
+ deviceCode: string;
13
+ verificationUri: string;
14
+ expiresIn: number;
15
+ interval: number;
16
+ message: string;
17
+ };
18
+ export declare type ServerDeviceCodeResponse = {
19
+ user_code: string;
20
+ device_code: string;
21
+ verification_uri: string;
22
+ expires_in: number;
23
+ interval: number;
24
+ message: string;
25
+ };
26
+ //# sourceMappingURL=DeviceCodeResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceCodeResponse.d.ts","sourceRoot":"","sources":["../../src/response/DeviceCodeResponse.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,oBAAY,kBAAkB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { ServerAuthorizationTokenResponse } from "./ServerAuthorizationTokenResponse";
2
+ /**
3
+ * Response object used for loading external tokens to cache.
4
+ * - token_type: Indicates the token type value. The only type that Azure AD supports is Bearer.
5
+ * - scope: The scopes that the access_token is valid for.
6
+ * - expires_in: How long the access token is valid (in seconds).
7
+ * - id_token: A JSON Web Token (JWT). The app can decode the segments of this token to request information about the user who signed in.
8
+ * - access_token: The requested access token. The app can use this token to authenticate to the secured resource, such as a web API.
9
+ * - client_info: Client info object
10
+ */
11
+ export declare type ExternalTokenResponse = Pick<ServerAuthorizationTokenResponse, "token_type" | "scope" | "expires_in" | "id_token"> & {
12
+ access_token?: string;
13
+ client_info?: string;
14
+ };
15
+ //# sourceMappingURL=ExternalTokenResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExternalTokenResponse.d.ts","sourceRoot":"","sources":["../../src/response/ExternalTokenResponse.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF;;;;;;;;GAQG;AACH,oBAAY,qBAAqB,GAAG,IAAI,CAAC,gCAAgC,EAAE,YAAY,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,CAAC,GAAG;IAC7H,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;CACvB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare type IMDSBadResponse = {
2
+ error: string;
3
+ "newest-versions": Array<string>;
4
+ };
5
+ //# sourceMappingURL=IMDSBadResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IMDSBadResponse.d.ts","sourceRoot":"","sources":["../../src/response/IMDSBadResponse.ts"],"names":[],"mappings":"AAKA,oBAAY,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACpC,CAAC"}
@@ -0,0 +1,71 @@
1
+ import { ServerAuthorizationTokenResponse } from "./ServerAuthorizationTokenResponse";
2
+ import { ICrypto } from "../crypto/ICrypto";
3
+ import { ServerAuthorizationCodeResponse } from "./ServerAuthorizationCodeResponse";
4
+ import { Logger } from "../logger/Logger";
5
+ import { AuthToken } from "../account/AuthToken";
6
+ import { AuthenticationResult } from "./AuthenticationResult";
7
+ import { Authority } from "../authority/Authority";
8
+ import { CacheRecord } from "../cache/entities/CacheRecord";
9
+ import { CacheManager } from "../cache/CacheManager";
10
+ import { RequestStateObject } from "../utils/ProtocolUtils";
11
+ import { ICachePlugin } from "../cache/interface/ICachePlugin";
12
+ import { ISerializableTokenCache } from "../cache/interface/ISerializableTokenCache";
13
+ import { AuthorizationCodePayload } from "./AuthorizationCodePayload";
14
+ import { BaseAuthRequest } from "../request/BaseAuthRequest";
15
+ /**
16
+ * Class that handles response parsing.
17
+ */
18
+ export declare class ResponseHandler {
19
+ private clientId;
20
+ private cacheStorage;
21
+ private cryptoObj;
22
+ private logger;
23
+ private homeAccountIdentifier;
24
+ private serializableCache;
25
+ private persistencePlugin;
26
+ constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache: ISerializableTokenCache | null, persistencePlugin: ICachePlugin | null);
27
+ /**
28
+ * Function which validates server authorization code response.
29
+ * @param serverResponseHash
30
+ * @param cachedState
31
+ * @param cryptoObj
32
+ */
33
+ validateServerAuthorizationCodeResponse(serverResponseHash: ServerAuthorizationCodeResponse, cachedState: string, cryptoObj: ICrypto): void;
34
+ /**
35
+ * Function which validates server authorization token response.
36
+ * @param serverResponse
37
+ */
38
+ validateTokenResponse(serverResponse: ServerAuthorizationTokenResponse): void;
39
+ /**
40
+ * Returns a constructed token response based on given string. Also manages the cache updates and cleanups.
41
+ * @param serverTokenResponse
42
+ * @param authority
43
+ */
44
+ handleServerTokenResponse(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, reqTimestamp: number, request: BaseAuthRequest, authCodePayload?: AuthorizationCodePayload, userAssertionHash?: string, handlingRefreshTokenResponse?: boolean, forceCacheRefreshTokenResponse?: boolean): Promise<AuthenticationResult>;
45
+ /**
46
+ * Generates CacheRecord
47
+ * @param serverTokenResponse
48
+ * @param idTokenObj
49
+ * @param authority
50
+ */
51
+ private generateCacheRecord;
52
+ /**
53
+ * Generate Account
54
+ * @param serverTokenResponse
55
+ * @param idToken
56
+ * @param authority
57
+ */
58
+ private generateAccountEntity;
59
+ /**
60
+ * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
61
+ *
62
+ * Optionally takes a state string that is set as-is in the response.
63
+ *
64
+ * @param cacheRecord
65
+ * @param idTokenObj
66
+ * @param fromTokenCache
67
+ * @param stateString
68
+ */
69
+ static generateAuthenticationResult(cryptoObj: ICrypto, authority: Authority, cacheRecord: CacheRecord, fromTokenCache: boolean, request: BaseAuthRequest, idTokenObj?: AuthToken, requestState?: RequestStateObject, code?: string): Promise<AuthenticationResult>;
70
+ }
71
+ //# sourceMappingURL=ResponseHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponseHandler.d.ts","sourceRoot":"","sources":["../../src/response/ResponseHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE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