@okta/okta-auth-js 5.6.0 → 5.9.1

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 (405) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +28 -1
  3. package/cjs/OktaAuth.js +69 -35
  4. package/cjs/OktaAuth.js.map +1 -1
  5. package/cjs/OktaUserAgent.js +2 -2
  6. package/cjs/StorageManager.js +8 -0
  7. package/cjs/StorageManager.js.map +1 -1
  8. package/cjs/TransactionManager.js +24 -12
  9. package/cjs/TransactionManager.js.map +1 -1
  10. package/cjs/builderUtil.js +6 -0
  11. package/cjs/builderUtil.js.map +1 -1
  12. package/cjs/constants.js +3 -1
  13. package/cjs/constants.js.map +1 -1
  14. package/cjs/features.js +1 -1
  15. package/cjs/features.js.map +1 -1
  16. package/cjs/idx/authenticate.js +3 -18
  17. package/cjs/idx/authenticate.js.map +1 -1
  18. package/cjs/idx/flow/AuthenticationFlow.js +30 -0
  19. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
  20. package/cjs/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.js +0 -0
  21. package/cjs/idx/flow/AuthenticationFlowMonitor.js.map +1 -0
  22. package/cjs/idx/{flowMonitors → flow}/FlowMonitor.js +0 -0
  23. package/cjs/idx/flow/FlowMonitor.js.map +1 -0
  24. package/cjs/idx/flow/FlowSpecification.js +49 -0
  25. package/cjs/idx/flow/FlowSpecification.js.map +1 -0
  26. package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
  27. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
  28. package/cjs/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.js +0 -0
  29. package/cjs/idx/flow/PasswordRecoveryFlowMonitor.js.map +1 -0
  30. package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +15 -12
  31. package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
  32. package/cjs/idx/{flowMonitors → flow}/RegistrationFlowMonitor.js +0 -0
  33. package/cjs/idx/flow/RegistrationFlowMonitor.js.map +1 -0
  34. package/cjs/idx/flow/RemediationFlow.js +2 -0
  35. package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
  36. package/cjs/idx/flow/index.js +119 -0
  37. package/cjs/idx/flow/index.js.map +1 -0
  38. package/cjs/idx/index.js +26 -0
  39. package/cjs/idx/index.js.map +1 -1
  40. package/cjs/idx/interact.js +5 -2
  41. package/cjs/idx/interact.js.map +1 -1
  42. package/cjs/idx/introspect.js +24 -7
  43. package/cjs/idx/introspect.js.map +1 -1
  44. package/cjs/idx/proceed.js +49 -0
  45. package/cjs/idx/proceed.js.map +1 -0
  46. package/cjs/idx/recoverPassword.js +3 -17
  47. package/cjs/idx/recoverPassword.js.map +1 -1
  48. package/cjs/idx/register.js +7 -16
  49. package/cjs/idx/register.js.map +1 -1
  50. package/cjs/idx/remediate.js +33 -37
  51. package/cjs/idx/remediate.js.map +1 -1
  52. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  53. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +3 -1
  54. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  55. package/cjs/idx/remediators/Identify.js +4 -2
  56. package/cjs/idx/remediators/Identify.js.map +1 -1
  57. package/cjs/idx/run.js +36 -8
  58. package/cjs/idx/run.js.map +1 -1
  59. package/cjs/idx/startTransaction.js +2 -0
  60. package/cjs/idx/startTransaction.js.map +1 -1
  61. package/cjs/idx/transactionMeta.js +77 -39
  62. package/cjs/idx/transactionMeta.js.map +1 -1
  63. package/cjs/idx/types/FlowIdentifier.js +2 -0
  64. package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
  65. package/cjs/idx/types/idx-js.js +5 -0
  66. package/cjs/idx/types/idx-js.js.map +1 -1
  67. package/cjs/idx/types/index.js +16 -0
  68. package/cjs/idx/types/index.js.map +1 -1
  69. package/cjs/oidc/endpoints/authorize.js +4 -1
  70. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  71. package/cjs/oidc/getToken.js +14 -9
  72. package/cjs/oidc/getToken.js.map +1 -1
  73. package/cjs/oidc/getWithPopup.js +9 -2
  74. package/cjs/oidc/getWithPopup.js.map +1 -1
  75. package/cjs/oidc/getWithRedirect.js +2 -6
  76. package/cjs/oidc/getWithRedirect.js.map +1 -1
  77. package/cjs/oidc/renewTokens.js +28 -5
  78. package/cjs/oidc/renewTokens.js.map +1 -1
  79. package/cjs/oidc/util/browser.js +1 -13
  80. package/cjs/oidc/util/browser.js.map +1 -1
  81. package/cjs/oidc/util/loginRedirect.js +9 -5
  82. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  83. package/cjs/oidc/util/urlParams.js +1 -1
  84. package/cjs/oidc/util/urlParams.js.map +1 -1
  85. package/cjs/options.js +12 -2
  86. package/cjs/options.js.map +1 -1
  87. package/cjs/server/serverStorage.js +2 -1
  88. package/cjs/server/serverStorage.js.map +1 -1
  89. package/cjs/tx/AuthTransaction.js +1 -3
  90. package/cjs/tx/AuthTransaction.js.map +1 -1
  91. package/cjs/tx/api.js +3 -0
  92. package/cjs/tx/api.js.map +1 -1
  93. package/cjs/types/Transaction.js.map +1 -1
  94. package/{esm/clock.js → cjs/util/emailVerify.js} +14 -18
  95. package/cjs/util/emailVerify.js.map +1 -0
  96. package/cjs/util/index.js +13 -0
  97. package/cjs/util/index.js.map +1 -1
  98. package/dist/okta-auth-js.min.js +2 -74
  99. package/dist/okta-auth-js.min.js.LICENSE.txt +32 -0
  100. package/dist/okta-auth-js.min.js.map +1 -1
  101. package/dist/okta-auth-js.polyfill.js +2 -18
  102. package/{esm/crypto/webcrypto.js → dist/okta-auth-js.polyfill.js.LICENSE.txt} +8 -4
  103. package/dist/okta-auth-js.polyfill.js.map +1 -1
  104. package/dist/okta-auth-js.umd.js +2 -74
  105. package/dist/okta-auth-js.umd.js.LICENSE.txt +32 -0
  106. package/dist/okta-auth-js.umd.js.map +1 -1
  107. package/esm/index.js +8368 -16
  108. package/esm/index.js.map +1 -1
  109. package/lib/OktaAuth.d.ts +7 -3
  110. package/lib/StorageManager.d.ts +1 -0
  111. package/lib/TransactionManager.d.ts +5 -1
  112. package/lib/constants.d.ts +1 -0
  113. package/lib/crypto/base64.d.ts +2 -2
  114. package/lib/crypto/oidcHash.d.ts +1 -1
  115. package/lib/crypto/verifyToken.d.ts +1 -1
  116. package/{esm/oidc/endpoints/index.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -5
  117. package/lib/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.d.ts +0 -0
  118. package/lib/idx/{flowMonitors → flow}/FlowMonitor.d.ts +0 -0
  119. package/lib/idx/flow/FlowSpecification.d.ts +10 -0
  120. package/{esm/crypto/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -6
  121. package/lib/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.d.ts +0 -0
  122. package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
  123. package/lib/idx/{flowMonitors → flow}/RegistrationFlowMonitor.d.ts +0 -0
  124. package/lib/idx/flow/RemediationFlow.d.ts +13 -0
  125. package/lib/idx/{flowMonitors → flow}/index.d.ts +7 -2
  126. package/lib/idx/index.d.ts +2 -0
  127. package/lib/idx/introspect.d.ts +2 -1
  128. package/{esm/errors/AuthApiError.js → lib/idx/proceed.d.ts} +9 -19
  129. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +1 -4
  130. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +1 -4
  131. package/lib/idx/remediators/Identify.d.ts +1 -0
  132. package/lib/idx/run.d.ts +9 -9
  133. package/lib/idx/transactionMeta.d.ts +28 -4
  134. package/lib/idx/types/FlowIdentifier.d.ts +1 -0
  135. package/lib/idx/types/idx-js.d.ts +4 -0
  136. package/lib/idx/types/index.d.ts +14 -3
  137. package/lib/oidc/getToken.d.ts +2 -2
  138. package/lib/oidc/renewTokens.d.ts +0 -12
  139. package/lib/oidc/util/loginRedirect.d.ts +1 -1
  140. package/lib/types/OktaAuthOptions.d.ts +2 -0
  141. package/lib/types/Transaction.d.ts +2 -0
  142. package/lib/types/api.d.ts +20 -5
  143. package/{esm/errors/AuthPollStopError.js → lib/util/emailVerify.d.ts} +5 -8
  144. package/lib/util/index.d.ts +1 -0
  145. package/package.json +26 -14
  146. package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  147. package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
  148. package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  149. package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  150. package/cjs/idx/flowMonitors/index.js +0 -54
  151. package/cjs/idx/flowMonitors/index.js.map +0 -1
  152. package/esm/AuthStateManager.js +0 -214
  153. package/esm/AuthStateManager.js.map +0 -1
  154. package/esm/OktaAuth.js +0 -679
  155. package/esm/OktaAuth.js.map +0 -1
  156. package/esm/OktaUserAgent.js +0 -49
  157. package/esm/OktaUserAgent.js.map +0 -1
  158. package/esm/PromiseQueue.js +0 -71
  159. package/esm/PromiseQueue.js.map +0 -1
  160. package/esm/SavedObject.js +0 -91
  161. package/esm/SavedObject.js.map +0 -1
  162. package/esm/StorageManager.js +0 -182
  163. package/esm/StorageManager.js.map +0 -1
  164. package/esm/TokenManager.js +0 -455
  165. package/esm/TokenManager.js.map +0 -1
  166. package/esm/TransactionManager.js +0 -316
  167. package/esm/TransactionManager.js.map +0 -1
  168. package/esm/browser/browserStorage.js +0 -256
  169. package/esm/browser/browserStorage.js.map +0 -1
  170. package/esm/browser/fingerprint.js +0 -74
  171. package/esm/browser/fingerprint.js.map +0 -1
  172. package/esm/builderUtil.js +0 -50
  173. package/esm/builderUtil.js.map +0 -1
  174. package/esm/clock.js.map +0 -1
  175. package/esm/constants.js +0 -35
  176. package/esm/constants.js.map +0 -1
  177. package/esm/crypto/base64.js +0 -66
  178. package/esm/crypto/base64.js.map +0 -1
  179. package/esm/crypto/browser.js.map +0 -1
  180. package/esm/crypto/index.js.map +0 -1
  181. package/esm/crypto/node.js +0 -54
  182. package/esm/crypto/node.js.map +0 -1
  183. package/esm/crypto/oidcHash.js +0 -27
  184. package/esm/crypto/oidcHash.js.map +0 -1
  185. package/esm/crypto/verifyToken.js +0 -39
  186. package/esm/crypto/verifyToken.js.map +0 -1
  187. package/esm/crypto/webcrypto.js.map +0 -1
  188. package/esm/errors/AuthApiError.js.map +0 -1
  189. package/esm/errors/AuthPollStopError.js.map +0 -1
  190. package/esm/errors/AuthSdkError.js +0 -29
  191. package/esm/errors/AuthSdkError.js.map +0 -1
  192. package/esm/errors/CustomError.js +0 -21
  193. package/esm/errors/CustomError.js.map +0 -1
  194. package/esm/errors/OAuthError.js +0 -22
  195. package/esm/errors/OAuthError.js.map +0 -1
  196. package/esm/errors/index.js +0 -22
  197. package/esm/errors/index.js.map +0 -1
  198. package/esm/features.js +0 -64
  199. package/esm/features.js.map +0 -1
  200. package/esm/fetch/fetchRequest.js +0 -92
  201. package/esm/fetch/fetchRequest.js.map +0 -1
  202. package/esm/http/headers.js +0 -17
  203. package/esm/http/headers.js.map +0 -1
  204. package/esm/http/index.js +0 -3
  205. package/esm/http/index.js.map +0 -1
  206. package/esm/http/request.js +0 -145
  207. package/esm/http/request.js.map +0 -1
  208. package/esm/idx/authenticate.js +0 -47
  209. package/esm/idx/authenticate.js.map +0 -1
  210. package/esm/idx/cancel.js +0 -32
  211. package/esm/idx/cancel.js.map +0 -1
  212. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
  213. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  214. package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
  215. package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
  216. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
  217. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  218. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
  219. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  220. package/esm/idx/flowMonitors/index.js +0 -16
  221. package/esm/idx/flowMonitors/index.js.map +0 -1
  222. package/esm/idx/handleInteractionCodeRedirect.js +0 -64
  223. package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
  224. package/esm/idx/headers.js +0 -39
  225. package/esm/idx/headers.js.map +0 -1
  226. package/esm/idx/index.js +0 -20
  227. package/esm/idx/index.js.map +0 -1
  228. package/esm/idx/interact.js +0 -83
  229. package/esm/idx/interact.js.map +0 -1
  230. package/esm/idx/introspect.js +0 -45
  231. package/esm/idx/introspect.js.map +0 -1
  232. package/esm/idx/recoverPassword.js +0 -46
  233. package/esm/idx/recoverPassword.js.map +0 -1
  234. package/esm/idx/register.js +0 -63
  235. package/esm/idx/register.js.map +0 -1
  236. package/esm/idx/remediate.js +0 -302
  237. package/esm/idx/remediate.js.map +0 -1
  238. package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
  239. package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
  240. package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
  241. package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
  242. package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
  243. package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
  244. package/esm/idx/remediators/Base/Remediator.js +0 -221
  245. package/esm/idx/remediators/Base/Remediator.js.map +0 -1
  246. package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
  247. package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
  248. package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -63
  249. package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
  250. package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
  251. package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
  252. package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
  253. package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
  254. package/esm/idx/remediators/EnrollProfile.js +0 -79
  255. package/esm/idx/remediators/EnrollProfile.js.map +0 -1
  256. package/esm/idx/remediators/Identify.js +0 -86
  257. package/esm/idx/remediators/Identify.js.map +0 -1
  258. package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
  259. package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
  260. package/esm/idx/remediators/RedirectIdp.js +0 -38
  261. package/esm/idx/remediators/RedirectIdp.js.map +0 -1
  262. package/esm/idx/remediators/ResetAuthenticator.js +0 -18
  263. package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
  264. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
  265. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
  266. package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
  267. package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
  268. package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
  269. package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
  270. package/esm/idx/remediators/Skip.js +0 -23
  271. package/esm/idx/remediators/Skip.js.map +0 -1
  272. package/esm/idx/remediators/index.js +0 -26
  273. package/esm/idx/remediators/index.js.map +0 -1
  274. package/esm/idx/remediators/util.js +0 -35
  275. package/esm/idx/remediators/util.js.map +0 -1
  276. package/esm/idx/run.js +0 -201
  277. package/esm/idx/run.js.map +0 -1
  278. package/esm/idx/startTransaction.js +0 -27
  279. package/esm/idx/startTransaction.js.map +0 -1
  280. package/esm/idx/transactionMeta.js +0 -114
  281. package/esm/idx/transactionMeta.js.map +0 -1
  282. package/esm/idx/types/idx-js.js +0 -17
  283. package/esm/idx/types/idx-js.js.map +0 -1
  284. package/esm/idx/types/index.js +0 -44
  285. package/esm/idx/types/index.js.map +0 -1
  286. package/esm/oidc/decodeToken.js +0 -31
  287. package/esm/oidc/decodeToken.js.map +0 -1
  288. package/esm/oidc/endpoints/authorize.js +0 -61
  289. package/esm/oidc/endpoints/authorize.js.map +0 -1
  290. package/esm/oidc/endpoints/index.js.map +0 -1
  291. package/esm/oidc/endpoints/token.js +0 -97
  292. package/esm/oidc/endpoints/token.js.map +0 -1
  293. package/esm/oidc/endpoints/well-known.js +0 -58
  294. package/esm/oidc/endpoints/well-known.js.map +0 -1
  295. package/esm/oidc/exchangeCodeForTokens.js +0 -69
  296. package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
  297. package/esm/oidc/getToken.js +0 -175
  298. package/esm/oidc/getToken.js.map +0 -1
  299. package/esm/oidc/getUserInfo.js +0 -82
  300. package/esm/oidc/getUserInfo.js.map +0 -1
  301. package/esm/oidc/getWithPopup.js +0 -28
  302. package/esm/oidc/getWithPopup.js.map +0 -1
  303. package/esm/oidc/getWithRedirect.js +0 -65
  304. package/esm/oidc/getWithRedirect.js.map +0 -1
  305. package/esm/oidc/getWithoutPrompt.js +0 -29
  306. package/esm/oidc/getWithoutPrompt.js.map +0 -1
  307. package/esm/oidc/handleOAuthResponse.js +0 -148
  308. package/esm/oidc/handleOAuthResponse.js.map +0 -1
  309. package/esm/oidc/index.js +0 -29
  310. package/esm/oidc/index.js.map +0 -1
  311. package/esm/oidc/parseFromUrl.js +0 -144
  312. package/esm/oidc/parseFromUrl.js.map +0 -1
  313. package/esm/oidc/renewToken.js +0 -85
  314. package/esm/oidc/renewToken.js.map +0 -1
  315. package/esm/oidc/renewTokens.js +0 -52
  316. package/esm/oidc/renewTokens.js.map +0 -1
  317. package/esm/oidc/renewTokensWithRefresh.js +0 -55
  318. package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
  319. package/esm/oidc/revokeToken.js +0 -57
  320. package/esm/oidc/revokeToken.js.map +0 -1
  321. package/esm/oidc/util/browser.js +0 -85
  322. package/esm/oidc/util/browser.js.map +0 -1
  323. package/esm/oidc/util/defaultTokenParams.js +0 -42
  324. package/esm/oidc/util/defaultTokenParams.js.map +0 -1
  325. package/esm/oidc/util/errors.js +0 -31
  326. package/esm/oidc/util/errors.js.map +0 -1
  327. package/esm/oidc/util/index.js +0 -25
  328. package/esm/oidc/util/index.js.map +0 -1
  329. package/esm/oidc/util/loginRedirect.js +0 -84
  330. package/esm/oidc/util/loginRedirect.js.map +0 -1
  331. package/esm/oidc/util/oauth.js +0 -70
  332. package/esm/oidc/util/oauth.js.map +0 -1
  333. package/esm/oidc/util/pkce.js +0 -55
  334. package/esm/oidc/util/pkce.js.map +0 -1
  335. package/esm/oidc/util/prepareTokenParams.js +0 -75
  336. package/esm/oidc/util/prepareTokenParams.js.map +0 -1
  337. package/esm/oidc/util/refreshToken.js +0 -24
  338. package/esm/oidc/util/refreshToken.js.map +0 -1
  339. package/esm/oidc/util/urlParams.js +0 -54
  340. package/esm/oidc/util/urlParams.js.map +0 -1
  341. package/esm/oidc/util/validateClaims.js +0 -53
  342. package/esm/oidc/util/validateClaims.js.map +0 -1
  343. package/esm/oidc/util/validateToken.js +0 -21
  344. package/esm/oidc/util/validateToken.js.map +0 -1
  345. package/esm/oidc/verifyToken.js +0 -78
  346. package/esm/oidc/verifyToken.js.map +0 -1
  347. package/esm/options.js +0 -134
  348. package/esm/options.js.map +0 -1
  349. package/esm/server/serverStorage.js +0 -110
  350. package/esm/server/serverStorage.js.map +0 -1
  351. package/esm/services/TokenService.js +0 -103
  352. package/esm/services/TokenService.js.map +0 -1
  353. package/esm/session.js +0 -81
  354. package/esm/session.js.map +0 -1
  355. package/esm/tx/AuthTransaction.js +0 -215
  356. package/esm/tx/AuthTransaction.js.map +0 -1
  357. package/esm/tx/TransactionState.js.map +0 -1
  358. package/esm/tx/api.js +0 -84
  359. package/esm/tx/api.js.map +0 -1
  360. package/esm/tx/index.js +0 -18
  361. package/esm/tx/index.js.map +0 -1
  362. package/esm/tx/poll.js +0 -124
  363. package/esm/tx/poll.js.map +0 -1
  364. package/esm/tx/util.js +0 -26
  365. package/esm/tx/util.js.map +0 -1
  366. package/esm/types/AuthState.js +0 -3
  367. package/esm/types/Cookies.js +0 -3
  368. package/esm/types/EventEmitter.js +0 -3
  369. package/esm/types/EventEmitter.js.map +0 -1
  370. package/esm/types/JWT.js +0 -3
  371. package/esm/types/JWT.js.map +0 -1
  372. package/esm/types/OAuth.js +0 -3
  373. package/esm/types/OAuth.js.map +0 -1
  374. package/esm/types/OktaAuthOptions.js +0 -3
  375. package/esm/types/OktaAuthOptions.js.map +0 -1
  376. package/esm/types/Storage.js +0 -3
  377. package/esm/types/Storage.js.map +0 -1
  378. package/esm/types/Token.js +0 -29
  379. package/esm/types/Token.js.map +0 -1
  380. package/esm/types/TokenManager.js +0 -3
  381. package/esm/types/TokenManager.js.map +0 -1
  382. package/esm/types/Transaction.js +0 -57
  383. package/esm/types/Transaction.js.map +0 -1
  384. package/esm/types/UserClaims.js +0 -3
  385. package/esm/types/UserClaims.js.map +0 -1
  386. package/esm/types/api.js +0 -3
  387. package/esm/types/api.js.map +0 -1
  388. package/esm/types/http.js +0 -3
  389. package/esm/types/http.js.map +0 -1
  390. package/esm/types/index.js +0 -27
  391. package/esm/types/index.js.map +0 -1
  392. package/esm/util/console.js +0 -53
  393. package/esm/util/console.js.map +0 -1
  394. package/esm/util/index.js +0 -17
  395. package/esm/util/index.js.map +0 -1
  396. package/esm/util/misc.js +0 -33
  397. package/esm/util/misc.js.map +0 -1
  398. package/esm/util/object.js +0 -117
  399. package/esm/util/object.js.map +0 -1
  400. package/esm/util/sharedStorage.js +0 -43
  401. package/esm/util/sharedStorage.js.map +0 -1
  402. package/esm/util/types.js +0 -27
  403. package/esm/util/types.js.map +0 -1
  404. package/esm/util/url.js +0 -64
  405. package/esm/util/url.js.map +0 -1
package/esm/features.js DELETED
@@ -1,64 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
- *
5
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
- * Unless required by applicable law or agreed to in writing, software
7
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
- *
10
- * See the License for the specific language governing permissions and limitations under the License.
11
- */
12
-
13
- /* eslint-disable node/no-unsupported-features/node-builtins */
14
-
15
- /* global document, window, TextEncoder, navigator */
16
- import { webcrypto } from './crypto';
17
- var isWindowsPhone = /windows phone|iemobile|wpdesktop/i;
18
- export function isBrowser() {
19
- return typeof document !== 'undefined' && typeof window !== 'undefined';
20
- }
21
- export function isIE11OrLess() {
22
- return isBrowser() && !!document.documentMode && document.documentMode <= 11;
23
- }
24
- export function getUserAgent() {
25
- return navigator.userAgent;
26
- }
27
- export function isFingerprintSupported() {
28
- var agent = getUserAgent();
29
- return agent && !isWindowsPhone.test(agent);
30
- }
31
- export function isPopupPostMessageSupported() {
32
- if (!isBrowser()) {
33
- return false;
34
- }
35
-
36
- var isIE8or9 = document.documentMode && document.documentMode < 10;
37
-
38
- if (window.postMessage && !isIE8or9) {
39
- return true;
40
- }
41
-
42
- return false;
43
- }
44
- export function isTokenVerifySupported() {
45
- return typeof webcrypto !== 'undefined' && typeof webcrypto.subtle !== 'undefined' && typeof Uint8Array !== 'undefined';
46
- }
47
- export function hasTextEncoder() {
48
- return typeof TextEncoder !== 'undefined';
49
- }
50
- export function isPKCESupported() {
51
- return isTokenVerifySupported() && hasTextEncoder();
52
- }
53
- export function isHTTPS() {
54
- if (!isBrowser()) {
55
- return false;
56
- }
57
-
58
- return window.location.protocol === 'https:';
59
- }
60
- export function isLocalhost() {
61
- // eslint-disable-next-line compat/compat
62
- return isBrowser() && window.location.hostname === 'localhost';
63
- }
64
- //# sourceMappingURL=features.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/features.ts"],"names":["webcrypto","isWindowsPhone","isBrowser","document","window","isIE11OrLess","documentMode","getUserAgent","navigator","userAgent","isFingerprintSupported","agent","test","isPopupPostMessageSupported","isIE8or9","postMessage","isTokenVerifySupported","subtle","Uint8Array","hasTextEncoder","TextEncoder","isPKCESupported","isHTTPS","location","protocol","isLocalhost","hostname"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA;AAEA,SAASA,SAAT,QAA0B,UAA1B;AAEA,IAAMC,cAAc,GAAG,mCAAvB;AAEA,OAAO,SAASC,SAAT,GAAqB;AAC1B,SAAO,OAAOC,QAAP,KAAoB,WAApB,IAAmC,OAAOC,MAAP,KAAkB,WAA5D;AACD;AAED,OAAO,SAASC,YAAT,GAAwB;AAC7B,SAAOH,SAAS,MAAM,CAAC,CAACC,QAAQ,CAACG,YAA1B,IAA0CH,QAAQ,CAACG,YAAT,IAAyB,EAA1E;AACD;AAED,OAAO,SAASC,YAAT,GAAwB;AAC7B,SAAOC,SAAS,CAACC,SAAjB;AACD;AAED,OAAO,SAASC,sBAAT,GAAkC;AACvC,MAAMC,KAAK,GAAGJ,YAAY,EAA1B;AACA,SAAOI,KAAK,IAAI,CAACV,cAAc,CAACW,IAAf,CAAoBD,KAApB,CAAjB;AACD;AAED,OAAO,SAASE,2BAAT,GAAuC;AAC5C,MAAI,CAACX,SAAS,EAAd,EAAkB;AAChB,WAAO,KAAP;AACD;;AACD,MAAIY,QAAQ,GAAGX,QAAQ,CAACG,YAAT,IAAyBH,QAAQ,CAACG,YAAT,GAAwB,EAAhE;;AACA,MAAIF,MAAM,CAACW,WAAP,IAAsB,CAACD,QAA3B,EAAqC;AACnC,WAAO,IAAP;AACD;;AACD,SAAO,KAAP;AACD;AAED,OAAO,SAASE,sBAAT,GAAkC;AACvC,SAAO,OAAOhB,SAAP,KAAqB,WAArB,IACF,OAAOA,SAAS,CAACiB,MAAjB,KAA4B,WAD1B,IAEF,OAAOC,UAAP,KAAsB,WAF3B;AAGD;AAED,OAAO,SAASC,cAAT,GAA0B;AAC/B,SAAO,OAAOC,WAAP,KAAuB,WAA9B;AACD;AAED,OAAO,SAASC,eAAT,GAA2B;AAChC,SAAOL,sBAAsB,MAAMG,cAAc,EAAjD;AACD;AAED,OAAO,SAASG,OAAT,GAAmB;AACxB,MAAI,CAACpB,SAAS,EAAd,EAAkB;AAChB,WAAO,KAAP;AACD;;AACD,SAAOE,MAAM,CAACmB,QAAP,CAAgBC,QAAhB,KAA6B,QAApC;AACD;AAED,OAAO,SAASC,WAAT,GAAuB;AAC5B;AACA,SAAOvB,SAAS,MAAME,MAAM,CAACmB,QAAP,CAAgBG,QAAhB,KAA6B,WAAnD;AACD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n/* eslint-disable node/no-unsupported-features/node-builtins */\n/* global document, window, TextEncoder, navigator */\n\nimport { webcrypto } from './crypto';\n\nconst isWindowsPhone = /windows phone|iemobile|wpdesktop/i;\t\n\nexport function isBrowser() {\n return typeof document !== 'undefined' && typeof window !== 'undefined';\n}\n\nexport function isIE11OrLess() {\n return isBrowser() && !!document.documentMode && document.documentMode <= 11;\n}\n\nexport function getUserAgent() {\n return navigator.userAgent;\n}\n\nexport function isFingerprintSupported() {\n const agent = getUserAgent();\n return agent && !isWindowsPhone.test(agent);\t\n}\n\nexport function isPopupPostMessageSupported() {\n if (!isBrowser()) {\n return false;\n }\n var isIE8or9 = document.documentMode && document.documentMode < 10;\n if (window.postMessage && !isIE8or9) {\n return true;\n }\n return false;\n}\n\nexport function isTokenVerifySupported() {\n return typeof webcrypto !== 'undefined'\n && typeof webcrypto.subtle !== 'undefined'\n && typeof Uint8Array !== 'undefined';\n}\n\nexport function hasTextEncoder() {\n return typeof TextEncoder !== 'undefined';\n}\n\nexport function isPKCESupported() {\n return isTokenVerifySupported() && hasTextEncoder();\n}\n\nexport function isHTTPS() {\n if (!isBrowser()) {\n return false;\n }\n return window.location.protocol === 'https:';\n}\n\nexport function isLocalhost() {\n // eslint-disable-next-line compat/compat\n return isBrowser() && window.location.hostname === 'localhost';\n}\n\n"],"file":"features.js"}
@@ -1,92 +0,0 @@
1
- /*!
2
- * Copyright (c) 2018-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
- *
5
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
- * Unless required by applicable law or agreed to in writing, software
7
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
- *
10
- * See the License for the specific language governing permissions and limitations under the License.
11
- */
12
- import crossFetch from 'cross-fetch';
13
-
14
- function readData(response) {
15
- if (response.headers.get('Content-Type') && response.headers.get('Content-Type').toLowerCase().indexOf('application/json') >= 0) {
16
- return response.json() // JSON parse can fail if response is not a valid object
17
- .catch(e => {
18
- return {
19
- error: e,
20
- errorSummary: 'Could not parse server response'
21
- };
22
- });
23
- } else {
24
- return response.text();
25
- }
26
- }
27
-
28
- function formatResult(status, data, response) {
29
- var isObject = typeof data === 'object';
30
- var headers = {};
31
-
32
- for (var pair of response.headers.entries()) {
33
- headers[pair[0]] = pair[1];
34
- }
35
-
36
- var result = {
37
- responseText: isObject ? JSON.stringify(data) : data,
38
- status: status,
39
- headers
40
- };
41
-
42
- if (isObject) {
43
- result.responseType = 'json';
44
- result.responseJSON = data;
45
- }
46
-
47
- return result;
48
- }
49
- /* eslint-disable complexity */
50
-
51
-
52
- function fetchRequest(method, url, args) {
53
- var body = args.data;
54
- var headers = args.headers || {};
55
- var contentType = headers['Content-Type'] || headers['content-type'] || ''; // JSON encode body (if appropriate)
56
-
57
- if (contentType === 'application/json' && body && typeof body !== 'string') {
58
- body = JSON.stringify(body);
59
- }
60
-
61
- var fetch = global.fetch || crossFetch;
62
- var fetchPromise = fetch(url, {
63
- method: method,
64
- headers: args.headers,
65
- body: body,
66
- credentials: args.withCredentials ? 'include' : 'omit'
67
- });
68
-
69
- if (!fetchPromise.finally) {
70
- fetchPromise = Promise.resolve(fetchPromise);
71
- }
72
-
73
- return fetchPromise.then(function (response) {
74
- var error = !response.ok;
75
- var status = response.status;
76
- return readData(response).then(data => {
77
- return formatResult(status, data, response);
78
- }).then(result => {
79
- var _result$responseJSON;
80
-
81
- if (error || (_result$responseJSON = result.responseJSON) !== null && _result$responseJSON !== void 0 && _result$responseJSON.error) {
82
- // Throwing result object since error handling is done in http.js
83
- throw result;
84
- }
85
-
86
- return result;
87
- });
88
- });
89
- }
90
-
91
- export default fetchRequest;
92
- //# sourceMappingURL=fetchRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/fetch/fetchRequest.ts"],"names":["crossFetch","readData","response","headers","get","toLowerCase","indexOf","json","catch","e","error","errorSummary","text","formatResult","status","data","isObject","pair","entries","result","responseText","JSON","stringify","responseType","responseJSON","fetchRequest","method","url","args","body","contentType","fetch","global","fetchPromise","credentials","withCredentials","finally","Promise","resolve","then","ok"],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) 2018-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport crossFetch from 'cross-fetch';\nimport { FetchOptions, FetchResponse, HttpResponse } from '../types';\n\nfunction readData(response: FetchResponse): Promise<object | string> {\n if (response.headers.get('Content-Type') &&\n response.headers.get('Content-Type').toLowerCase().indexOf('application/json') >= 0) {\n return response.json()\n // JSON parse can fail if response is not a valid object\n .catch(e => {\n return {\n error: e,\n errorSummary: 'Could not parse server response'\n };\n });\n } else {\n return response.text();\n }\n}\n\nfunction formatResult(status: number, data: object | string, response: Response) {\n const isObject = typeof data === 'object';\n const headers = {};\n for (const pair of response.headers.entries()) {\n headers[pair[0]] = pair[1];\n }\n const result: HttpResponse = {\n responseText: isObject ? JSON.stringify(data) : data as string,\n status: status,\n headers\n };\n if (isObject) {\n result.responseType = 'json';\n result.responseJSON = data as object;\n }\n return result;\n}\n\n/* eslint-disable complexity */\nfunction fetchRequest(method: string, url: string, args: FetchOptions) {\n var body = args.data;\n var headers = args.headers || {};\n var contentType = (headers['Content-Type'] || headers['content-type'] || '');\n\n // JSON encode body (if appropriate)\n if (contentType === 'application/json' && body && typeof body !== 'string') {\n body = JSON.stringify(body);\n }\n var fetch = global.fetch || crossFetch;\n var fetchPromise = fetch(url, {\n method: method,\n headers: args.headers,\n body: body as string,\n credentials: args.withCredentials ? 'include' : 'omit'\n });\n\n if (!fetchPromise.finally) {\n fetchPromise = Promise.resolve(fetchPromise);\n }\n\n return fetchPromise.then(function(response) {\n var error = !response.ok;\n var status = response.status;\n return readData(response)\n .then(data => {\n return formatResult(status, data, response);\n })\n .then(result => {\n if (error || result.responseJSON?.error) {\n // Throwing result object since error handling is done in http.js\n throw result;\n }\n return result;\n });\n });\n}\n\nexport default fetchRequest;\n"],"file":"fetchRequest.js"}
@@ -1,17 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
- *
5
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
- * Unless required by applicable law or agreed to in writing, software
7
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
- *
10
- * See the License for the specific language governing permissions and limitations under the License.
11
- *
12
- */
13
- export function setRequestHeader(authClient, headerName, headerValue) {
14
- authClient.options.headers = authClient.options.headers || {};
15
- authClient.options.headers[headerName] = headerValue;
16
- }
17
- //# sourceMappingURL=headers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/http/headers.ts"],"names":["setRequestHeader","authClient","headerName","headerValue","options","headers"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,OAAO,SAASA,gBAAT,CAA0BC,UAA1B,EAAgDC,UAAhD,EAA4DC,WAA5D,EAAyE;AAC9EF,EAAAA,UAAU,CAACG,OAAX,CAAmBC,OAAnB,GAA6BJ,UAAU,CAACG,OAAX,CAAmBC,OAAnB,IAA8B,EAA3D;AACAJ,EAAAA,UAAU,CAACG,OAAX,CAAmBC,OAAnB,CAA2BH,UAA3B,IAAyCC,WAAzC;AACD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { OktaAuth } from '../types';\n\nexport function setRequestHeader(authClient: OktaAuth, headerName, headerValue) {\n authClient.options.headers = authClient.options.headers || {};\n authClient.options.headers[headerName] = headerValue;\n}"],"file":"headers.js"}
package/esm/http/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from './headers';
2
- export * from './request';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/http/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAd;AACA,cAAc,WAAd","sourcesContent":["export * from './headers';\nexport * from './request';"],"file":"index.js"}
@@ -1,145 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
-
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
-
7
- /*!
8
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
9
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
10
- *
11
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- *
16
- * See the License for the specific language governing permissions and limitations under the License.
17
- *
18
- */
19
-
20
- /* eslint-disable complexity */
21
- import { isString, clone, isAbsoluteUrl, removeNils } from '../util';
22
- import AuthApiError from '../errors/AuthApiError';
23
- import { STATE_TOKEN_KEY_NAME, DEFAULT_CACHE_DURATION } from '../constants';
24
- export function httpRequest(sdk, options) {
25
- options = options || {};
26
- var url = options.url,
27
- method = options.method,
28
- args = options.args,
29
- saveAuthnState = options.saveAuthnState,
30
- accessToken = options.accessToken,
31
- withCredentials = options.withCredentials === true,
32
- // default value is false
33
- storageUtil = sdk.options.storageUtil,
34
- storage = storageUtil.storage,
35
- httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);
36
-
37
- if (options.cacheResponse) {
38
- var cacheContents = httpCache.getStorage();
39
- var cachedResponse = cacheContents[url];
40
-
41
- if (cachedResponse && Date.now() / 1000 < cachedResponse.expiresAt) {
42
- return Promise.resolve(cachedResponse.response);
43
- }
44
- }
45
-
46
- var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();
47
-
48
- var headers = _objectSpread({
49
- 'Accept': 'application/json',
50
- 'Content-Type': 'application/json'
51
- }, oktaUserAgentHeader);
52
-
53
- Object.assign(headers, sdk.options.headers, options.headers);
54
- headers = removeNils(headers);
55
-
56
- if (accessToken && isString(accessToken)) {
57
- headers['Authorization'] = 'Bearer ' + accessToken;
58
- }
59
-
60
- var ajaxOptions = {
61
- headers,
62
- data: args || undefined,
63
- withCredentials
64
- };
65
- var err, res;
66
- return sdk.options.httpRequestClient(method, url, ajaxOptions).then(function (resp) {
67
- res = resp.responseText;
68
-
69
- if (res && isString(res)) {
70
- res = JSON.parse(res);
71
-
72
- if (res && typeof res === 'object' && !res.headers) {
73
- res.headers = resp.headers;
74
- }
75
- }
76
-
77
- if (saveAuthnState) {
78
- if (!res.stateToken) {
79
- storage.delete(STATE_TOKEN_KEY_NAME);
80
- }
81
- }
82
-
83
- if (res && res.stateToken && res.expiresAt) {
84
- storage.set(STATE_TOKEN_KEY_NAME, res.stateToken, res.expiresAt, sdk.options.cookies);
85
- }
86
-
87
- if (res && options.cacheResponse) {
88
- httpCache.updateStorage(url, {
89
- expiresAt: Math.floor(Date.now() / 1000) + DEFAULT_CACHE_DURATION,
90
- response: res
91
- });
92
- }
93
-
94
- return res;
95
- }).catch(function (resp) {
96
- var serverErr = resp.responseText || {};
97
-
98
- if (isString(serverErr)) {
99
- try {
100
- serverErr = JSON.parse(serverErr);
101
- } catch (e) {
102
- serverErr = {
103
- errorSummary: 'Unknown error'
104
- };
105
- }
106
- }
107
-
108
- if (resp.status >= 500) {
109
- serverErr.errorSummary = 'Unknown error';
110
- }
111
-
112
- if (sdk.options.transformErrorXHR) {
113
- resp = sdk.options.transformErrorXHR(clone(resp));
114
- }
115
-
116
- err = new AuthApiError(serverErr, resp);
117
-
118
- if (err.errorCode === 'E0000011') {
119
- storage.delete(STATE_TOKEN_KEY_NAME);
120
- }
121
-
122
- throw err;
123
- });
124
- }
125
- export function get(sdk, url, options) {
126
- url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;
127
- var getOptions = {
128
- url: url,
129
- method: 'GET'
130
- };
131
- Object.assign(getOptions, options);
132
- return httpRequest(sdk, getOptions);
133
- }
134
- export function post(sdk, url, args, options) {
135
- url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;
136
- var postOptions = {
137
- url: url,
138
- method: 'POST',
139
- args: args,
140
- saveAuthnState: true
141
- };
142
- Object.assign(postOptions, options);
143
- return httpRequest(sdk, postOptions);
144
- }
145
- //# sourceMappingURL=request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/http/request.ts"],"names":["isString","clone","isAbsoluteUrl","removeNils","AuthApiError","STATE_TOKEN_KEY_NAME","DEFAULT_CACHE_DURATION","httpRequest","sdk","options","url","method","args","saveAuthnState","accessToken","withCredentials","storageUtil","storage","httpCache","storageManager","getHttpCache","cookies","cacheResponse","cacheContents","getStorage","cachedResponse","Date","now","expiresAt","Promise","resolve","response","oktaUserAgentHeader","_oktaUserAgent","getHttpHeader","headers","Object","assign","ajaxOptions","data","undefined","err","res","httpRequestClient","then","resp","responseText","JSON","parse","stateToken","delete","set","updateStorage","Math","floor","catch","serverErr","e","errorSummary","status","transformErrorXHR","errorCode","get","getIssuerOrigin","getOptions","post","postOptions"],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n\n/* eslint-disable complexity */\nimport { isString, clone, isAbsoluteUrl, removeNils } from '../util';\nimport AuthApiError from '../errors/AuthApiError';\nimport { STATE_TOKEN_KEY_NAME, DEFAULT_CACHE_DURATION } from '../constants';\nimport { OktaAuth, RequestOptions, FetchOptions, RequestData } from '../types';\n\nexport function httpRequest(sdk: OktaAuth, options: RequestOptions): Promise<any> {\n options = options || {};\n var url = options.url,\n method = options.method,\n args = options.args,\n saveAuthnState = options.saveAuthnState,\n accessToken = options.accessToken,\n withCredentials = options.withCredentials === true, // default value is false\n storageUtil = sdk.options.storageUtil,\n storage = storageUtil.storage,\n httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);\n\n if (options.cacheResponse) {\n var cacheContents = httpCache.getStorage();\n var cachedResponse = cacheContents[url];\n if (cachedResponse && Date.now()/1000 < cachedResponse.expiresAt) {\n return Promise.resolve(cachedResponse.response);\n }\n }\n\n var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();\n var headers: HeadersInit = {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json',\n ...oktaUserAgentHeader\n };\n Object.assign(headers, sdk.options.headers, options.headers);\n headers = removeNils(headers) as HeadersInit;\n\n if (accessToken && isString(accessToken)) {\n headers['Authorization'] = 'Bearer ' + accessToken;\n }\n\n var ajaxOptions: FetchOptions = {\n headers,\n data: args || undefined,\n withCredentials\n };\n\n var err, res;\n return sdk.options.httpRequestClient(method, url, ajaxOptions)\n .then(function(resp) {\n res = resp.responseText;\n if (res && isString(res)) {\n res = JSON.parse(res);\n if (res && typeof res === 'object' && !res.headers) {\n res.headers = resp.headers;\n }\n }\n\n if (saveAuthnState) {\n if (!res.stateToken) {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n }\n\n if (res && res.stateToken && res.expiresAt) {\n storage.set(STATE_TOKEN_KEY_NAME, res.stateToken, res.expiresAt, sdk.options.cookies);\n }\n\n if (res && options.cacheResponse) {\n httpCache.updateStorage(url, {\n expiresAt: Math.floor(Date.now()/1000) + DEFAULT_CACHE_DURATION,\n response: res\n });\n }\n\n return res;\n })\n .catch(function(resp) {\n var serverErr = resp.responseText || {};\n if (isString(serverErr)) {\n try {\n serverErr = JSON.parse(serverErr);\n } catch (e) {\n serverErr = {\n errorSummary: 'Unknown error'\n };\n }\n }\n\n if (resp.status >= 500) {\n serverErr.errorSummary = 'Unknown error';\n }\n\n if (sdk.options.transformErrorXHR) {\n resp = sdk.options.transformErrorXHR(clone(resp));\n }\n\n err = new AuthApiError(serverErr, resp);\n\n if (err.errorCode === 'E0000011') {\n storage.delete(STATE_TOKEN_KEY_NAME);\n }\n\n throw err;\n });\n}\n\nexport function get(sdk: OktaAuth, url: string, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var getOptions = {\n url: url,\n method: 'GET'\n };\n Object.assign(getOptions, options);\n return httpRequest(sdk, getOptions);\n}\n\nexport function post(sdk: OktaAuth, url: string, args?: RequestData, options?: RequestOptions) {\n url = isAbsoluteUrl(url) ? url : sdk.getIssuerOrigin() + url;\n var postOptions = {\n url: url,\n method: 'POST',\n args: args,\n saveAuthnState: true\n };\n Object.assign(postOptions, options);\n return httpRequest(sdk, postOptions);\n}\n"],"file":"request.js"}
@@ -1,47 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
-
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
-
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
-
8
- /*!
9
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
10
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
11
- *
12
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- *
17
- * See the License for the specific language governing permissions and limitations under the License.
18
- */
19
- import { run } from './run';
20
- import { Identify, SelectAuthenticatorAuthenticate, ChallengeAuthenticator, ReEnrollAuthenticator, RedirectIdp, AuthenticatorEnrollmentData, SelectAuthenticatorEnroll, EnrollAuthenticator, AuthenticatorVerificationData } from './remediators';
21
- import { AuthenticationFlowMonitor } from './flowMonitors';
22
- var flow = {
23
- 'identify': Identify,
24
- 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,
25
- 'select-authenticator-enroll': SelectAuthenticatorEnroll,
26
- 'authenticator-enrollment-data': AuthenticatorEnrollmentData,
27
- 'authenticator-verification-data': AuthenticatorVerificationData,
28
- 'enroll-authenticator': EnrollAuthenticator,
29
- 'challenge-authenticator': ChallengeAuthenticator,
30
- 'reenroll-authenticator': ReEnrollAuthenticator,
31
- 'redirect-idp': RedirectIdp
32
- };
33
- export function authenticate(_x, _x2) {
34
- return _authenticate.apply(this, arguments);
35
- }
36
-
37
- function _authenticate() {
38
- _authenticate = _asyncToGenerator(function* (authClient, options) {
39
- var flowMonitor = new AuthenticationFlowMonitor(authClient);
40
- return run(authClient, _objectSpread(_objectSpread({}, options), {}, {
41
- flow,
42
- flowMonitor
43
- }));
44
- });
45
- return _authenticate.apply(this, arguments);
46
- }
47
- //# sourceMappingURL=authenticate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/idx/authenticate.ts"],"names":["run","Identify","SelectAuthenticatorAuthenticate","ChallengeAuthenticator","ReEnrollAuthenticator","RedirectIdp","AuthenticatorEnrollmentData","SelectAuthenticatorEnroll","EnrollAuthenticator","AuthenticatorVerificationData","AuthenticationFlowMonitor","flow","authenticate","authClient","options","flowMonitor"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA,SAASA,GAAT,QAAqC,OAArC;AACA,SACEC,QADF,EAGEC,+BAHF,EAKEC,sBALF,EAOEC,qBAPF,EASEC,WATF,EAUEC,2BAVF,EAYEC,yBAZF,EAcEC,mBAdF,EAgBEC,6BAhBF,QAiBO,eAjBP;AAkBA,SAASC,yBAAT,QAA0C,gBAA1C;AAEA,IAAMC,IAAqB,GAAG;AAC5B,cAAYV,QADgB;AAE5B,uCAAqCC,+BAFT;AAG5B,iCAA+BK,yBAHH;AAI5B,mCAAiCD,2BAJL;AAK5B,qCAAmCG,6BALP;AAM5B,0BAAwBD,mBANI;AAO5B,6BAA2BL,sBAPC;AAQ5B,4BAA0BC,qBARE;AAS5B,kBAAgBC;AATY,CAA9B;AAqBA,gBAAsBO,YAAtB;AAAA;AAAA;;;oCAAO,WACLC,UADK,EACiBC,OADjB,EAEoB;AACzB,QAAMC,WAAW,GAAG,IAAIL,yBAAJ,CAA8BG,UAA9B,CAApB;AACA,WAAOb,GAAG,CAACa,UAAD,kCACLC,OADK;AAERH,MAAAA,IAFQ;AAGRI,MAAAA;AAHQ,OAAV;AAKD,G","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { \n OktaAuth,\n IdxOptions,\n IdxTransaction,\n} from '../types';\nimport { run, RemediationFlow } from './run';\nimport { \n Identify,\n IdentifyValues,\n SelectAuthenticatorAuthenticate,\n SelectAuthenticatorAuthenticateValues,\n ChallengeAuthenticator,\n ChallengeAuthenticatorValues,\n ReEnrollAuthenticator,\n ReEnrollAuthenticatorValues,\n RedirectIdp,\n AuthenticatorEnrollmentData,\n AuthenticatorEnrollmentDataValues,\n SelectAuthenticatorEnroll,\n SelectAuthenticatorEnrollValues,\n EnrollAuthenticator,\n EnrollAuthenticatorValues,\n AuthenticatorVerificationData,\n} from './remediators';\nimport { AuthenticationFlowMonitor } from './flowMonitors';\n\nconst flow: RemediationFlow = {\n 'identify': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'enroll-authenticator': EnrollAuthenticator,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n 'redirect-idp': RedirectIdp\n};\n\nexport type AuthenticationOptions = IdxOptions \n & IdentifyValues \n & SelectAuthenticatorAuthenticateValues \n & SelectAuthenticatorEnrollValues\n & ChallengeAuthenticatorValues \n & ReEnrollAuthenticatorValues\n & AuthenticatorEnrollmentDataValues\n & EnrollAuthenticatorValues;\n\nexport async function authenticate(\n authClient: OktaAuth, options: AuthenticationOptions\n): Promise<IdxTransaction> {\n const flowMonitor = new AuthenticationFlowMonitor(authClient);\n return run(authClient, { \n ...options, \n flow,\n flowMonitor,\n });\n}\n"],"file":"authenticate.js"}
package/esm/idx/cancel.js DELETED
@@ -1,32 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
-
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
-
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
-
8
- /*!
9
- * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.
10
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
11
- *
12
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- *
17
- * See the License for the specific language governing permissions and limitations under the License.
18
- */
19
- import { run } from './run';
20
- export function cancel(_x, _x2) {
21
- return _cancel.apply(this, arguments);
22
- }
23
-
24
- function _cancel() {
25
- _cancel = _asyncToGenerator(function* (authClient, options) {
26
- return run(authClient, _objectSpread(_objectSpread({}, options), {}, {
27
- actions: ['cancel']
28
- }));
29
- });
30
- return _cancel.apply(this, arguments);
31
- }
32
- //# sourceMappingURL=cancel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/idx/cancel.ts"],"names":["run","cancel","authClient","options","actions"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,GAAT,QAAoB,OAApB;AAIA,gBAAsBC,MAAtB;AAAA;AAAA;;;8BAAO,WAAuBC,UAAvB,EAA6CC,OAA7C,EAAqE;AAC1E,WAAOH,GAAG,CAACE,UAAD,kCACLC,OADK;AAERC,MAAAA,OAAO,EAAE,CAAC,QAAD;AAFD,OAAV;AAID,G","sourcesContent":["/*!\n * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { OktaAuth, IdxOptions } from '../types';\nimport { run } from './run';\n\nexport type CancelOptions = IdxOptions;\n\nexport async function cancel (authClient: OktaAuth, options: CancelOptions) {\n return run(authClient, {\n ...options,\n actions: ['cancel']\n });\n}\n"],"file":"cancel.js"}
@@ -1,41 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
- *
5
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
- * Unless required by applicable law or agreed to in writing, software
7
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
- *
10
- * See the License for the specific language governing permissions and limitations under the License.
11
- */
12
- import { FlowMonitor } from './FlowMonitor';
13
- export class AuthenticationFlowMonitor extends FlowMonitor {
14
- isRemediatorCandidate(remediator, remediations, values) {
15
- var _this$previousRemedia;
16
-
17
- var prevRemediatorName = (_this$previousRemedia = this.previousRemediator) === null || _this$previousRemedia === void 0 ? void 0 : _this$previousRemedia.getName();
18
- var remediatorName = remediator.getName();
19
-
20
- if (remediatorName === 'select-authenticator-authenticate' && ['select-authenticator-authenticate'].includes(prevRemediatorName)) {
21
- return false;
22
- }
23
-
24
- if (remediatorName === 'select-authenticator-authenticate' && remediations.some(_ref => {
25
- var {
26
- name
27
- } = _ref;
28
- return name === 'challenge-authenticator';
29
- })) {
30
- return false;
31
- }
32
-
33
- if (remediatorName === 'select-authenticator-enroll' && ['select-authenticator-enroll', 'authenticator-enrollment-data'].includes(prevRemediatorName)) {
34
- return false;
35
- }
36
-
37
- return super.isRemediatorCandidate(remediator, remediations, values);
38
- }
39
-
40
- }
41
- //# sourceMappingURL=AuthenticationFlowMonitor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/flowMonitors/AuthenticationFlowMonitor.ts"],"names":["FlowMonitor","AuthenticationFlowMonitor","isRemediatorCandidate","remediator","remediations","values","prevRemediatorName","previousRemediator","getName","remediatorName","includes","some","name"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,WAAT,QAA4B,eAA5B;AAEA,OAAO,MAAMC,yBAAN,SAAwCD,WAAxC,CAAoD;AACzDE,EAAAA,qBAAqB,CAACC,UAAD,EAAaC,YAAb,EAA4BC,MAA5B,EAAqC;AAAA;;AACxD,QAAMC,kBAAkB,4BAAG,KAAKC,kBAAR,0DAAG,sBAAyBC,OAAzB,EAA3B;AACA,QAAMC,cAAc,GAAGN,UAAU,CAACK,OAAX,EAAvB;;AAEA,QAAIC,cAAc,KAAK,mCAAnB,IACC,CAAC,mCAAD,EAAsCC,QAAtC,CAA+CJ,kBAA/C,CADL,EACyE;AACvE,aAAO,KAAP;AACD;;AAED,QAAIG,cAAc,KAAK,mCAAnB,IACCL,YAAY,CAACO,IAAb,CAAkB;AAAA,UAAC;AAAEC,QAAAA;AAAF,OAAD;AAAA,aAAcA,IAAI,KAAK,yBAAvB;AAAA,KAAlB,CADL,EAC0E;AACxE,aAAO,KAAP;AACD;;AAED,QAAIH,cAAc,KAAK,6BAAnB,IACC,CACC,6BADD,EAEC,+BAFD,EAGCC,QAHD,CAGUJ,kBAHV,CADL,EAIoC;AAClC,aAAO,KAAP;AACD;;AAED,WAAO,MAAMJ,qBAAN,CAA4BC,UAA5B,EAAwCC,YAAxC,EAAsDC,MAAtD,CAAP;AACD;;AAxBwD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { FlowMonitor } from './FlowMonitor';\n\nexport class AuthenticationFlowMonitor extends FlowMonitor {\n isRemediatorCandidate(remediator, remediations?, values?) {\n const prevRemediatorName = this.previousRemediator?.getName();\n const remediatorName = remediator.getName();\n \n if (remediatorName === 'select-authenticator-authenticate' \n && ['select-authenticator-authenticate'].includes(prevRemediatorName)) {\n return false;\n }\n\n if (remediatorName === 'select-authenticator-authenticate' \n && remediations.some(({ name }) => name === 'challenge-authenticator')) {\n return false;\n }\n\n if (remediatorName === 'select-authenticator-enroll' \n && [\n 'select-authenticator-enroll', \n 'authenticator-enrollment-data'\n ].includes(prevRemediatorName)) {\n return false;\n }\n\n return super.isRemediatorCandidate(remediator, remediations, values);\n }\n}\n"],"file":"AuthenticationFlowMonitor.js"}
@@ -1,73 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
-
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
-
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
-
8
- /*!
9
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
10
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
11
- *
12
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- *
17
- * See the License for the specific language governing permissions and limitations under the License.
18
- */
19
- import { getTransactionMeta, saveTransactionMeta } from '../transactionMeta';
20
- export class FlowMonitor {
21
- constructor(authClient) {
22
- this.authClient = authClient;
23
- } // detect in-memory loop
24
-
25
-
26
- loopDetected(remediator) {
27
- if (!this.previousRemediator) {
28
- this.previousRemediator = remediator;
29
- return false;
30
- }
31
-
32
- if (this.previousRemediator.getName() === remediator.getName()) {
33
- return true;
34
- }
35
-
36
- this.previousRemediator = remediator;
37
- return false;
38
- }
39
-
40
- isRemediatorCandidate( // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
41
- remediator, remediations, values) {
42
- var remediatorName = remediator.getName();
43
-
44
- if (!values.skip && remediatorName === 'skip') {
45
- return false;
46
- }
47
-
48
- if (values.skip && remediatorName !== 'skip') {
49
- return false;
50
- }
51
-
52
- return true;
53
- }
54
-
55
- trackRemediations(name) {
56
- var _this = this;
57
-
58
- return _asyncToGenerator(function* () {
59
- var meta = yield getTransactionMeta(_this.authClient);
60
- var remediations = meta.remediations || [];
61
- meta = _objectSpread(_objectSpread({}, meta), {}, {
62
- remediations: [...remediations, name]
63
- });
64
- saveTransactionMeta(_this.authClient, meta);
65
- })();
66
- }
67
-
68
- isFinished() {
69
- return Promise.resolve(true);
70
- }
71
-
72
- }
73
- //# sourceMappingURL=FlowMonitor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/flowMonitors/FlowMonitor.ts"],"names":["getTransactionMeta","saveTransactionMeta","FlowMonitor","constructor","authClient","loopDetected","remediator","previousRemediator","getName","isRemediatorCandidate","remediations","values","remediatorName","skip","trackRemediations","name","meta","isFinished","Promise","resolve"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,SAASA,kBAAT,EAA6BC,mBAA7B,QAAwD,oBAAxD;AAGA,OAAO,MAAMC,WAAN,CAAkB;AAIvBC,EAAAA,WAAW,CAACC,UAAD,EAAa;AACtB,SAAKA,UAAL,GAAkBA,UAAlB;AACD,GANsB,CAQvB;;;AACAC,EAAAA,YAAY,CAACC,UAAD,EAAkC;AAC5C,QAAI,CAAC,KAAKC,kBAAV,EAA8B;AAC5B,WAAKA,kBAAL,GAA0BD,UAA1B;AACA,aAAO,KAAP;AACD;;AAED,QAAI,KAAKC,kBAAL,CAAwBC,OAAxB,OAAsCF,UAAU,CAACE,OAAX,EAA1C,EAAgE;AAC9D,aAAO,IAAP;AACD;;AAED,SAAKD,kBAAL,GAA0BD,UAA1B;AACA,WAAO,KAAP;AACD;;AAEDG,EAAAA,qBAAqB,EACnB;AACAH,EAAAA,UAFmB,EAEKI,YAFL,EAEsCC,MAFtC,EAGV;AACT,QAAMC,cAAc,GAAGN,UAAU,CAACE,OAAX,EAAvB;;AACA,QAAI,CAACG,MAAM,CAACE,IAAR,IAAgBD,cAAc,KAAK,MAAvC,EAA+C;AAC7C,aAAO,KAAP;AACD;;AACD,QAAID,MAAM,CAACE,IAAP,IAAeD,cAAc,KAAK,MAAtC,EAA8C;AAC5C,aAAO,KAAP;AACD;;AACD,WAAO,IAAP;AACD;;AAEKE,EAAAA,iBAAiB,CAACC,IAAD,EAAe;AAAA;;AAAA;AACpC,UAAIC,IAAI,SAAShB,kBAAkB,CAAC,KAAI,CAACI,UAAN,CAAnC;AACA,UAAMM,YAAY,GAAGM,IAAI,CAACN,YAAL,IAAqB,EAA1C;AACAM,MAAAA,IAAI,mCACCA,IADD;AAEFN,QAAAA,YAAY,EAAE,CAAC,GAAGA,YAAJ,EAAkBK,IAAlB;AAFZ,QAAJ;AAIAd,MAAAA,mBAAmB,CAAC,KAAI,CAACG,UAAN,EAAkBY,IAAlB,CAAnB;AAPoC;AAQrC;;AAEDC,EAAAA,UAAU,GAAqB;AAC7B,WAAOC,OAAO,CAACC,OAAR,CAAgB,IAAhB,CAAP;AACD;;AAjDsB","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { OktaAuth } from '../../types';\nimport { Remediator, RemediationValues, SkipValues } from '../remediators';\nimport { getTransactionMeta, saveTransactionMeta } from '../transactionMeta';\nimport { IdxRemediation } from '../types/idx-js';\n\nexport class FlowMonitor {\n previousRemediator: Remediator;\n authClient: OktaAuth;\n\n constructor(authClient) {\n this.authClient = authClient;\n }\n\n // detect in-memory loop\n loopDetected(remediator: Remediator): boolean {\n if (!this.previousRemediator) {\n this.previousRemediator = remediator;\n return false;\n }\n\n if (this.previousRemediator.getName() === remediator.getName()) {\n return true;\n }\n\n this.previousRemediator = remediator;\n return false;\n }\n\n isRemediatorCandidate(\n // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars\n remediator: Remediator, remediations?: IdxRemediation[], values?: RemediationValues & SkipValues\n ): boolean {\n const remediatorName = remediator.getName();\n if (!values.skip && remediatorName === 'skip') {\n return false;\n }\n if (values.skip && remediatorName !== 'skip') {\n return false;\n }\n return true;\n }\n\n async trackRemediations(name: string) {\n let meta = await getTransactionMeta(this.authClient);\n const remediations = meta.remediations || [];\n meta = { \n ...meta, \n remediations: [...remediations, name]\n };\n saveTransactionMeta(this.authClient, meta);\n }\n\n isFinished(): Promise<boolean> {\n return Promise.resolve(true);\n }\n}\n"],"file":"FlowMonitor.js"}