@okta/okta-auth-js 5.8.0 → 5.10.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 (417) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +12 -2
  3. package/cjs/OktaAuth.js +34 -13
  4. package/cjs/OktaAuth.js.map +1 -1
  5. package/cjs/OktaUserAgent.js +2 -2
  6. package/cjs/OktaUserAgent.js.map +1 -1
  7. package/cjs/TokenManager.js +24 -2
  8. package/cjs/TokenManager.js.map +1 -1
  9. package/cjs/TransactionManager.js +6 -2
  10. package/cjs/TransactionManager.js.map +1 -1
  11. package/cjs/features.js +1 -1
  12. package/cjs/features.js.map +1 -1
  13. package/cjs/idx/authenticate.js +3 -18
  14. package/cjs/idx/authenticate.js.map +1 -1
  15. package/cjs/idx/authenticator/Authenticator.js +14 -0
  16. package/cjs/idx/authenticator/Authenticator.js.map +1 -0
  17. package/cjs/idx/authenticator/OktaPassword.js +31 -0
  18. package/cjs/idx/authenticator/OktaPassword.js.map +1 -0
  19. package/cjs/idx/authenticator/OktaVerifyTotp.js +17 -0
  20. package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -0
  21. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +50 -0
  22. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -0
  23. package/cjs/idx/authenticator/SecurityQuestionVerification.js +31 -0
  24. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -0
  25. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +34 -0
  26. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -0
  27. package/cjs/idx/authenticator/getAuthenticator.js +42 -0
  28. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -0
  29. package/cjs/idx/authenticator/index.js +80 -0
  30. package/cjs/idx/authenticator/index.js.map +1 -0
  31. package/cjs/idx/cancel.js +5 -0
  32. package/cjs/idx/cancel.js.map +1 -1
  33. package/cjs/idx/flow/AuthenticationFlow.js +32 -0
  34. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
  35. package/cjs/idx/flow/FlowSpecification.js +39 -0
  36. package/cjs/idx/flow/FlowSpecification.js.map +1 -0
  37. package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
  38. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
  39. package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +16 -12
  40. package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
  41. package/cjs/idx/flow/RemediationFlow.js +2 -0
  42. package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
  43. package/cjs/idx/flow/index.js +67 -0
  44. package/cjs/idx/flow/index.js.map +1 -0
  45. package/cjs/idx/index.js +39 -0
  46. package/cjs/idx/index.js.map +1 -1
  47. package/cjs/idx/interact.js +8 -2
  48. package/cjs/idx/interact.js.map +1 -1
  49. package/cjs/idx/poll.js +59 -0
  50. package/cjs/idx/poll.js.map +1 -0
  51. package/cjs/idx/proceed.js +49 -0
  52. package/cjs/idx/proceed.js.map +1 -0
  53. package/cjs/idx/recoverPassword.js +3 -17
  54. package/cjs/idx/recoverPassword.js.map +1 -1
  55. package/cjs/idx/register.js +22 -20
  56. package/cjs/idx/register.js.map +1 -1
  57. package/cjs/idx/remediate.js +40 -93
  58. package/cjs/idx/remediate.js.map +1 -1
  59. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +9 -12
  60. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  61. package/cjs/idx/remediators/AuthenticatorVerificationData.js +6 -9
  62. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  63. package/cjs/idx/remediators/Base/AuthenticatorData.js +43 -32
  64. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  65. package/cjs/idx/remediators/Base/Remediator.js +51 -20
  66. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  67. package/cjs/idx/remediators/Base/SelectAuthenticator.js +16 -16
  68. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  69. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +8 -28
  70. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  71. package/{esm/idx/remediators/RedirectIdp.js → cjs/idx/remediators/ChallengePoll.js} +13 -25
  72. package/cjs/idx/remediators/ChallengePoll.js.map +1 -0
  73. package/cjs/idx/remediators/EnrollPoll.js +56 -0
  74. package/cjs/idx/remediators/EnrollPoll.js.map +1 -0
  75. package/cjs/idx/remediators/Identify.js +4 -36
  76. package/cjs/idx/remediators/Identify.js.map +1 -1
  77. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +23 -2
  78. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  79. package/cjs/idx/remediators/Skip.js +7 -0
  80. package/cjs/idx/remediators/Skip.js.map +1 -1
  81. package/cjs/idx/remediators/index.js +26 -0
  82. package/cjs/idx/remediators/index.js.map +1 -1
  83. package/cjs/idx/run.js +18 -20
  84. package/cjs/idx/run.js.map +1 -1
  85. package/cjs/idx/startTransaction.js +2 -0
  86. package/cjs/idx/startTransaction.js.map +1 -1
  87. package/cjs/idx/transactionMeta.js +67 -42
  88. package/cjs/idx/transactionMeta.js.map +1 -1
  89. package/cjs/idx/types/FlowIdentifier.js +2 -0
  90. package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
  91. package/cjs/idx/types/idx-js.js.map +1 -1
  92. package/cjs/idx/types/index.js +18 -1
  93. package/cjs/idx/types/index.js.map +1 -1
  94. package/cjs/oidc/endpoints/authorize.js +4 -1
  95. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  96. package/cjs/types/Token.js.map +1 -1
  97. package/cjs/types/Transaction.js.map +1 -1
  98. package/dist/okta-auth-js.min.js +1 -1
  99. package/dist/okta-auth-js.min.js.map +1 -1
  100. package/dist/okta-auth-js.umd.js +1 -1
  101. package/dist/okta-auth-js.umd.js.map +1 -1
  102. package/esm/index.js +8580 -16
  103. package/esm/index.js.map +1 -1
  104. package/lib/TokenManager.d.ts +2 -0
  105. package/lib/TransactionManager.d.ts +1 -0
  106. package/lib/idx/authenticator/Authenticator.d.ts +12 -0
  107. package/lib/idx/authenticator/OktaPassword.d.ts +11 -0
  108. package/lib/idx/authenticator/OktaVerifyTotp.d.ts +9 -0
  109. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +28 -0
  110. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +14 -0
  111. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +10 -0
  112. package/lib/idx/authenticator/getAuthenticator.d.ts +3 -0
  113. package/lib/idx/authenticator/index.d.ts +6 -0
  114. package/{esm/crypto/webcrypto.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -4
  115. package/lib/idx/flow/FlowSpecification.d.ts +8 -0
  116. package/{esm/oidc/endpoints/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -5
  117. package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
  118. package/{esm/crypto/index.js → lib/idx/flow/RemediationFlow.d.ts} +3 -6
  119. package/lib/idx/{flowMonitors → flow}/index.d.ts +5 -4
  120. package/lib/idx/index.d.ts +3 -0
  121. package/lib/idx/interact.d.ts +1 -0
  122. package/lib/idx/poll.d.ts +13 -0
  123. package/lib/idx/proceed.d.ts +21 -0
  124. package/lib/idx/register.d.ts +1 -1
  125. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +9 -5
  126. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +0 -1
  127. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +8 -3
  128. package/lib/idx/remediators/Base/Remediator.d.ts +9 -6
  129. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +5 -4
  130. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +8 -4
  131. package/lib/idx/remediators/ChallengePoll.d.ts +15 -0
  132. package/{esm/tx/util.js → lib/idx/remediators/EnrollPoll.d.ts} +11 -13
  133. package/lib/idx/remediators/Identify.d.ts +1 -3
  134. package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +6 -2
  135. package/lib/idx/remediators/Skip.d.ts +3 -0
  136. package/lib/idx/remediators/index.d.ts +2 -0
  137. package/lib/idx/run.d.ts +8 -10
  138. package/lib/idx/transactionMeta.d.ts +24 -1
  139. package/lib/idx/types/FlowIdentifier.d.ts +1 -0
  140. package/lib/idx/types/idx-js.d.ts +52 -1
  141. package/lib/idx/types/index.d.ts +16 -3
  142. package/lib/types/OktaAuthOptions.d.ts +3 -0
  143. package/lib/types/Token.d.ts +1 -0
  144. package/lib/types/Transaction.d.ts +2 -0
  145. package/lib/types/api.d.ts +15 -2
  146. package/package.json +16 -8
  147. package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -45
  148. package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  149. package/cjs/idx/flowMonitors/FlowMonitor.js +0 -69
  150. package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
  151. package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -55
  152. package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  153. package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js +0 -35
  154. package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  155. package/cjs/idx/flowMonitors/index.js +0 -54
  156. package/cjs/idx/flowMonitors/index.js.map +0 -1
  157. package/esm/AuthStateManager.js +0 -214
  158. package/esm/AuthStateManager.js.map +0 -1
  159. package/esm/OktaAuth.js +0 -705
  160. package/esm/OktaAuth.js.map +0 -1
  161. package/esm/OktaUserAgent.js +0 -49
  162. package/esm/OktaUserAgent.js.map +0 -1
  163. package/esm/PromiseQueue.js +0 -71
  164. package/esm/PromiseQueue.js.map +0 -1
  165. package/esm/SavedObject.js +0 -91
  166. package/esm/SavedObject.js.map +0 -1
  167. package/esm/StorageManager.js +0 -190
  168. package/esm/StorageManager.js.map +0 -1
  169. package/esm/TokenManager.js +0 -455
  170. package/esm/TokenManager.js.map +0 -1
  171. package/esm/TransactionManager.js +0 -324
  172. package/esm/TransactionManager.js.map +0 -1
  173. package/esm/browser/browserStorage.js +0 -256
  174. package/esm/browser/browserStorage.js.map +0 -1
  175. package/esm/browser/fingerprint.js +0 -74
  176. package/esm/browser/fingerprint.js.map +0 -1
  177. package/esm/builderUtil.js +0 -56
  178. package/esm/builderUtil.js.map +0 -1
  179. package/esm/clock.js +0 -32
  180. package/esm/clock.js.map +0 -1
  181. package/esm/constants.js +0 -36
  182. package/esm/constants.js.map +0 -1
  183. package/esm/crypto/base64.js +0 -66
  184. package/esm/crypto/base64.js.map +0 -1
  185. package/esm/crypto/browser.js.map +0 -1
  186. package/esm/crypto/index.js.map +0 -1
  187. package/esm/crypto/node.js +0 -54
  188. package/esm/crypto/node.js.map +0 -1
  189. package/esm/crypto/oidcHash.js +0 -27
  190. package/esm/crypto/oidcHash.js.map +0 -1
  191. package/esm/crypto/verifyToken.js +0 -39
  192. package/esm/crypto/verifyToken.js.map +0 -1
  193. package/esm/crypto/webcrypto.js.map +0 -1
  194. package/esm/errors/AuthApiError.js +0 -30
  195. package/esm/errors/AuthApiError.js.map +0 -1
  196. package/esm/errors/AuthPollStopError.js +0 -20
  197. package/esm/errors/AuthPollStopError.js.map +0 -1
  198. package/esm/errors/AuthSdkError.js +0 -29
  199. package/esm/errors/AuthSdkError.js.map +0 -1
  200. package/esm/errors/CustomError.js +0 -21
  201. package/esm/errors/CustomError.js.map +0 -1
  202. package/esm/errors/OAuthError.js +0 -22
  203. package/esm/errors/OAuthError.js.map +0 -1
  204. package/esm/errors/index.js +0 -22
  205. package/esm/errors/index.js.map +0 -1
  206. package/esm/features.js +0 -64
  207. package/esm/features.js.map +0 -1
  208. package/esm/fetch/fetchRequest.js +0 -92
  209. package/esm/fetch/fetchRequest.js.map +0 -1
  210. package/esm/http/headers.js +0 -17
  211. package/esm/http/headers.js.map +0 -1
  212. package/esm/http/index.js +0 -3
  213. package/esm/http/index.js.map +0 -1
  214. package/esm/http/request.js +0 -145
  215. package/esm/http/request.js.map +0 -1
  216. package/esm/idx/authenticate.js +0 -47
  217. package/esm/idx/authenticate.js.map +0 -1
  218. package/esm/idx/cancel.js +0 -32
  219. package/esm/idx/cancel.js.map +0 -1
  220. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
  221. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  222. package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
  223. package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
  224. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
  225. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  226. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
  227. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  228. package/esm/idx/flowMonitors/index.js +0 -16
  229. package/esm/idx/flowMonitors/index.js.map +0 -1
  230. package/esm/idx/handleInteractionCodeRedirect.js +0 -64
  231. package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
  232. package/esm/idx/headers.js +0 -39
  233. package/esm/idx/headers.js.map +0 -1
  234. package/esm/idx/index.js +0 -20
  235. package/esm/idx/index.js.map +0 -1
  236. package/esm/idx/interact.js +0 -86
  237. package/esm/idx/interact.js.map +0 -1
  238. package/esm/idx/introspect.js +0 -61
  239. package/esm/idx/introspect.js.map +0 -1
  240. package/esm/idx/recoverPassword.js +0 -46
  241. package/esm/idx/recoverPassword.js.map +0 -1
  242. package/esm/idx/register.js +0 -63
  243. package/esm/idx/register.js.map +0 -1
  244. package/esm/idx/remediate.js +0 -302
  245. package/esm/idx/remediate.js.map +0 -1
  246. package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
  247. package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
  248. package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
  249. package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
  250. package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
  251. package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
  252. package/esm/idx/remediators/Base/Remediator.js +0 -221
  253. package/esm/idx/remediators/Base/Remediator.js.map +0 -1
  254. package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
  255. package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
  256. package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -65
  257. package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
  258. package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
  259. package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
  260. package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
  261. package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
  262. package/esm/idx/remediators/EnrollProfile.js +0 -79
  263. package/esm/idx/remediators/EnrollProfile.js.map +0 -1
  264. package/esm/idx/remediators/Identify.js +0 -87
  265. package/esm/idx/remediators/Identify.js.map +0 -1
  266. package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
  267. package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
  268. package/esm/idx/remediators/RedirectIdp.js.map +0 -1
  269. package/esm/idx/remediators/ResetAuthenticator.js +0 -18
  270. package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
  271. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
  272. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
  273. package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
  274. package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
  275. package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
  276. package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
  277. package/esm/idx/remediators/Skip.js +0 -23
  278. package/esm/idx/remediators/Skip.js.map +0 -1
  279. package/esm/idx/remediators/index.js +0 -26
  280. package/esm/idx/remediators/index.js.map +0 -1
  281. package/esm/idx/remediators/util.js +0 -35
  282. package/esm/idx/remediators/util.js.map +0 -1
  283. package/esm/idx/run.js +0 -222
  284. package/esm/idx/run.js.map +0 -1
  285. package/esm/idx/startTransaction.js +0 -27
  286. package/esm/idx/startTransaction.js.map +0 -1
  287. package/esm/idx/transactionMeta.js +0 -125
  288. package/esm/idx/transactionMeta.js.map +0 -1
  289. package/esm/idx/types/idx-js.js +0 -20
  290. package/esm/idx/types/idx-js.js.map +0 -1
  291. package/esm/idx/types/index.js +0 -44
  292. package/esm/idx/types/index.js.map +0 -1
  293. package/esm/oidc/decodeToken.js +0 -31
  294. package/esm/oidc/decodeToken.js.map +0 -1
  295. package/esm/oidc/endpoints/authorize.js +0 -61
  296. package/esm/oidc/endpoints/authorize.js.map +0 -1
  297. package/esm/oidc/endpoints/index.js.map +0 -1
  298. package/esm/oidc/endpoints/token.js +0 -97
  299. package/esm/oidc/endpoints/token.js.map +0 -1
  300. package/esm/oidc/endpoints/well-known.js +0 -58
  301. package/esm/oidc/endpoints/well-known.js.map +0 -1
  302. package/esm/oidc/exchangeCodeForTokens.js +0 -69
  303. package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
  304. package/esm/oidc/getToken.js +0 -180
  305. package/esm/oidc/getToken.js.map +0 -1
  306. package/esm/oidc/getUserInfo.js +0 -82
  307. package/esm/oidc/getUserInfo.js.map +0 -1
  308. package/esm/oidc/getWithPopup.js +0 -34
  309. package/esm/oidc/getWithPopup.js.map +0 -1
  310. package/esm/oidc/getWithRedirect.js +0 -61
  311. package/esm/oidc/getWithRedirect.js.map +0 -1
  312. package/esm/oidc/getWithoutPrompt.js +0 -29
  313. package/esm/oidc/getWithoutPrompt.js.map +0 -1
  314. package/esm/oidc/handleOAuthResponse.js +0 -148
  315. package/esm/oidc/handleOAuthResponse.js.map +0 -1
  316. package/esm/oidc/index.js +0 -29
  317. package/esm/oidc/index.js.map +0 -1
  318. package/esm/oidc/parseFromUrl.js +0 -144
  319. package/esm/oidc/parseFromUrl.js.map +0 -1
  320. package/esm/oidc/renewToken.js +0 -85
  321. package/esm/oidc/renewToken.js.map +0 -1
  322. package/esm/oidc/renewTokens.js +0 -74
  323. package/esm/oidc/renewTokens.js.map +0 -1
  324. package/esm/oidc/renewTokensWithRefresh.js +0 -55
  325. package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
  326. package/esm/oidc/revokeToken.js +0 -57
  327. package/esm/oidc/revokeToken.js.map +0 -1
  328. package/esm/oidc/util/browser.js +0 -74
  329. package/esm/oidc/util/browser.js.map +0 -1
  330. package/esm/oidc/util/defaultTokenParams.js +0 -42
  331. package/esm/oidc/util/defaultTokenParams.js.map +0 -1
  332. package/esm/oidc/util/errors.js +0 -31
  333. package/esm/oidc/util/errors.js.map +0 -1
  334. package/esm/oidc/util/index.js +0 -25
  335. package/esm/oidc/util/index.js.map +0 -1
  336. package/esm/oidc/util/loginRedirect.js +0 -88
  337. package/esm/oidc/util/loginRedirect.js.map +0 -1
  338. package/esm/oidc/util/oauth.js +0 -70
  339. package/esm/oidc/util/oauth.js.map +0 -1
  340. package/esm/oidc/util/pkce.js +0 -55
  341. package/esm/oidc/util/pkce.js.map +0 -1
  342. package/esm/oidc/util/prepareTokenParams.js +0 -75
  343. package/esm/oidc/util/prepareTokenParams.js.map +0 -1
  344. package/esm/oidc/util/refreshToken.js +0 -24
  345. package/esm/oidc/util/refreshToken.js.map +0 -1
  346. package/esm/oidc/util/urlParams.js +0 -54
  347. package/esm/oidc/util/urlParams.js.map +0 -1
  348. package/esm/oidc/util/validateClaims.js +0 -53
  349. package/esm/oidc/util/validateClaims.js.map +0 -1
  350. package/esm/oidc/util/validateToken.js +0 -21
  351. package/esm/oidc/util/validateToken.js.map +0 -1
  352. package/esm/oidc/verifyToken.js +0 -78
  353. package/esm/oidc/verifyToken.js.map +0 -1
  354. package/esm/options.js +0 -144
  355. package/esm/options.js.map +0 -1
  356. package/esm/server/serverStorage.js +0 -111
  357. package/esm/server/serverStorage.js.map +0 -1
  358. package/esm/services/TokenService.js +0 -103
  359. package/esm/services/TokenService.js.map +0 -1
  360. package/esm/session.js +0 -81
  361. package/esm/session.js.map +0 -1
  362. package/esm/tx/AuthTransaction.js +0 -213
  363. package/esm/tx/AuthTransaction.js.map +0 -1
  364. package/esm/tx/TransactionState.js.map +0 -1
  365. package/esm/tx/api.js +0 -87
  366. package/esm/tx/api.js.map +0 -1
  367. package/esm/tx/index.js +0 -18
  368. package/esm/tx/index.js.map +0 -1
  369. package/esm/tx/poll.js +0 -124
  370. package/esm/tx/poll.js.map +0 -1
  371. package/esm/tx/util.js.map +0 -1
  372. package/esm/types/AuthState.js +0 -3
  373. package/esm/types/Cookies.js +0 -3
  374. package/esm/types/EventEmitter.js +0 -3
  375. package/esm/types/EventEmitter.js.map +0 -1
  376. package/esm/types/JWT.js +0 -3
  377. package/esm/types/JWT.js.map +0 -1
  378. package/esm/types/OAuth.js +0 -3
  379. package/esm/types/OAuth.js.map +0 -1
  380. package/esm/types/OktaAuthOptions.js +0 -3
  381. package/esm/types/OktaAuthOptions.js.map +0 -1
  382. package/esm/types/Storage.js +0 -3
  383. package/esm/types/Storage.js.map +0 -1
  384. package/esm/types/Token.js +0 -29
  385. package/esm/types/Token.js.map +0 -1
  386. package/esm/types/TokenManager.js +0 -3
  387. package/esm/types/TokenManager.js.map +0 -1
  388. package/esm/types/Transaction.js +0 -57
  389. package/esm/types/Transaction.js.map +0 -1
  390. package/esm/types/UserClaims.js +0 -3
  391. package/esm/types/UserClaims.js.map +0 -1
  392. package/esm/types/api.js +0 -3
  393. package/esm/types/api.js.map +0 -1
  394. package/esm/types/http.js +0 -3
  395. package/esm/types/http.js.map +0 -1
  396. package/esm/types/index.js +0 -27
  397. package/esm/types/index.js.map +0 -1
  398. package/esm/util/console.js +0 -53
  399. package/esm/util/console.js.map +0 -1
  400. package/esm/util/emailVerify.js +0 -21
  401. package/esm/util/emailVerify.js.map +0 -1
  402. package/esm/util/index.js +0 -18
  403. package/esm/util/index.js.map +0 -1
  404. package/esm/util/misc.js +0 -33
  405. package/esm/util/misc.js.map +0 -1
  406. package/esm/util/object.js +0 -117
  407. package/esm/util/object.js.map +0 -1
  408. package/esm/util/sharedStorage.js +0 -43
  409. package/esm/util/sharedStorage.js.map +0 -1
  410. package/esm/util/types.js +0 -27
  411. package/esm/util/types.js.map +0 -1
  412. package/esm/util/url.js +0 -64
  413. package/esm/util/url.js.map +0 -1
  414. package/lib/idx/flowMonitors/AuthenticationFlowMonitor.d.ts +0 -15
  415. package/lib/idx/flowMonitors/FlowMonitor.d.ts +0 -23
  416. package/lib/idx/flowMonitors/PasswordRecoveryFlowMonitor.d.ts +0 -16
  417. package/lib/idx/flowMonitors/RegistrationFlowMonitor.d.ts +0 -15
@@ -1,22 +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 CustomError from './CustomError';
13
- export default class OAuthError extends CustomError {
14
- constructor(errorCode, summary) {
15
- super(summary);
16
- this.name = 'OAuthError';
17
- this.errorCode = errorCode;
18
- this.errorSummary = summary;
19
- }
20
-
21
- }
22
- //# sourceMappingURL=OAuthError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/errors/OAuthError.ts"],"names":["CustomError","OAuthError","constructor","errorCode","summary","name","errorSummary"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAOA,WAAP,MAAwB,eAAxB;AAEA,eAAe,MAAMC,UAAN,SAAyBD,WAAzB,CAAqC;AAIlDE,EAAAA,WAAW,CAACC,SAAD,EAAoBC,OAApB,EAAqC;AAC9C,UAAMA,OAAN;AAEA,SAAKC,IAAL,GAAY,YAAZ;AACA,SAAKF,SAAL,GAAiBA,SAAjB;AACA,SAAKG,YAAL,GAAoBF,OAApB;AACD;;AAViD","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 CustomError from './CustomError';\n\nexport default class OAuthError extends CustomError {\n errorCode: string;\n errorSummary: string;\n\n constructor(errorCode: string, summary: string) {\n super(summary);\n\n this.name = 'OAuthError';\n this.errorCode = errorCode;\n this.errorSummary = summary;\n }\n}\n\n"],"file":"OAuthError.js"}
@@ -1,22 +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 AuthApiError from './AuthApiError';
13
- import AuthPollStopError from './AuthPollStopError';
14
- import AuthSdkError from './AuthSdkError';
15
- import OAuthError from './OAuthError';
16
-
17
- function isAuthApiError(obj) {
18
- return obj instanceof AuthApiError;
19
- }
20
-
21
- export { isAuthApiError, AuthApiError, AuthPollStopError, AuthSdkError, OAuthError };
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/errors/index.ts"],"names":["AuthApiError","AuthPollStopError","AuthSdkError","OAuthError","isAuthApiError","obj"],"mappings":"AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAOA,YAAP,MAAyB,gBAAzB;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,UAAP,MAAuB,cAAvB;;AAEA,SAASC,cAAT,CAAwBC,GAAxB,EAAuD;AACrD,SAAQA,GAAG,YAAYL,YAAvB;AACD;;AAED,SACEI,cADF,EAEEJ,YAFF,EAGEC,iBAHF,EAIEC,YAJF,EAKEC,UALF","sourcesContent":["\n/*!\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 AuthApiError from './AuthApiError';\nimport AuthPollStopError from './AuthPollStopError';\nimport AuthSdkError from './AuthSdkError';\nimport OAuthError from './OAuthError';\n\nfunction isAuthApiError(obj: any): obj is AuthApiError {\n return (obj instanceof AuthApiError);\n}\n\nexport {\n isAuthApiError,\n AuthApiError,\n AuthPollStopError,\n AuthSdkError,\n OAuthError\n};\n"],"file":"index.js"}
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":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAOA,UAAP,MAAuB,aAAvB;;AAGA,SAASC,QAAT,CAAkBC,QAAlB,EAAqE;AACnE,MAAIA,QAAQ,CAACC,OAAT,CAAiBC,GAAjB,CAAqB,cAArB,KACFF,QAAQ,CAACC,OAAT,CAAiBC,GAAjB,CAAqB,cAArB,EAAqCC,WAArC,GAAmDC,OAAnD,CA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CAHqE,CAKrE;;AACA,MAAI2B,WAAW,KAAK,kBAAhB,IAAsCD,IAAtC,IAA8C,OAAOA,IAAP,KAAgB,QAAlE,EAA4E;AAC1EA,IAAAA,IAAI,GAAGR,IAAI,CAACC,SAAL,CAAeO,IAAf,CAAP;AACD;;AACD,MAAIE,KAAK,GAAGC,MAAM,CAACD,KAAP,IAAgB/B,UAA5B;AACA,MAAIiC,YAAY,GAAGF,KAAK,CAACJ,GAAD,EAAM;AAC5BD,IAAAA,MAAM,EAAEA,MADoB;AAE5BvB,IAAAA,OAAO,EAAEyB,IAAI,CAACzB,OAFc;AAG5B0B,IAAAA,IAAI,EAAEA,IAHsB;AAI5BK,IAAAA,WAAW,EAAEN,IAAI,CAACO,eAAL,GAAuB,SAAvB,GAAmC;AAJpB,GAAN,CAAxB;;AAOA,MAAI,CAACF,YAAY,CAACG,OAAlB,EAA2B;AACzBH,IAAAA,YAAY,GAAGI,OAAO,CAACC,OAAR,CAAgBL,YAAhB,CAAf;AACD;;AAED,SAAOA,YAAY,CAACM,IAAb,CAAkB,UAASrC,QAAT,EAAmB;AAC1C,QAAIQ,KAAK,GAAG,CAACR,QAAQ,CAACsC,EAAtB;AACA,QAAI1B,MAAM,GAAGZ,QAAQ,CAACY,MAAtB;AACA,WAAOb,QAAQ,CAACC,QAAD,CAAR,CACJqC,IADI,CACCxB,IAAI,IAAI;AACZ,aAAOF,YAAY,CAACC,MAAD,EAASC,IAAT,EAAeb,QAAf,CAAnB;AACD,KAHI,EAIJqC,IAJI,CAICpB,MAAM,IAAI;AAAA;;AACd,UAAIT,KAAK,4BAAIS,MAAM,CAACK,YAAX,iDAAI,qBAAqBd,KAAlC,EAAyC;AACvC;AACA,cAAMS,MAAN;AACD;;AACD,aAAOA,MAAP;AACD,KAVI,CAAP;AAWD,GAdM,CAAP;AAeD;;AAED,eAAeM,YAAf","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":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,QAAT,EAAmBC,KAAnB,EAA0BC,aAA1B,EAAyCC,UAAzC,QAA2D,SAA3D;AACA,OAAOC,YAAP,MAAyB,wBAAzB;AACA,SAASC,oBAAT,EAA+BC,sBAA/B,QAA6D,cAA7D;AAGA,OAAO,SAASC,WAAT,CAAqBC,GAArB,EAAoCC,OAApC,EAA2E;AAChFA,EAAAA,OAAO,GAAGA,OAAO,IAAI,EAArB;AACA,MAAIC,GAAG,GAAGD,OAAO,CAACC,GAAlB;AAAA,MACIC,MAAM,GAAGF,OAAO,CAACE,MADrB;AAAA,MAEIC,IAAI,GAAGH,OAAO,CAACG,IAFnB;AAAA,MAGIC,cAAc,GAAGJ,OAAO,CAACI,cAH7B;AAAA,MAIIC,WAAW,GAAGL,OAAO,CAACK,WAJ1B;AAAA,MAKIC,eAAe,GAAGN,OAAO,CAACM,eAAR,KAA4B,IALlD;AAAA,MAKwD;AACpDC,EAAAA,WAAW,GAAGR,GAAG,CAACC,OAAJ,CAAYO,WAN9B;AAAA,MAOIC,OAAO,GAAGD,WAAW,CAACC,OAP1B;AAAA,MAQIC,SAAS,GAAGV,GAAG,CAACW,cAAJ,CAAmBC,YAAnB,CAAgCZ,GAAG,CAACC,OAAJ,CAAYY,OAA5C,CARhB;;AAUA,MAAIZ,OAAO,CAACa,aAAZ,EAA2B;AACzB,QAAIC,aAAa,GAAGL,SAAS,CAACM,UAAV,EAApB;AACA,QAAIC,cAAc,GAAGF,aAAa,CAACb,GAAD,CAAlC;;AACA,QAAIe,cAAc,IAAIC,IAAI,CAACC,G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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"}