@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,63 +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 { transactionMetaExist } from './transactionMeta';
21
- import { startTransaction } from './startTransaction';
22
- import { SelectEnrollProfile, EnrollProfile, SelectAuthenticatorEnroll, EnrollAuthenticator, AuthenticatorEnrollmentData, Skip } from './remediators';
23
- import { RegistrationFlowMonitor } from './flowMonitors';
24
- import { AuthSdkError } from '../errors';
25
- import { IdxFeature, IdxStatus } from '../types';
26
- var flow = {
27
- 'select-enroll-profile': SelectEnrollProfile,
28
- 'enroll-profile': EnrollProfile,
29
- 'authenticator-enrollment-data': AuthenticatorEnrollmentData,
30
- 'select-authenticator-enroll': SelectAuthenticatorEnroll,
31
- 'enroll-authenticator': EnrollAuthenticator,
32
- 'skip': Skip
33
- };
34
- export function register(_x, _x2) {
35
- return _register.apply(this, arguments);
36
- }
37
-
38
- function _register() {
39
- _register = _asyncToGenerator(function* (authClient, options) {
40
- // Only check at the beginning of the transaction
41
- if (!transactionMetaExist(authClient)) {
42
- var {
43
- enabledFeatures
44
- } = yield startTransaction(authClient, options);
45
-
46
- if (enabledFeatures && !enabledFeatures.includes(IdxFeature.REGISTRATION)) {
47
- var error = new AuthSdkError('Registration is not supported based on your current org configuration.');
48
- return {
49
- status: IdxStatus.FAILURE,
50
- error
51
- };
52
- }
53
- }
54
-
55
- var flowMonitor = new RegistrationFlowMonitor(authClient);
56
- return run(authClient, _objectSpread(_objectSpread({}, options), {}, {
57
- flow,
58
- flowMonitor
59
- }));
60
- });
61
- return _register.apply(this, arguments);
62
- }
63
- //# sourceMappingURL=register.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/idx/register.ts"],"names":["run","transactionMetaExist","startTransaction","SelectEnrollProfile","EnrollProfile","SelectAuthenticatorEnroll","EnrollAuthenticator","AuthenticatorEnrollmentData","Skip","RegistrationFlowMonitor","AuthSdkError","IdxFeature","IdxStatus","flow","register","authClient","options","enabledFeatures","includes","REGISTRATION","error","status","FAILURE","flowMonitor"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,GAAT,QAAqC,OAArC;AACA,SAASC,oBAAT,QAAqC,mBAArC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SACEC,mBADF,EAEEC,aAFF,EAIEC,yBAJF,EAMEC,mBANF,EAQEC,2BARF,EAUEC,IAVF,QAYO,eAZP;AAaA,SAASC,uBAAT,QAAwC,gBAAxC;AACA,SAASC,YAAT,QAA6B,WAA7B;AACA,SAIEC,UAJF,EAKEC,SALF,QAMO,UANP;AAQA,IAAMC,IAAqB,GAAG;AAC5B,2BAAyBV,mBADG;AAE5B,oBAAkBC,aAFU;AAG5B,mCAAiCG,2BAHL;AAI5B,iCAA+BF,yBAJH;AAK5B,0BAAwBC,mBALI;AAM5B,UAAQE;AANoB,CAA9B;AAgBA,gBAAsBM,QAAtB;AAAA;AAAA;;;gCAAO,WACLC,UADK,EACiBC,OADjB,EAEoB;AACzB;AACA,QAAI,CAACf,oBAAoB,CAACc,UAAD,CAAzB,EAAuC;AACrC,UAAM;AAAEE,QAAAA;AAAF,gBAA4Bf,gBAAgB,CAACa,UAAD,EAAaC,OAAb,CAAlD;;AACA,UAAIC,eAAe,IAAI,CAACA,eAAe,CAACC,QAAhB,CAAyBP,UAAU,CAACQ,YAApC,CAAxB,EAA2E;AACzE,YAAMC,KAAK,GAAG,IAAIV,YAAJ,CAAiB,wEAAjB,CAAd;AACA,eAAO;AAAEW,UAAAA,MAAM,EAAET,SAAS,CAACU,OAApB;AAA6BF,UAAAA;AAA7B,SAAP;AACD;AACF;;AAED,QAAMG,WAAW,GAAG,IAAId,uBAAJ,CAA4BM,UAA5B,CAApB;AACA,WAAOf,GAAG,CAACe,UAAD,kCACLC,OADK;AAERH,MAAAA,IAFQ;AAGRU,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 { run, RemediationFlow } from './run';\nimport { transactionMetaExist } from './transactionMeta';\nimport { startTransaction } from './startTransaction';\nimport { \n SelectEnrollProfile,\n EnrollProfile,\n EnrollProfileValues,\n SelectAuthenticatorEnroll,\n SelectAuthenticatorEnrollValues,\n EnrollAuthenticator,\n EnrollAuthenticatorValues,\n AuthenticatorEnrollmentData,\n AuthenticatorEnrollmentDataValues,\n Skip,\n SkipValues,\n} from './remediators';\nimport { RegistrationFlowMonitor } from './flowMonitors';\nimport { AuthSdkError } from '../errors';\nimport { \n IdxOptions, \n IdxTransaction, \n OktaAuth, \n IdxFeature,\n IdxStatus,\n} from '../types';\n\nconst flow: RemediationFlow = {\n 'select-enroll-profile': SelectEnrollProfile,\n 'enroll-profile': EnrollProfile,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'enroll-authenticator': EnrollAuthenticator,\n 'skip': Skip,\n};\n\nexport type RegistrationOptions = IdxOptions \n & EnrollProfileValues \n & SelectAuthenticatorEnrollValues \n & EnrollAuthenticatorValues \n & AuthenticatorEnrollmentDataValues \n & SkipValues;\n\nexport async function register(\n authClient: OktaAuth, options: RegistrationOptions\n): Promise<IdxTransaction> {\n // Only check at the beginning of the transaction\n if (!transactionMetaExist(authClient)) {\n const { enabledFeatures } = await startTransaction(authClient, options);\n if (enabledFeatures && !enabledFeatures.includes(IdxFeature.REGISTRATION)) {\n const error = new AuthSdkError('Registration is not supported based on your current org configuration.');\n return { status: IdxStatus.FAILURE, error };\n }\n }\n \n const flowMonitor = new RegistrationFlowMonitor(authClient);\n return run(authClient, { \n ...options, \n flow,\n flowMonitor,\n });\n}\n"],"file":"register.js"}
@@ -1,302 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
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
-
20
- /* eslint-disable max-statements, max-depth, complexity */
21
- import { AuthSdkError } from '../errors';
22
- import { isIdxResponse } from './types/idx-js';
23
- // Return first match idxRemediation in allowed remediators
24
- export function getRemediator(idxRemediations, values, options) {
25
- var {
26
- flow,
27
- flowMonitor
28
- } = options;
29
- var remediator;
30
- var remediatorCandidates = [];
31
-
32
- for (var remediation of idxRemediations) {
33
- var isRemeditionInFlow = Object.keys(flow).includes(remediation.name);
34
-
35
- if (!isRemeditionInFlow) {
36
- continue;
37
- }
38
-
39
- var T = flow[remediation.name];
40
- remediator = new T(remediation, values);
41
-
42
- if (flowMonitor.isRemediatorCandidate(remediator, idxRemediations, values)) {
43
- if (remediator.canRemediate()) {
44
- // found the remediator
45
- return remediator;
46
- } // remediator cannot handle the current values
47
- // maybe return for next step
48
-
49
-
50
- remediatorCandidates.push(remediator);
51
- }
52
- } // TODO: why is it a problem to have multiple remediations?
53
- // JIRA: https://oktainc.atlassian.net/browse/OKTA-400758
54
- // if (remediatorCandidates.length > 1) {
55
- // const remediationNames = remediatorCandidates.reduce((acc, curr) => {
56
- // const name = curr.getName();
57
- // return acc ? `${acc}, ${name}` : name;
58
- // }, '');
59
- // throw new AuthSdkError(`
60
- // More than one remediation can match the current input, remediations: ${remediationNames}
61
- // `);
62
- // }
63
-
64
-
65
- return remediatorCandidates[0];
66
- }
67
-
68
- function isTerminalResponse(idxResponse) {
69
- var {
70
- neededToProceed,
71
- interactionCode
72
- } = idxResponse;
73
- return !neededToProceed.length && !interactionCode;
74
- }
75
-
76
- function canSkipFn(idxResponse) {
77
- return idxResponse.neededToProceed.some(_ref => {
78
- var {
79
- name
80
- } = _ref;
81
- return name === 'skip';
82
- });
83
- }
84
-
85
- function canResendFn(idxResponse) {
86
- return Object.keys(idxResponse.actions).some(actionName => actionName.includes('resend'));
87
- }
88
-
89
- function getIdxMessages(idxResponse, flow) {
90
- var _rawIdxState$messages;
91
-
92
- var messages = [];
93
-
94
- if (!flow) {
95
- return messages;
96
- }
97
-
98
- var {
99
- rawIdxState,
100
- neededToProceed
101
- } = idxResponse; // Handle global messages
102
-
103
- var globalMessages = (_rawIdxState$messages = rawIdxState.messages) === null || _rawIdxState$messages === void 0 ? void 0 : _rawIdxState$messages.value.map(message => message);
104
-
105
- if (globalMessages) {
106
- messages = [...messages, ...globalMessages];
107
- } // Handle field messages for current flow
108
-
109
-
110
- for (var remediation of neededToProceed) {
111
- var T = flow[remediation.name];
112
-
113
- if (!T) {
114
- continue;
115
- }
116
-
117
- var remediator = new T(remediation);
118
- var fieldMessages = remediator.getMessages();
119
-
120
- if (fieldMessages) {
121
- messages = [...messages, ...fieldMessages];
122
- }
123
- }
124
-
125
- return messages;
126
- }
127
-
128
- function getNextStep(remediator, idxResponse) {
129
- var nextStep = remediator.getNextStep();
130
- var canSkip = canSkipFn(idxResponse);
131
- var canResend = canResendFn(idxResponse);
132
- return _objectSpread(_objectSpread(_objectSpread({}, nextStep), canSkip && {
133
- canSkip
134
- }), canResend && {
135
- canResend
136
- });
137
- }
138
-
139
- function handleIdxError(e, flow, remediator) {
140
- // Handle idx messages
141
- var idxState = isIdxResponse(e) ? e : null;
142
-
143
- if (!idxState) {
144
- // Thrown error terminates the interaction with idx
145
- throw e;
146
- }
147
-
148
- var terminal = isTerminalResponse(idxState);
149
- var messages = getIdxMessages(idxState, flow);
150
-
151
- if (terminal) {
152
- return {
153
- terminal,
154
- messages
155
- };
156
- } else {
157
- var nextStep = remediator && getNextStep(remediator, idxState);
158
- return _objectSpread({
159
- messages
160
- }, nextStep && {
161
- nextStep
162
- });
163
- }
164
- }
165
-
166
- function getActionFromValues(values, idxResponse) {
167
- // Currently support resend actions only
168
- return Object.keys(idxResponse.actions).find(action => !!values.resend && action.includes('-resend'));
169
- }
170
-
171
- function removeActionFromValues(values) {
172
- // Currently support resend actions only
173
- values.resend = undefined;
174
- return values;
175
- } // This function is called recursively until it reaches success or cannot be remediated
176
-
177
-
178
- export function remediate(_x, _x2, _x3) {
179
- return _remediate.apply(this, arguments);
180
- }
181
-
182
- function _remediate() {
183
- _remediate = _asyncToGenerator(function* (idxResponse, values, options) {
184
- var {
185
- neededToProceed,
186
- interactionCode
187
- } = idxResponse;
188
- var {
189
- flow,
190
- flowMonitor
191
- } = options; // If the response contains an interaction code, there is no need to remediate
192
-
193
- if (interactionCode) {
194
- return {
195
- idxResponse
196
- };
197
- } // Reach to terminal state
198
-
199
-
200
- var terminal = isTerminalResponse(idxResponse);
201
- var messages = getIdxMessages(idxResponse, flow);
202
-
203
- if (terminal) {
204
- return {
205
- terminal,
206
- messages
207
- };
208
- } // Try actions in idxResponse first
209
-
210
-
211
- var actionFromValues = getActionFromValues(values, idxResponse);
212
- var actions = [...(options.actions || []), ...(actionFromValues && [actionFromValues] || [])];
213
-
214
- if (actions) {
215
- for (var action of actions) {
216
- var valuesWithoutExecutedAction = removeActionFromValues(values);
217
-
218
- if (typeof idxResponse.actions[action] === 'function') {
219
- try {
220
- idxResponse = yield idxResponse.actions[action]();
221
- } catch (e) {
222
- return handleIdxError(e, flow);
223
- }
224
-
225
- if (action === 'cancel') {
226
- return {
227
- canceled: true
228
- };
229
- }
230
-
231
- return remediate(idxResponse, valuesWithoutExecutedAction, options); // recursive call
232
- }
233
- }
234
- }
235
-
236
- var remediator = getRemediator(neededToProceed, values, options);
237
-
238
- if (!remediator) {
239
- throw new AuthSdkError("\n No remediation can match current flow, check policy settings in your org.\n Remediations: [".concat(neededToProceed.reduce((acc, curr) => acc ? acc + ' ,' + curr.name : curr.name, ''), "]\n "));
240
- }
241
-
242
- if (flowMonitor.loopDetected(remediator)) {
243
- throw new AuthSdkError("\n Remediation run into loop, break!!! remediation: ".concat(remediator.getName(), "\n "));
244
- } // Recursive loop breaker
245
- // Return next step to the caller
246
-
247
-
248
- if (!remediator.canRemediate()) {
249
- var nextStep = getNextStep(remediator, idxResponse);
250
- return {
251
- idxResponse,
252
- nextStep
253
- };
254
- }
255
-
256
- var name = remediator.getName();
257
- var data = remediator.getData();
258
-
259
- try {
260
- idxResponse = yield idxResponse.proceed(name, data); // Track succeed remediations in the current transaction
261
-
262
- yield flowMonitor.trackRemediations(name); // Successfully get interaction code
263
-
264
- if (idxResponse.interactionCode) {
265
- return {
266
- idxResponse
267
- };
268
- } // Reach to terminal state
269
-
270
-
271
- var _terminal = isTerminalResponse(idxResponse);
272
-
273
- var _messages = getIdxMessages(idxResponse, flow);
274
-
275
- if (_terminal) {
276
- return {
277
- terminal: _terminal,
278
- messages: _messages
279
- };
280
- } // Handle idx message in nextStep
281
-
282
-
283
- if (_messages.length) {
284
- var _nextStep = getNextStep(remediator, idxResponse);
285
-
286
- return {
287
- nextStep: _nextStep,
288
- messages: _messages
289
- };
290
- } // We may want to trim the values bag for the next remediation
291
- // Let the remediator decide what the values should be (default to current values)
292
-
293
-
294
- values = remediator.getValuesAfterProceed();
295
- return remediate(idxResponse, values, options); // recursive call
296
- } catch (e) {
297
- return handleIdxError(e, flow, remediator);
298
- }
299
- });
300
- return _remediate.apply(this, arguments);
301
- }
302
- //# sourceMappingURL=remediate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/idx/remediate.ts"],"names":["AuthSdkError","isIdxResponse","getRemediator","idxRemediations","values","options","flow","flowMonitor","remediator","remediatorCandidates","remediation","isRemeditionInFlow","Object","keys","includes","name","T","isRemediatorCandidate","canRemediate","push","isTerminalResponse","idxResponse","neededToProceed","interactionCode","length","canSkipFn","some","canResendFn","actions","actionName","getIdxMessages","messages","rawIdxState","globalMessages","value","map","message","fieldMessages","getMessages","getNextStep","nextStep","canSkip","canResend","handleIdxError","e","idxState","terminal","getActionFromValues","find","action","resend","removeActionFromValues","undefined","remediate","actionFromValues","valuesWithoutExecutedAction","canceled","reduce","acc","curr","loopDetected","getName","data","getData","proceed","trackRemediations","getValuesAfterProceed"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA,SAASA,YAAT,QAA6B,WAA7B;AAIA,SAGEC,aAHF,QAIO,gBAJP;AAaA;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;;AACA,UAAMU,SAAQ,GAAGD,cAAc,CAACT,WAAD,EAAcf,IAAd,CAA/B;;AACA,UAAIwC,SAAJ,EAAc;AACZ,eAAO;AAAEA,UAAAA,QAAQ,EAARA,SAAF;AAAYf,UAAAA,QAAQ,EAARA;AAAZ,SAAP;AACD,OAhBC,CAkBF;;;AACA,UAAIA,SAAQ,CAACP,MAAb,EAAqB;AACnB,YAAMgB,SAAQ,GAAGD,WAAW,CAAC/B,UAAD,EAAaa,WAAb,CAA5B;;AACA,eAAO;AAAEmB,UAAAA,QAAQ,EAARA,SAAF;AAAYT,UAAAA,QAAQ,EAARA;AAAZ,SAAP;AACD,OAtBC,CAwBF;AACA;;;AACA3B,MAAAA,MAAM,GAAGI,UAAU,CAAC0D,qBAAX,EAAT;AACA,aAAOb,SAAS,CAAChC,WAAD,EAAcjB,MAAd,EAAsBC,OAAtB,CAAhB,CA3BE,CA2B8C;AACjD,KA5BD,CA4BE,OAAOuC,CAAP,EAAU;AACV,aAAOD,cAAc,CAACC,CAAD,EAAItC,IAAJ,EAAUE,UAAV,CAArB;AACD;AACF,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\n/* eslint-disable max-statements, max-depth, complexity */\nimport { AuthSdkError } from '../errors';\nimport { Remediator, RemediationValues } from './remediators';\nimport { RunOptions, RemediationFlow } from './run';\nimport { NextStep, IdxMessage } from './types';\nimport { \n IdxResponse, \n IdxRemediation,\n isIdxResponse, \n} from './types/idx-js';\n\ninterface RemediationResponse {\n idxResponse?: IdxResponse;\n nextStep?: NextStep;\n messages?: IdxMessage[];\n terminal?: boolean;\n canceled?: boolean;\n}\n// Return first match idxRemediation in allowed remediators\nexport function getRemediator(\n idxRemediations: IdxRemediation[],\n values: RemediationValues,\n options: RunOptions,\n): Remediator {\n const { flow, flowMonitor } = options;\n\n let remediator;\n const remediatorCandidates = [];\n for (let remediation of idxRemediations) {\n const isRemeditionInFlow = Object.keys(flow).includes(remediation.name);\n if (!isRemeditionInFlow) {\n continue;\n }\n \n const T = flow[remediation.name];\n remediator = new T(remediation, values);\n if (flowMonitor.isRemediatorCandidate(remediator, idxRemediations, values)) {\n if (remediator.canRemediate()) {\n // found the remediator\n return remediator;\n }\n // remediator cannot handle the current values\n // maybe return for next step\n remediatorCandidates.push(remediator); \n }\n }\n \n // TODO: why is it a problem to have multiple remediations? \n // JIRA: https://oktainc.atlassian.net/browse/OKTA-400758\n // if (remediatorCandidates.length > 1) {\n // const remediationNames = remediatorCandidates.reduce((acc, curr) => {\n // const name = curr.getName();\n // return acc ? `${acc}, ${name}` : name;\n // }, '');\n // throw new AuthSdkError(`\n // More than one remediation can match the current input, remediations: ${remediationNames}\n // `);\n // }\n\n return remediatorCandidates[0];\n}\n\nfunction isTerminalResponse(idxResponse: IdxResponse) {\n const { neededToProceed, interactionCode } = idxResponse;\n return !neededToProceed.length && !interactionCode;\n}\n\nfunction canSkipFn(idxResponse: IdxResponse) {\n return idxResponse.neededToProceed.some(({ name }) => name === 'skip');\n}\n\nfunction canResendFn(idxResponse: IdxResponse) {\n return Object.keys(idxResponse.actions).some(actionName => actionName.includes('resend'));\n}\n\nfunction getIdxMessages(\n idxResponse: IdxResponse, flow: RemediationFlow\n): IdxMessage[] {\n let messages = [];\n if (!flow) {\n return messages;\n }\n\n const { rawIdxState, neededToProceed } = idxResponse;\n\n // Handle global messages\n const globalMessages = rawIdxState.messages?.value.map(message => message);\n if (globalMessages) {\n messages = [...messages, ...globalMessages];\n }\n\n // Handle field messages for current flow\n for (let remediation of neededToProceed) {\n const T = flow[remediation.name];\n if (!T) {\n continue;\n }\n const remediator = new T(remediation);\n const fieldMessages = remediator.getMessages();\n if (fieldMessages) {\n messages = [...messages, ...fieldMessages];\n }\n }\n\n return messages;\n}\n\nfunction getNextStep(\n remediator: Remediator, idxResponse: IdxResponse\n): NextStep {\n const nextStep = remediator.getNextStep();\n const canSkip = canSkipFn(idxResponse);\n const canResend = canResendFn(idxResponse);\n return {\n ...nextStep,\n ...(canSkip && {canSkip}),\n ...(canResend && {canResend}),\n };\n}\n\nfunction handleIdxError(e, flow, remediator?) {\n // Handle idx messages\n const idxState: IdxResponse = isIdxResponse(e) ? e : null;\n if (!idxState) {\n // Thrown error terminates the interaction with idx\n throw e;\n }\n const terminal = isTerminalResponse(idxState);\n const messages = getIdxMessages(idxState, flow);\n if (terminal) {\n return { terminal, messages };\n } else {\n const nextStep = remediator && getNextStep(remediator, idxState);\n return { \n messages, \n ...(nextStep && { nextStep }) \n };\n }\n}\n\nfunction getActionFromValues(values, idxResponse: IdxResponse): string | undefined {\n // Currently support resend actions only\n return Object.keys(idxResponse.actions).find(action => !!values.resend && action.includes('-resend'));\n}\n\nfunction removeActionFromValues(values) {\n // Currently support resend actions only\n values.resend = undefined;\n return values;\n}\n\n// This function is called recursively until it reaches success or cannot be remediated\nexport async function remediate(\n idxResponse: IdxResponse,\n values: RemediationValues,\n options: RunOptions\n): Promise<RemediationResponse> {\n let { neededToProceed, interactionCode } = idxResponse;\n const { flow, flowMonitor } = options;\n\n // If the response contains an interaction code, there is no need to remediate\n if (interactionCode) {\n return { idxResponse };\n }\n\n // Reach to terminal state\n const terminal = isTerminalResponse(idxResponse);\n const messages = getIdxMessages(idxResponse, flow);\n if (terminal) {\n return { terminal, messages };\n }\n \n // Try actions in idxResponse first\n const actionFromValues = getActionFromValues(values, idxResponse);\n const actions = [\n ...options.actions || [],\n ...(actionFromValues && [actionFromValues] || []),\n ];\n if (actions) {\n for (let action of actions) {\n let valuesWithoutExecutedAction = removeActionFromValues(values);\n if (typeof idxResponse.actions[action] === 'function') {\n try {\n idxResponse = await idxResponse.actions[action]();\n } catch (e) {\n return handleIdxError(e, flow);\n }\n if (action === 'cancel') {\n return { canceled: true };\n }\n return remediate(idxResponse, valuesWithoutExecutedAction, options); // recursive call\n }\n }\n }\n\n const remediator = getRemediator(neededToProceed, values, options);\n \n if (!remediator) {\n throw new AuthSdkError(`\n No remediation can match current flow, check policy settings in your org.\n Remediations: [${neededToProceed.reduce((acc, curr) => acc ? acc + ' ,' + curr.name : curr.name, '')}]\n `);\n }\n\n if (flowMonitor.loopDetected(remediator)) {\n throw new AuthSdkError(`\n Remediation run into loop, break!!! remediation: ${remediator.getName()}\n `);\n }\n\n // Recursive loop breaker\n // Return next step to the caller\n if (!remediator.canRemediate()) {\n const nextStep = getNextStep(remediator, idxResponse);\n return { idxResponse, nextStep };\n }\n\n const name = remediator.getName();\n const data = remediator.getData();\n try {\n idxResponse = await idxResponse.proceed(name, data);\n\n // Track succeed remediations in the current transaction\n await flowMonitor.trackRemediations(name);\n \n // Successfully get interaction code\n if (idxResponse.interactionCode) {\n return { idxResponse };\n }\n\n // Reach to terminal state\n const terminal = isTerminalResponse(idxResponse);\n const messages = getIdxMessages(idxResponse, flow);\n if (terminal) {\n return { terminal, messages };\n }\n\n // Handle idx message in nextStep\n if (messages.length) {\n const nextStep = getNextStep(remediator, idxResponse);\n return { nextStep, messages };\n }\n \n // We may want to trim the values bag for the next remediation\n // Let the remediator decide what the values should be (default to current values)\n values = remediator.getValuesAfterProceed();\n return remediate(idxResponse, values, options); // recursive call\n } catch (e) {\n return handleIdxError(e, flow, remediator);\n }\n}\n"],"file":"remediate.js"}
@@ -1,68 +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
- import { AuthenticatorData } from './Base/AuthenticatorData';
19
- import { getAuthenticatorFromRemediation } from './util';
20
- export class AuthenticatorEnrollmentData extends AuthenticatorData {
21
- canRemediate() {
22
- var authenticator = this.getAuthenticatorFromValues();
23
- return !!(authenticator && authenticator.methodType && authenticator.phoneNumber);
24
- }
25
-
26
- mapAuthenticator() {
27
- var authenticatorFromValues = this.getAuthenticatorFromValues();
28
- var authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);
29
- return {
30
- id: authenticatorFromRemediation.form.value.find(_ref => {
31
- var {
32
- name
33
- } = _ref;
34
- return name === 'id';
35
- }).value,
36
- methodType: authenticatorFromValues.methodType,
37
- phoneNumber: authenticatorFromValues.phoneNumber
38
- };
39
- }
40
-
41
- getInputAuthenticator() {
42
- return [{
43
- name: 'methodType',
44
- type: 'string',
45
- required: true
46
- }, {
47
- name: 'phoneNumber',
48
- type: 'string',
49
- required: true
50
- }];
51
- }
52
-
53
- mapAuthenticatorFromValues(authenticator) {
54
- // get mapped authenticator from base class
55
- authenticator = super.mapAuthenticatorFromValues(authenticator); // add phoneNumber to authenticator if it exists in values
56
-
57
- var {
58
- phoneNumber
59
- } = this.values;
60
- return _objectSpread(_objectSpread({}, authenticator), phoneNumber && {
61
- phoneNumber
62
- });
63
- }
64
-
65
- }
66
-
67
- _defineProperty(AuthenticatorEnrollmentData, "remediationName", 'authenticator-enrollment-data');
68
- //# sourceMappingURL=AuthenticatorEnrollmentData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/remediators/AuthenticatorEnrollmentData.ts"],"names":["AuthenticatorData","getAuthenticatorFromRemediation","AuthenticatorEnrollmentData","canRemediate","authenticator","getAuthenticatorFromValues","methodType","phoneNumber","mapAuthenticator","authenticatorFromValues","authenticatorFromRemediation","remediation","id","form","value","find","name","getInputAuthenticator","type","required","mapAuthenticatorFromValues","values"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,iBAAT,QAA2D,0BAA3D;AACA,SAASC,+BAAT,QAAgD,QAAhD;AAOA,OAAO,MAAMC,2BAAN,SAA0CF,iBAA1C,CAA4D;AAKjEG,EAAAA,YAAY,GAAG;AACb,QAAMC,aAAa,GAAG,KAAKC,0BAAL,EAAtB;AACA,WAAO,CAAC,EAAED,aAAa,IAAIA,aAAa,CAACE,UAA/B,IAA6CF,aAAa,CAACG,WAA7D,CAAR;AACD;;AAEDC,EAAAA,gBAAgB,GAAG;AACjB,QAAMC,uBAAuB,GAAG,KAAKJ,0BAAL,EAAhC;AACA,QAAMK,4BAA4B,GAAGT,+BAA+B,CAAC,KAAKU,WAAN,CAApE;AACA,WAAO;AACLC,MAAAA,EAAE,EAAEF,4BAA4B,CAACG,IAA7B,CAAkCC,KAAlC,CACDC,IADC,CACI;AAAA,YAAC;AAAEC,UAAAA;AAAF,SAAD;AAAA,eAAcA,IAAI,KAAK,IAAvB;AAAA,OADJ,EACiCF,KAFhC;AAGLR,MAAAA,UAAU,EAAEG,uBAAuB,CAACH,UAH/B;AAILC,MAAAA,WAAW,EAAEE,uBAAuB,CAACF;AAJhC,KAAP;AAMD;;AAEDU,EAAAA,qBAAqB,GAAG;AACtB,WAAO,CACL;AAAED,MAAAA,IAAI,EAAE,YAAR;AAAsBE,MAAAA,IAAI,EAAE,QAA5B;AAAsCC,MAAAA,QAAQ,EAAE;AAAhD,KADK,EAEL;AAAEH,MAAAA,IAAI,EAAE,aAAR;AAAuBE,MAAAA,IAAI,EAAE,QAA7B;AAAuCC,MAAAA,QAAQ,EAAE;AAAjD,KAFK,CAAP;AAID;;AAESC,EAAAA,0BAA0B,CAAChB,aAAD,EAA+C;AACjF;AACAA,IAAAA,aAAa,GAAG,MAAMgB,0BAAN,CAAiChB,aAAjC,CAAhB,CAFiF,CAIjF;;AACA,QAAM;AAAEG,MAAAA;AAAF,QAAkB,KAAKc,MAA7B;AACA,2CACKjB,aADL,GAEMG,WAAW,IAAI;AAAEA,MAAAA;AAAF,KAFrB;AAID;;AAtCgE;;gBAAtDL,2B,qBACc,+B","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 { AuthenticatorData, AuthenticatorDataValues } from './Base/AuthenticatorData';\nimport { getAuthenticatorFromRemediation } from './util';\nimport { Authenticator } from '../types';\n\nexport type AuthenticatorEnrollmentDataValues = AuthenticatorDataValues & {\n phoneNumber?: string;\n resend?: boolean; // resend is not a remediator value - revise when IdxResponse structure is updated\n}\nexport class AuthenticatorEnrollmentData extends AuthenticatorData {\n static remediationName = 'authenticator-enrollment-data';\n\n values: AuthenticatorEnrollmentDataValues;\n\n canRemediate() {\n const authenticator = this.getAuthenticatorFromValues();\n return !!(authenticator && authenticator.methodType && authenticator.phoneNumber);\n }\n\n mapAuthenticator() {\n const authenticatorFromValues = this.getAuthenticatorFromValues();\n const authenticatorFromRemediation = getAuthenticatorFromRemediation(this.remediation);\n return { \n id: authenticatorFromRemediation.form.value\n .find(({ name }) => name === 'id').value,\n methodType: authenticatorFromValues.methodType,\n phoneNumber: authenticatorFromValues.phoneNumber,\n };\n }\n\n getInputAuthenticator() {\n return [\n { name: 'methodType', type: 'string', required: true },\n { name: 'phoneNumber', type: 'string', required: true },\n ];\n }\n\n protected mapAuthenticatorFromValues(authenticator?: Authenticator): Authenticator {\n // get mapped authenticator from base class\n authenticator = super.mapAuthenticatorFromValues(authenticator);\n\n // add phoneNumber to authenticator if it exists in values\n const { phoneNumber } = this.values;\n return { \n ...authenticator, \n ...(phoneNumber && { phoneNumber }) \n };\n }\n\n}\n"],"file":"AuthenticatorEnrollmentData.js"}
@@ -1,66 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
- /*!
4
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
5
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
6
- *
7
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- *
12
- * See the License for the specific language governing permissions and limitations under the License.
13
- */
14
- import { AuthenticatorData } from './Base/AuthenticatorData';
15
- export class AuthenticatorVerificationData extends AuthenticatorData {
16
- canRemediate() {
17
- var authenticator = this.getAuthenticatorFromValues();
18
- return !!(authenticator && authenticator.methodType);
19
- }
20
-
21
- mapAuthenticator() {
22
- var authenticatorFromRemediation = this.getAuthenticatorFromRemediation();
23
- var authenticatorFromValues = this.getAuthenticatorFromValues();
24
- return {
25
- id: authenticatorFromRemediation.form.value.find(_ref => {
26
- var {
27
- name
28
- } = _ref;
29
- return name === 'id';
30
- }).value,
31
- enrollmentId: authenticatorFromRemediation.form.value.find(_ref2 => {
32
- var {
33
- name
34
- } = _ref2;
35
- return name === 'enrollmentId';
36
- }).value,
37
- methodType: authenticatorFromValues.methodType
38
- };
39
- }
40
-
41
- getInputAuthenticator() {
42
- var authenticator = this.getAuthenticatorFromRemediation();
43
- var methodType = authenticator.form.value.find(_ref3 => {
44
- var {
45
- name
46
- } = _ref3;
47
- return name === 'methodType';
48
- }); // if has methodType in form, let user select the methodType
49
-
50
- if (methodType && methodType.options) {
51
- return {
52
- name: 'methodType',
53
- type: 'string',
54
- required: true
55
- };
56
- } // no methodType, then return form values
57
-
58
-
59
- var inputs = [...authenticator.form.value];
60
- return inputs;
61
- }
62
-
63
- }
64
-
65
- _defineProperty(AuthenticatorVerificationData, "remediationName", 'authenticator-verification-data');
66
- //# sourceMappingURL=AuthenticatorVerificationData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/idx/remediators/AuthenticatorVerificationData.ts"],"names":["AuthenticatorData","AuthenticatorVerificationData","canRemediate","authenticator","getAuthenticatorFromValues","methodType","mapAuthenticator","authenticatorFromRemediation","getAuthenticatorFromRemediation","authenticatorFromValues","id","form","value","find","name","enrollmentId","getInputAuthenticator","options","type","required","inputs"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,iBAAT,QAA2D,0BAA3D;AAIA,OAAO,MAAMC,6BAAN,SAA4CD,iBAA5C,CAA8D;AAKnEE,EAAAA,YAAY,GAAG;AACb,QAAMC,aAAa,GAAG,KAAKC,0BAAL,EAAtB;AACA,WAAO,CAAC,EAAED,aAAa,IAAIA,aAAa,CAACE,UAAjC,CAAR;AACD;;AAEDC,EAAAA,gBAAgB,GAAG;AACjB,QAAMC,4BAA4B,GAAG,KAAKC,+BAAL,EAArC;AACA,QAAMC,uBAAuB,GAAG,KAAKL,0BAAL,EAAhC;AACA,WAAO;AACLM,MAAAA,EAAE,EAAEH,4BAA4B,CAACI,IAA7B,CAAkCC,KAAlC,CACDC,IADC,CACI;AAAA,YAAC;AAAEC,UAAAA;AAAF,SAAD;AAAA,eAAcA,IAAI,KAAK,IAAvB;AAAA,OADJ,EACiCF,KAFhC;AAGLG,MAAAA,YAAY,EAAER,4BAA4B,CAACI,IAA7B,CAAkCC,KAAlC,CACXC,IADW,CACN;AAAA,YAAC;AAAEC,UAAAA;AAAF,SAAD;AAAA,eAAcA,IAAI,KAAK,cAAvB;AAAA,OADM,EACiCF,KAJ1C;AAKLP,MAAAA,UAAU,EAAEI,uBAAuB,CAACJ;AAL/B,KAAP;AAOD;;AAEDW,EAAAA,qBAAqB,GAAG;AACtB,QAAMb,aAAa,GAAG,KAAKK,+BAAL,EAAtB;AACA,QAAMH,UAAU,GAAGF,aAAa,CAACQ,IAAd,CAAmBC,KAAnB,CAAyBC,IAAzB,CAA8B;AAAA,UAAC;AAAEC,QAAAA;AAAF,OAAD;AAAA,aAAcA,IAAI,KAAK,YAAvB;AAAA,KAA9B,CAAnB,CAFsB,CAGtB;;AACA,QAAIT,UAAU,IAAIA,UAAU,CAACY,OAA7B,EAAsC;AACpC,aAAO;AAAEH,QAAAA,IAAI,EAAE,YAAR;AAAsBI,QAAAA,IAAI,EAAE,QAA5B;AAAsCC,QAAAA,QAAQ,EAAE;AAAhD,OAAP;AACD,KANqB,CAOtB;;;AACA,QAAMC,MAAM,GAAG,CAAC,GAAGjB,aAAa,CAACQ,IAAd,CAAmBC,KAAvB,CAAf;AACA,WAAOQ,MAAP;AACD;;AAhCkE;;gBAAxDnB,6B,qBACc,iC","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 { AuthenticatorData, AuthenticatorDataValues } from './Base/AuthenticatorData';\n\nexport type AuthenticatorVerificationDataValues = AuthenticatorDataValues;\n\nexport class AuthenticatorVerificationData extends AuthenticatorData {\n static remediationName = 'authenticator-verification-data';\n\n values: AuthenticatorVerificationDataValues;\n\n canRemediate() {\n const authenticator = this.getAuthenticatorFromValues();\n return !!(authenticator && authenticator.methodType);\n }\n\n mapAuthenticator() {\n const authenticatorFromRemediation = this.getAuthenticatorFromRemediation();\n const authenticatorFromValues = this.getAuthenticatorFromValues();\n return { \n id: authenticatorFromRemediation.form.value\n .find(({ name }) => name === 'id').value,\n enrollmentId: authenticatorFromRemediation.form.value\n .find(({ name }) => name === 'enrollmentId').value,\n methodType: authenticatorFromValues.methodType,\n };\n }\n\n getInputAuthenticator() {\n const authenticator = this.getAuthenticatorFromRemediation();\n const methodType = authenticator.form.value.find(({ name }) => name === 'methodType');\n // if has methodType in form, let user select the methodType\n if (methodType && methodType.options) {\n return { name: 'methodType', type: 'string', required: true };\n }\n // no methodType, then return form values\n const inputs = [...authenticator.form.value];\n return inputs;\n }\n\n}\n"],"file":"AuthenticatorVerificationData.js"}