@okta/okta-auth-js 5.6.0 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +28 -1
  3. package/cjs/OktaAuth.js +69 -35
  4. package/cjs/OktaAuth.js.map +1 -1
  5. package/cjs/OktaUserAgent.js +2 -2
  6. package/cjs/StorageManager.js +8 -0
  7. package/cjs/StorageManager.js.map +1 -1
  8. package/cjs/TransactionManager.js +24 -12
  9. package/cjs/TransactionManager.js.map +1 -1
  10. package/cjs/builderUtil.js +6 -0
  11. package/cjs/builderUtil.js.map +1 -1
  12. package/cjs/constants.js +3 -1
  13. package/cjs/constants.js.map +1 -1
  14. package/cjs/features.js +1 -1
  15. package/cjs/features.js.map +1 -1
  16. package/cjs/idx/authenticate.js +3 -18
  17. package/cjs/idx/authenticate.js.map +1 -1
  18. package/cjs/idx/flow/AuthenticationFlow.js +30 -0
  19. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
  20. package/cjs/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.js +0 -0
  21. package/cjs/idx/flow/AuthenticationFlowMonitor.js.map +1 -0
  22. package/cjs/idx/{flowMonitors → flow}/FlowMonitor.js +0 -0
  23. package/cjs/idx/flow/FlowMonitor.js.map +1 -0
  24. package/cjs/idx/flow/FlowSpecification.js +49 -0
  25. package/cjs/idx/flow/FlowSpecification.js.map +1 -0
  26. package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
  27. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
  28. package/cjs/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.js +0 -0
  29. package/cjs/idx/flow/PasswordRecoveryFlowMonitor.js.map +1 -0
  30. package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +15 -12
  31. package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
  32. package/cjs/idx/{flowMonitors → flow}/RegistrationFlowMonitor.js +0 -0
  33. package/cjs/idx/flow/RegistrationFlowMonitor.js.map +1 -0
  34. package/cjs/idx/flow/RemediationFlow.js +2 -0
  35. package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
  36. package/cjs/idx/flow/index.js +119 -0
  37. package/cjs/idx/flow/index.js.map +1 -0
  38. package/cjs/idx/index.js +26 -0
  39. package/cjs/idx/index.js.map +1 -1
  40. package/cjs/idx/interact.js +5 -2
  41. package/cjs/idx/interact.js.map +1 -1
  42. package/cjs/idx/introspect.js +24 -7
  43. package/cjs/idx/introspect.js.map +1 -1
  44. package/cjs/idx/proceed.js +49 -0
  45. package/cjs/idx/proceed.js.map +1 -0
  46. package/cjs/idx/recoverPassword.js +3 -17
  47. package/cjs/idx/recoverPassword.js.map +1 -1
  48. package/cjs/idx/register.js +7 -16
  49. package/cjs/idx/register.js.map +1 -1
  50. package/cjs/idx/remediate.js +33 -37
  51. package/cjs/idx/remediate.js.map +1 -1
  52. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  53. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +3 -1
  54. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  55. package/cjs/idx/remediators/Identify.js +4 -2
  56. package/cjs/idx/remediators/Identify.js.map +1 -1
  57. package/cjs/idx/run.js +36 -8
  58. package/cjs/idx/run.js.map +1 -1
  59. package/cjs/idx/startTransaction.js +2 -0
  60. package/cjs/idx/startTransaction.js.map +1 -1
  61. package/cjs/idx/transactionMeta.js +77 -39
  62. package/cjs/idx/transactionMeta.js.map +1 -1
  63. package/cjs/idx/types/FlowIdentifier.js +2 -0
  64. package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
  65. package/cjs/idx/types/idx-js.js +5 -0
  66. package/cjs/idx/types/idx-js.js.map +1 -1
  67. package/cjs/idx/types/index.js +16 -0
  68. package/cjs/idx/types/index.js.map +1 -1
  69. package/cjs/oidc/endpoints/authorize.js +4 -1
  70. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  71. package/cjs/oidc/getToken.js +14 -9
  72. package/cjs/oidc/getToken.js.map +1 -1
  73. package/cjs/oidc/getWithPopup.js +9 -2
  74. package/cjs/oidc/getWithPopup.js.map +1 -1
  75. package/cjs/oidc/getWithRedirect.js +2 -6
  76. package/cjs/oidc/getWithRedirect.js.map +1 -1
  77. package/cjs/oidc/renewTokens.js +28 -5
  78. package/cjs/oidc/renewTokens.js.map +1 -1
  79. package/cjs/oidc/util/browser.js +1 -13
  80. package/cjs/oidc/util/browser.js.map +1 -1
  81. package/cjs/oidc/util/loginRedirect.js +9 -5
  82. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  83. package/cjs/oidc/util/urlParams.js +1 -1
  84. package/cjs/oidc/util/urlParams.js.map +1 -1
  85. package/cjs/options.js +12 -2
  86. package/cjs/options.js.map +1 -1
  87. package/cjs/server/serverStorage.js +2 -1
  88. package/cjs/server/serverStorage.js.map +1 -1
  89. package/cjs/tx/AuthTransaction.js +1 -3
  90. package/cjs/tx/AuthTransaction.js.map +1 -1
  91. package/cjs/tx/api.js +3 -0
  92. package/cjs/tx/api.js.map +1 -1
  93. package/cjs/types/Transaction.js.map +1 -1
  94. package/{esm/clock.js → cjs/util/emailVerify.js} +14 -18
  95. package/cjs/util/emailVerify.js.map +1 -0
  96. package/cjs/util/index.js +13 -0
  97. package/cjs/util/index.js.map +1 -1
  98. package/dist/okta-auth-js.min.js +2 -74
  99. package/dist/okta-auth-js.min.js.LICENSE.txt +32 -0
  100. package/dist/okta-auth-js.min.js.map +1 -1
  101. package/dist/okta-auth-js.polyfill.js +2 -18
  102. package/{esm/crypto/webcrypto.js → dist/okta-auth-js.polyfill.js.LICENSE.txt} +8 -4
  103. package/dist/okta-auth-js.polyfill.js.map +1 -1
  104. package/dist/okta-auth-js.umd.js +2 -74
  105. package/dist/okta-auth-js.umd.js.LICENSE.txt +32 -0
  106. package/dist/okta-auth-js.umd.js.map +1 -1
  107. package/esm/index.js +8368 -16
  108. package/esm/index.js.map +1 -1
  109. package/lib/OktaAuth.d.ts +7 -3
  110. package/lib/StorageManager.d.ts +1 -0
  111. package/lib/TransactionManager.d.ts +5 -1
  112. package/lib/constants.d.ts +1 -0
  113. package/lib/crypto/base64.d.ts +2 -2
  114. package/lib/crypto/oidcHash.d.ts +1 -1
  115. package/lib/crypto/verifyToken.d.ts +1 -1
  116. package/{esm/oidc/endpoints/index.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -5
  117. package/lib/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.d.ts +0 -0
  118. package/lib/idx/{flowMonitors → flow}/FlowMonitor.d.ts +0 -0
  119. package/lib/idx/flow/FlowSpecification.d.ts +10 -0
  120. package/{esm/crypto/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -6
  121. package/lib/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.d.ts +0 -0
  122. package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
  123. package/lib/idx/{flowMonitors → flow}/RegistrationFlowMonitor.d.ts +0 -0
  124. package/lib/idx/flow/RemediationFlow.d.ts +13 -0
  125. package/lib/idx/{flowMonitors → flow}/index.d.ts +7 -2
  126. package/lib/idx/index.d.ts +2 -0
  127. package/lib/idx/introspect.d.ts +2 -1
  128. package/{esm/errors/AuthApiError.js → lib/idx/proceed.d.ts} +9 -19
  129. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +1 -4
  130. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +1 -4
  131. package/lib/idx/remediators/Identify.d.ts +1 -0
  132. package/lib/idx/run.d.ts +9 -9
  133. package/lib/idx/transactionMeta.d.ts +28 -4
  134. package/lib/idx/types/FlowIdentifier.d.ts +1 -0
  135. package/lib/idx/types/idx-js.d.ts +4 -0
  136. package/lib/idx/types/index.d.ts +14 -3
  137. package/lib/oidc/getToken.d.ts +2 -2
  138. package/lib/oidc/renewTokens.d.ts +0 -12
  139. package/lib/oidc/util/loginRedirect.d.ts +1 -1
  140. package/lib/types/OktaAuthOptions.d.ts +2 -0
  141. package/lib/types/Transaction.d.ts +2 -0
  142. package/lib/types/api.d.ts +20 -5
  143. package/{esm/errors/AuthPollStopError.js → lib/util/emailVerify.d.ts} +5 -8
  144. package/lib/util/index.d.ts +1 -0
  145. package/package.json +26 -14
  146. package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  147. package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
  148. package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  149. package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  150. package/cjs/idx/flowMonitors/index.js +0 -54
  151. package/cjs/idx/flowMonitors/index.js.map +0 -1
  152. package/esm/AuthStateManager.js +0 -214
  153. package/esm/AuthStateManager.js.map +0 -1
  154. package/esm/OktaAuth.js +0 -679
  155. package/esm/OktaAuth.js.map +0 -1
  156. package/esm/OktaUserAgent.js +0 -49
  157. package/esm/OktaUserAgent.js.map +0 -1
  158. package/esm/PromiseQueue.js +0 -71
  159. package/esm/PromiseQueue.js.map +0 -1
  160. package/esm/SavedObject.js +0 -91
  161. package/esm/SavedObject.js.map +0 -1
  162. package/esm/StorageManager.js +0 -182
  163. package/esm/StorageManager.js.map +0 -1
  164. package/esm/TokenManager.js +0 -455
  165. package/esm/TokenManager.js.map +0 -1
  166. package/esm/TransactionManager.js +0 -316
  167. package/esm/TransactionManager.js.map +0 -1
  168. package/esm/browser/browserStorage.js +0 -256
  169. package/esm/browser/browserStorage.js.map +0 -1
  170. package/esm/browser/fingerprint.js +0 -74
  171. package/esm/browser/fingerprint.js.map +0 -1
  172. package/esm/builderUtil.js +0 -50
  173. package/esm/builderUtil.js.map +0 -1
  174. package/esm/clock.js.map +0 -1
  175. package/esm/constants.js +0 -35
  176. package/esm/constants.js.map +0 -1
  177. package/esm/crypto/base64.js +0 -66
  178. package/esm/crypto/base64.js.map +0 -1
  179. package/esm/crypto/browser.js.map +0 -1
  180. package/esm/crypto/index.js.map +0 -1
  181. package/esm/crypto/node.js +0 -54
  182. package/esm/crypto/node.js.map +0 -1
  183. package/esm/crypto/oidcHash.js +0 -27
  184. package/esm/crypto/oidcHash.js.map +0 -1
  185. package/esm/crypto/verifyToken.js +0 -39
  186. package/esm/crypto/verifyToken.js.map +0 -1
  187. package/esm/crypto/webcrypto.js.map +0 -1
  188. package/esm/errors/AuthApiError.js.map +0 -1
  189. package/esm/errors/AuthPollStopError.js.map +0 -1
  190. package/esm/errors/AuthSdkError.js +0 -29
  191. package/esm/errors/AuthSdkError.js.map +0 -1
  192. package/esm/errors/CustomError.js +0 -21
  193. package/esm/errors/CustomError.js.map +0 -1
  194. package/esm/errors/OAuthError.js +0 -22
  195. package/esm/errors/OAuthError.js.map +0 -1
  196. package/esm/errors/index.js +0 -22
  197. package/esm/errors/index.js.map +0 -1
  198. package/esm/features.js +0 -64
  199. package/esm/features.js.map +0 -1
  200. package/esm/fetch/fetchRequest.js +0 -92
  201. package/esm/fetch/fetchRequest.js.map +0 -1
  202. package/esm/http/headers.js +0 -17
  203. package/esm/http/headers.js.map +0 -1
  204. package/esm/http/index.js +0 -3
  205. package/esm/http/index.js.map +0 -1
  206. package/esm/http/request.js +0 -145
  207. package/esm/http/request.js.map +0 -1
  208. package/esm/idx/authenticate.js +0 -47
  209. package/esm/idx/authenticate.js.map +0 -1
  210. package/esm/idx/cancel.js +0 -32
  211. package/esm/idx/cancel.js.map +0 -1
  212. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
  213. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  214. package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
  215. package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
  216. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
  217. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  218. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
  219. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  220. package/esm/idx/flowMonitors/index.js +0 -16
  221. package/esm/idx/flowMonitors/index.js.map +0 -1
  222. package/esm/idx/handleInteractionCodeRedirect.js +0 -64
  223. package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
  224. package/esm/idx/headers.js +0 -39
  225. package/esm/idx/headers.js.map +0 -1
  226. package/esm/idx/index.js +0 -20
  227. package/esm/idx/index.js.map +0 -1
  228. package/esm/idx/interact.js +0 -83
  229. package/esm/idx/interact.js.map +0 -1
  230. package/esm/idx/introspect.js +0 -45
  231. package/esm/idx/introspect.js.map +0 -1
  232. package/esm/idx/recoverPassword.js +0 -46
  233. package/esm/idx/recoverPassword.js.map +0 -1
  234. package/esm/idx/register.js +0 -63
  235. package/esm/idx/register.js.map +0 -1
  236. package/esm/idx/remediate.js +0 -302
  237. package/esm/idx/remediate.js.map +0 -1
  238. package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
  239. package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
  240. package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
  241. package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
  242. package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
  243. package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
  244. package/esm/idx/remediators/Base/Remediator.js +0 -221
  245. package/esm/idx/remediators/Base/Remediator.js.map +0 -1
  246. package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
  247. package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
  248. package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -63
  249. package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
  250. package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
  251. package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
  252. package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
  253. package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
  254. package/esm/idx/remediators/EnrollProfile.js +0 -79
  255. package/esm/idx/remediators/EnrollProfile.js.map +0 -1
  256. package/esm/idx/remediators/Identify.js +0 -86
  257. package/esm/idx/remediators/Identify.js.map +0 -1
  258. package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
  259. package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
  260. package/esm/idx/remediators/RedirectIdp.js +0 -38
  261. package/esm/idx/remediators/RedirectIdp.js.map +0 -1
  262. package/esm/idx/remediators/ResetAuthenticator.js +0 -18
  263. package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
  264. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
  265. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
  266. package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
  267. package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
  268. package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
  269. package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
  270. package/esm/idx/remediators/Skip.js +0 -23
  271. package/esm/idx/remediators/Skip.js.map +0 -1
  272. package/esm/idx/remediators/index.js +0 -26
  273. package/esm/idx/remediators/index.js.map +0 -1
  274. package/esm/idx/remediators/util.js +0 -35
  275. package/esm/idx/remediators/util.js.map +0 -1
  276. package/esm/idx/run.js +0 -201
  277. package/esm/idx/run.js.map +0 -1
  278. package/esm/idx/startTransaction.js +0 -27
  279. package/esm/idx/startTransaction.js.map +0 -1
  280. package/esm/idx/transactionMeta.js +0 -114
  281. package/esm/idx/transactionMeta.js.map +0 -1
  282. package/esm/idx/types/idx-js.js +0 -17
  283. package/esm/idx/types/idx-js.js.map +0 -1
  284. package/esm/idx/types/index.js +0 -44
  285. package/esm/idx/types/index.js.map +0 -1
  286. package/esm/oidc/decodeToken.js +0 -31
  287. package/esm/oidc/decodeToken.js.map +0 -1
  288. package/esm/oidc/endpoints/authorize.js +0 -61
  289. package/esm/oidc/endpoints/authorize.js.map +0 -1
  290. package/esm/oidc/endpoints/index.js.map +0 -1
  291. package/esm/oidc/endpoints/token.js +0 -97
  292. package/esm/oidc/endpoints/token.js.map +0 -1
  293. package/esm/oidc/endpoints/well-known.js +0 -58
  294. package/esm/oidc/endpoints/well-known.js.map +0 -1
  295. package/esm/oidc/exchangeCodeForTokens.js +0 -69
  296. package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
  297. package/esm/oidc/getToken.js +0 -175
  298. package/esm/oidc/getToken.js.map +0 -1
  299. package/esm/oidc/getUserInfo.js +0 -82
  300. package/esm/oidc/getUserInfo.js.map +0 -1
  301. package/esm/oidc/getWithPopup.js +0 -28
  302. package/esm/oidc/getWithPopup.js.map +0 -1
  303. package/esm/oidc/getWithRedirect.js +0 -65
  304. package/esm/oidc/getWithRedirect.js.map +0 -1
  305. package/esm/oidc/getWithoutPrompt.js +0 -29
  306. package/esm/oidc/getWithoutPrompt.js.map +0 -1
  307. package/esm/oidc/handleOAuthResponse.js +0 -148
  308. package/esm/oidc/handleOAuthResponse.js.map +0 -1
  309. package/esm/oidc/index.js +0 -29
  310. package/esm/oidc/index.js.map +0 -1
  311. package/esm/oidc/parseFromUrl.js +0 -144
  312. package/esm/oidc/parseFromUrl.js.map +0 -1
  313. package/esm/oidc/renewToken.js +0 -85
  314. package/esm/oidc/renewToken.js.map +0 -1
  315. package/esm/oidc/renewTokens.js +0 -52
  316. package/esm/oidc/renewTokens.js.map +0 -1
  317. package/esm/oidc/renewTokensWithRefresh.js +0 -55
  318. package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
  319. package/esm/oidc/revokeToken.js +0 -57
  320. package/esm/oidc/revokeToken.js.map +0 -1
  321. package/esm/oidc/util/browser.js +0 -85
  322. package/esm/oidc/util/browser.js.map +0 -1
  323. package/esm/oidc/util/defaultTokenParams.js +0 -42
  324. package/esm/oidc/util/defaultTokenParams.js.map +0 -1
  325. package/esm/oidc/util/errors.js +0 -31
  326. package/esm/oidc/util/errors.js.map +0 -1
  327. package/esm/oidc/util/index.js +0 -25
  328. package/esm/oidc/util/index.js.map +0 -1
  329. package/esm/oidc/util/loginRedirect.js +0 -84
  330. package/esm/oidc/util/loginRedirect.js.map +0 -1
  331. package/esm/oidc/util/oauth.js +0 -70
  332. package/esm/oidc/util/oauth.js.map +0 -1
  333. package/esm/oidc/util/pkce.js +0 -55
  334. package/esm/oidc/util/pkce.js.map +0 -1
  335. package/esm/oidc/util/prepareTokenParams.js +0 -75
  336. package/esm/oidc/util/prepareTokenParams.js.map +0 -1
  337. package/esm/oidc/util/refreshToken.js +0 -24
  338. package/esm/oidc/util/refreshToken.js.map +0 -1
  339. package/esm/oidc/util/urlParams.js +0 -54
  340. package/esm/oidc/util/urlParams.js.map +0 -1
  341. package/esm/oidc/util/validateClaims.js +0 -53
  342. package/esm/oidc/util/validateClaims.js.map +0 -1
  343. package/esm/oidc/util/validateToken.js +0 -21
  344. package/esm/oidc/util/validateToken.js.map +0 -1
  345. package/esm/oidc/verifyToken.js +0 -78
  346. package/esm/oidc/verifyToken.js.map +0 -1
  347. package/esm/options.js +0 -134
  348. package/esm/options.js.map +0 -1
  349. package/esm/server/serverStorage.js +0 -110
  350. package/esm/server/serverStorage.js.map +0 -1
  351. package/esm/services/TokenService.js +0 -103
  352. package/esm/services/TokenService.js.map +0 -1
  353. package/esm/session.js +0 -81
  354. package/esm/session.js.map +0 -1
  355. package/esm/tx/AuthTransaction.js +0 -215
  356. package/esm/tx/AuthTransaction.js.map +0 -1
  357. package/esm/tx/TransactionState.js.map +0 -1
  358. package/esm/tx/api.js +0 -84
  359. package/esm/tx/api.js.map +0 -1
  360. package/esm/tx/index.js +0 -18
  361. package/esm/tx/index.js.map +0 -1
  362. package/esm/tx/poll.js +0 -124
  363. package/esm/tx/poll.js.map +0 -1
  364. package/esm/tx/util.js +0 -26
  365. package/esm/tx/util.js.map +0 -1
  366. package/esm/types/AuthState.js +0 -3
  367. package/esm/types/Cookies.js +0 -3
  368. package/esm/types/EventEmitter.js +0 -3
  369. package/esm/types/EventEmitter.js.map +0 -1
  370. package/esm/types/JWT.js +0 -3
  371. package/esm/types/JWT.js.map +0 -1
  372. package/esm/types/OAuth.js +0 -3
  373. package/esm/types/OAuth.js.map +0 -1
  374. package/esm/types/OktaAuthOptions.js +0 -3
  375. package/esm/types/OktaAuthOptions.js.map +0 -1
  376. package/esm/types/Storage.js +0 -3
  377. package/esm/types/Storage.js.map +0 -1
  378. package/esm/types/Token.js +0 -29
  379. package/esm/types/Token.js.map +0 -1
  380. package/esm/types/TokenManager.js +0 -3
  381. package/esm/types/TokenManager.js.map +0 -1
  382. package/esm/types/Transaction.js +0 -57
  383. package/esm/types/Transaction.js.map +0 -1
  384. package/esm/types/UserClaims.js +0 -3
  385. package/esm/types/UserClaims.js.map +0 -1
  386. package/esm/types/api.js +0 -3
  387. package/esm/types/api.js.map +0 -1
  388. package/esm/types/http.js +0 -3
  389. package/esm/types/http.js.map +0 -1
  390. package/esm/types/index.js +0 -27
  391. package/esm/types/index.js.map +0 -1
  392. package/esm/util/console.js +0 -53
  393. package/esm/util/console.js.map +0 -1
  394. package/esm/util/index.js +0 -17
  395. package/esm/util/index.js.map +0 -1
  396. package/esm/util/misc.js +0 -33
  397. package/esm/util/misc.js.map +0 -1
  398. package/esm/util/object.js +0 -117
  399. package/esm/util/object.js.map +0 -1
  400. package/esm/util/sharedStorage.js +0 -43
  401. package/esm/util/sharedStorage.js.map +0 -1
  402. package/esm/util/types.js +0 -27
  403. package/esm/util/types.js.map +0 -1
  404. package/esm/util/url.js +0 -64
  405. package/esm/util/url.js.map +0 -1
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ var _AuthenticationFlow = require("./AuthenticationFlow");
4
+
5
+ Object.keys(_AuthenticationFlow).forEach(function (key) {
6
+ if (key === "default" || key === "__esModule") return;
7
+ if (key in exports && exports[key] === _AuthenticationFlow[key]) return;
8
+ Object.defineProperty(exports, key, {
9
+ enumerable: true,
10
+ get: function () {
11
+ return _AuthenticationFlow[key];
12
+ }
13
+ });
14
+ });
15
+
16
+ var _AuthenticationFlowMonitor = require("./AuthenticationFlowMonitor");
17
+
18
+ Object.keys(_AuthenticationFlowMonitor).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _AuthenticationFlowMonitor[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _AuthenticationFlowMonitor[key];
25
+ }
26
+ });
27
+ });
28
+
29
+ var _FlowMonitor = require("./FlowMonitor");
30
+
31
+ Object.keys(_FlowMonitor).forEach(function (key) {
32
+ if (key === "default" || key === "__esModule") return;
33
+ if (key in exports && exports[key] === _FlowMonitor[key]) return;
34
+ Object.defineProperty(exports, key, {
35
+ enumerable: true,
36
+ get: function () {
37
+ return _FlowMonitor[key];
38
+ }
39
+ });
40
+ });
41
+
42
+ var _FlowSpecification = require("./FlowSpecification");
43
+
44
+ Object.keys(_FlowSpecification).forEach(function (key) {
45
+ if (key === "default" || key === "__esModule") return;
46
+ if (key in exports && exports[key] === _FlowSpecification[key]) return;
47
+ Object.defineProperty(exports, key, {
48
+ enumerable: true,
49
+ get: function () {
50
+ return _FlowSpecification[key];
51
+ }
52
+ });
53
+ });
54
+
55
+ var _PasswordRecoveryFlow = require("./PasswordRecoveryFlow");
56
+
57
+ Object.keys(_PasswordRecoveryFlow).forEach(function (key) {
58
+ if (key === "default" || key === "__esModule") return;
59
+ if (key in exports && exports[key] === _PasswordRecoveryFlow[key]) return;
60
+ Object.defineProperty(exports, key, {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _PasswordRecoveryFlow[key];
64
+ }
65
+ });
66
+ });
67
+
68
+ var _PasswordRecoveryFlowMonitor = require("./PasswordRecoveryFlowMonitor");
69
+
70
+ Object.keys(_PasswordRecoveryFlowMonitor).forEach(function (key) {
71
+ if (key === "default" || key === "__esModule") return;
72
+ if (key in exports && exports[key] === _PasswordRecoveryFlowMonitor[key]) return;
73
+ Object.defineProperty(exports, key, {
74
+ enumerable: true,
75
+ get: function () {
76
+ return _PasswordRecoveryFlowMonitor[key];
77
+ }
78
+ });
79
+ });
80
+
81
+ var _RegistrationFlow = require("./RegistrationFlow");
82
+
83
+ Object.keys(_RegistrationFlow).forEach(function (key) {
84
+ if (key === "default" || key === "__esModule") return;
85
+ if (key in exports && exports[key] === _RegistrationFlow[key]) return;
86
+ Object.defineProperty(exports, key, {
87
+ enumerable: true,
88
+ get: function () {
89
+ return _RegistrationFlow[key];
90
+ }
91
+ });
92
+ });
93
+
94
+ var _RegistrationFlowMonitor = require("./RegistrationFlowMonitor");
95
+
96
+ Object.keys(_RegistrationFlowMonitor).forEach(function (key) {
97
+ if (key === "default" || key === "__esModule") return;
98
+ if (key in exports && exports[key] === _RegistrationFlowMonitor[key]) return;
99
+ Object.defineProperty(exports, key, {
100
+ enumerable: true,
101
+ get: function () {
102
+ return _RegistrationFlowMonitor[key];
103
+ }
104
+ });
105
+ });
106
+
107
+ var _RemediationFlow = require("./RemediationFlow");
108
+
109
+ Object.keys(_RemediationFlow).forEach(function (key) {
110
+ if (key === "default" || key === "__esModule") return;
111
+ if (key in exports && exports[key] === _RemediationFlow[key]) return;
112
+ Object.defineProperty(exports, key, {
113
+ enumerable: true,
114
+ get: function () {
115
+ return _RemediationFlow[key];
116
+ }
117
+ });
118
+ });
119
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../lib/idx/flow/index.ts"],"names":[],"mappings":";;AAYA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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\nexport * from './AuthenticationFlow';\nexport * from './AuthenticationFlowMonitor';\nexport * from './FlowMonitor';\nexport * from './FlowSpecification';\nexport * from './PasswordRecoveryFlow';\nexport * from './PasswordRecoveryFlowMonitor';\nexport * from './RegistrationFlow';\nexport * from './RegistrationFlowMonitor';\nexport * from './RemediationFlow';\n"],"file":"index.js"}
package/cjs/idx/index.js CHANGED
@@ -52,6 +52,19 @@ Object.keys(_introspect).forEach(function (key) {
52
52
  });
53
53
  });
54
54
 
55
+ var _proceed = require("./proceed");
56
+
57
+ Object.keys(_proceed).forEach(function (key) {
58
+ if (key === "default" || key === "__esModule") return;
59
+ if (key in exports && exports[key] === _proceed[key]) return;
60
+ Object.defineProperty(exports, key, {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _proceed[key];
64
+ }
65
+ });
66
+ });
67
+
55
68
  var _register = require("./register");
56
69
 
57
70
  Object.keys(_register).forEach(function (key) {
@@ -103,4 +116,17 @@ Object.keys(_startTransaction).forEach(function (key) {
103
116
  }
104
117
  });
105
118
  });
119
+
120
+ var _transactionMeta = require("./transactionMeta");
121
+
122
+ Object.keys(_transactionMeta).forEach(function (key) {
123
+ if (key === "default" || key === "__esModule") return;
124
+ if (key in exports && exports[key] === _transactionMeta[key]) return;
125
+ Object.defineProperty(exports, key, {
126
+ enumerable: true,
127
+ get: function () {
128
+ return _transactionMeta[key];
129
+ }
130
+ });
131
+ });
106
132
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/index.ts"],"names":[],"mappings":";;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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\nexport * from './authenticate';\nexport * from './cancel';\nexport * from './interact';\nexport * from './introspect';\nexport * from './register';\nexport * from './recoverPassword';\nexport * from './handleInteractionCodeRedirect';\nexport * from './startTransaction';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../lib/idx/index.ts"],"names":[],"mappings":";;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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\nexport * from './authenticate';\nexport * from './cancel';\nexport * from './interact';\nexport * from './introspect';\nexport * from './proceed';\nexport * from './register';\nexport * from './recoverPassword';\nexport * from './handleInteractionCodeRedirect';\nexport * from './startTransaction';\nexport * from './transactionMeta';\n"],"file":"index.js"}
@@ -31,7 +31,10 @@ function getResponse(meta) {
31
31
 
32
32
 
33
33
  async function interact(authClient, options = {}) {
34
- const meta = await (0, _transactionMeta.getTransactionMeta)(authClient); // Saved transaction, return meta
34
+ let state = options.state || authClient.options.state;
35
+ const meta = await (0, _transactionMeta.getTransactionMeta)(authClient, {
36
+ state
37
+ }); // Saved transaction, return meta
35
38
 
36
39
  if (meta.interactionHandle) {
37
40
  return getResponse(meta);
@@ -48,7 +51,7 @@ async function interact(authClient, options = {}) {
48
51
  redirectUri
49
52
  } = authClient.options; // These properties can be set in options, but also have a default value in global configuration.
50
53
 
51
- const state = options.state || authClient.options.state || meta.state;
54
+ state = state || meta.state;
52
55
  const scopes = options.scopes || authClient.options.scopes || meta.scopes;
53
56
  const baseUrl = (0, _oidc.getOAuthBaseUrl)(authClient);
54
57
  return _oktaIdxJs.default.interact({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/interact.ts"],"names":["getResponse","meta","interactionHandle","state","interact","authClient","options","codeChallenge","codeChallengeMethod","clientId","redirectUri","scopes","baseUrl","idx","then","newMeta"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA,SAASA,WAAT,CAAqBC,IAArB,EAAiE;AAC/D,SAAO;AACLA,IAAAA,IADK;AAELC,IAAAA,iBAAiB,EAAED,IAAI,CAACC,iBAFnB;AAGLC,IAAAA,KAAK,EAAEF,IAAI,CAACE;AAHP,GAAP;AAKD,C,CAED;;;AACO,eAAeC,QAAf,CAAyBC,UAAzB,EAA+CC,OAAwB,GAAG,EAA1E,EAAyG;AAC9G,QAAML,IAAI,GAAG,MAAM,yCAAmBI,UAAnB,CAAnB,CAD8G,CAG9G;;AACA,MAAIJ,IAAI,CAACC,iBAAT,EAA4B;AAC1B,WAAOF,WAAW,CAACC,IAAD,CAAlB;AACD,GAN6G,CAQ9G;;;AACA,QAAM;AAAEM,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAyCP,IAA/C,CAT8G,CAW9G;;AACA,QAAM;AAAEQ,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA4BL,UAAU,CAACC,OAA7C,CAZ8G,CAc9G;;AACA,QAAMH,KAAK,GAAGG,OAAO,CAACH,KAAR,IAAiBE,UAAU,CAACC,OAAX,CAAmBH,KAApC,IAA6CF,IAAI,CAACE,KAAhE;AACA,QAAMQ,MAAM,GAAGL,OAAO,CAACK,MAAR,IAAkBN,UAAU,CAACC,OAAX,CAAmBK,MAArC,IAA+CV,IAAI,CAACU,MAAnE;AAEA,QAAMC,OAAO,GAAG,2BAAgBP,UAAhB,CAAhB;AACA,SAAOQ,mBAAIT,QAAJ,CAAa;AAClB;AACAK,IAAAA,QAFkB;AAGlBG,IAAAA,OAHkB;AAIlBD,IAAAA,MAJkB;AAKlBR,IAAAA,KALkB;AAMlBO,IAAAA,WANkB;AAQlB;AACAH,IAAAA,aATkB;AAUlBC,IAAAA;AAVkB,GAAb,EAWJM,IAXI,CAWCZ,iBAAiB,IAAI;AAC3B,UAAMa,OAAO,GAAG,EAAE,GAAGd,IAAL;AAAWC,MAAAA,iBAAX;AAA8BC,MAAAA,KAA9B;AAAqCQ,MAAAA;AAArC,KAAhB,CAD2B,CAE3B;;AACA,8CAAoBN,UAApB,EAAgCU,OAAhC;AAEA,WAAOf,WAAW,CAACe,OAAD,CAAlB;AACD,GAjBM,CAAP;AAkBD","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 idx from '@okta/okta-idx-js';\nimport { OktaAuth, IdxTransactionMeta } from '../types';\nimport { getTransactionMeta, saveTransactionMeta } from './transactionMeta';\nimport { getOAuthBaseUrl } from '../oidc';\n\nexport interface InteractOptions {\n state?: string;\n scopes?: string[];\n}\n\nexport interface InteractResponse {\n state?: string;\n interactionHandle: string;\n meta: IdxTransactionMeta;\n}\n\nfunction getResponse(meta: IdxTransactionMeta): InteractResponse {\n return {\n meta,\n interactionHandle: meta.interactionHandle,\n state: meta.state\n };\n}\n\n// Begin or resume a transaction. Returns an interaction handle\nexport async function interact (authClient: OktaAuth, options: InteractOptions = {}): Promise<InteractResponse> {\n const meta = await getTransactionMeta(authClient);\n\n // Saved transaction, return meta\n if (meta.interactionHandle) {\n return getResponse(meta);\n }\n\n // These properties are always loaded from meta (or calculated fresh)\n const { codeChallenge, codeChallengeMethod } = meta;\n\n // These properties are defined by global configuration\n const { clientId, redirectUri } = authClient.options;\n\n // These properties can be set in options, but also have a default value in global configuration.\n const state = options.state || authClient.options.state || meta.state;\n const scopes = options.scopes || authClient.options.scopes || meta.scopes;\n\n const baseUrl = getOAuthBaseUrl(authClient);\n return idx.interact({\n // OAuth\n clientId, \n baseUrl,\n scopes,\n state,\n redirectUri,\n\n // PKCE\n codeChallenge,\n codeChallengeMethod\n }).then(interactionHandle => {\n const newMeta = { ...meta, interactionHandle, state, scopes };\n // Save transaction meta so it can be resumed\n saveTransactionMeta(authClient, newMeta);\n\n return getResponse(newMeta);\n });\n}\n"],"file":"interact.js"}
1
+ {"version":3,"sources":["../../../lib/idx/interact.ts"],"names":["getResponse","meta","interactionHandle","state","interact","authClient","options","codeChallenge","codeChallengeMethod","clientId","redirectUri","scopes","baseUrl","idx","then","newMeta"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA,SAASA,WAAT,CAAqBC,IAArB,EAAiE;AAC/D,SAAO;AACLA,IAAAA,IADK;AAELC,IAAAA,iBAAiB,EAAED,IAAI,CAACC,iBAFnB;AAGLC,IAAAA,KAAK,EAAEF,IAAI,CAACE;AAHP,GAAP;AAKD,C,CAED;;;AACO,eAAeC,QAAf,CAAyBC,UAAzB,EAA+CC,OAAwB,GAAG,EAA1E,EAAyG;AAC9G,MAAIH,KAAK,GAAGG,OAAO,CAACH,KAAR,IAAiBE,UAAU,CAACC,OAAX,CAAmBH,KAAhD;AACA,QAAMF,IAAI,GAAG,MAAM,yCAAmBI,UAAnB,EAA+B;AAAEF,IAAAA;AAAF,GAA/B,CAAnB,CAF8G,CAI9G;;AACA,MAAIF,IAAI,CAACC,iBAAT,EAA4B;AAC1B,WAAOF,WAAW,CAACC,IAAD,CAAlB;AACD,GAP6G,CAS9G;;;AACA,QAAM;AAAEM,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAyCP,IAA/C,CAV8G,CAY9G;;AACA,QAAM;AAAEQ,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA4BL,UAAU,CAACC,OAA7C,CAb8G,CAe9G;;AACAH,EAAAA,KAAK,GAAGA,KAAK,IAAIF,IAAI,CAACE,KAAtB;AACA,QAAMQ,MAAM,GAAGL,OAAO,CAACK,MAAR,IAAkBN,UAAU,CAACC,OAAX,CAAmBK,MAArC,IAA+CV,IAAI,CAACU,MAAnE;AAEA,QAAMC,OAAO,GAAG,2BAAgBP,UAAhB,CAAhB;AACA,SAAOQ,mBAAIT,QAAJ,CAAa;AAClB;AACAK,IAAAA,QAFkB;AAGlBG,IAAAA,OAHkB;AAIlBD,IAAAA,MAJkB;AAKlBR,IAAAA,KALkB;AAMlBO,IAAAA,WANkB;AAQlB;AACAH,IAAAA,aATkB;AAUlBC,IAAAA;AAVkB,GAAb,EAWJM,IAXI,CAWCZ,iBAAiB,IAAI;AAC3B,UAAMa,OAAO,GAAG,EACd,GAAGd,IADW;AAEdC,MAAAA,iBAFc;AAGdC,MAAAA,KAHc;AAIdQ,MAAAA;AAJc,KAAhB,CAD2B,CAO3B;;AACA,8CAAoBN,UAApB,EAAgCU,OAAhC;AAEA,WAAOf,WAAW,CAACe,OAAD,CAAlB;AACD,GAtBM,CAAP;AAuBD","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 idx from '@okta/okta-idx-js';\nimport { OktaAuth, IdxTransactionMeta } from '../types';\nimport { getTransactionMeta, saveTransactionMeta } from './transactionMeta';\nimport { getOAuthBaseUrl } from '../oidc';\n\nexport interface InteractOptions {\n state?: string;\n scopes?: string[];\n}\n\nexport interface InteractResponse {\n state?: string;\n interactionHandle: string;\n meta: IdxTransactionMeta;\n}\n\nfunction getResponse(meta: IdxTransactionMeta): InteractResponse {\n return {\n meta,\n interactionHandle: meta.interactionHandle,\n state: meta.state\n };\n}\n\n// Begin or resume a transaction. Returns an interaction handle\nexport async function interact (authClient: OktaAuth, options: InteractOptions = {}): Promise<InteractResponse> {\n let state = options.state || authClient.options.state;\n const meta = await getTransactionMeta(authClient, { state });\n\n // Saved transaction, return meta\n if (meta.interactionHandle) {\n return getResponse(meta);\n }\n\n // These properties are always loaded from meta (or calculated fresh)\n const { codeChallenge, codeChallengeMethod } = meta;\n\n // These properties are defined by global configuration\n const { clientId, redirectUri } = authClient.options;\n\n // These properties can be set in options, but also have a default value in global configuration.\n state = state || meta.state;\n const scopes = options.scopes || authClient.options.scopes || meta.scopes;\n\n const baseUrl = getOAuthBaseUrl(authClient);\n return idx.interact({\n // OAuth\n clientId, \n baseUrl,\n scopes,\n state,\n redirectUri,\n\n // PKCE\n codeChallenge,\n codeChallengeMethod\n }).then(interactionHandle => {\n const newMeta = {\n ...meta,\n interactionHandle,\n state,\n scopes\n };\n // Save transaction meta so it can be resumed\n saveTransactionMeta(authClient, newMeta);\n\n return getResponse(newMeta);\n });\n}\n"],"file":"interact.js"}
@@ -6,6 +6,8 @@ exports.introspect = introspect;
6
6
 
7
7
  var _oktaIdxJs = _interopRequireDefault(require("@okta/okta-idx-js"));
8
8
 
9
+ var _idxJs = require("./types/idx-js");
10
+
9
11
  var _oidc = require("../oidc");
10
12
 
11
13
  var _constants = require("../constants");
@@ -22,18 +24,33 @@ var _constants = require("../constants");
22
24
  * See the License for the specific language governing permissions and limitations under the License.
23
25
  */
24
26
  async function introspect(authClient, options) {
25
- let rawIdxResponse; // try load from storage first
27
+ const useLastResponse = !options.stateTokenExternalId; // email verify callback: must make a new response
28
+
29
+ let rawIdxResponse;
30
+
31
+ if (useLastResponse) {
32
+ // try load from storage first
33
+ rawIdxResponse = authClient.transactionManager.loadIdxResponse();
34
+ } // call idx.introspect if no existing idx response available in storage
26
35
 
27
- rawIdxResponse = authClient.transactionManager.loadIdxResponse(); // call idx.introspect if no existing idx response available in storage
28
36
 
29
37
  if (!rawIdxResponse) {
30
38
  const version = _constants.IDX_API_VERSION;
31
39
  const domain = (0, _oidc.getOAuthDomain)(authClient);
32
- rawIdxResponse = await _oktaIdxJs.default.introspect({
33
- domain,
34
- version,
35
- ...options
36
- });
40
+
41
+ try {
42
+ rawIdxResponse = await _oktaIdxJs.default.introspect({
43
+ domain,
44
+ version,
45
+ ...options
46
+ });
47
+ } catch (err) {
48
+ if ((0, _idxJs.isRawIdxResponse)(err)) {
49
+ rawIdxResponse = err;
50
+ } else {
51
+ throw err;
52
+ }
53
+ }
37
54
  }
38
55
 
39
56
  return _oktaIdxJs.default.makeIdxState(rawIdxResponse);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/introspect.ts"],"names":["introspect","authClient","options","rawIdxResponse","transactionManager","loadIdxResponse","version","IDX_API_VERSION","domain","idx","makeIdxState"],"mappings":";;;;;;AAYA;;AAGA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaO,eAAeA,UAAf,CAA2BC,UAA3B,EAAiDC,OAAjD,EAAmG;AACxG,MAAIC,cAAJ,CADwG,CAGxG;;AACAA,EAAAA,cAAc,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,eAA9B,EAAjB,CAJwG,CAMxG;;AACA,MAAI,CAACF,cAAL,EAAqB;AACnB,UAAMG,OAAO,GAAGC,0BAAhB;AACA,UAAMC,MAAM,GAAG,0BAAeP,UAAf,CAAf;AACAE,IAAAA,cAAc,GAAG,MAAMM,mBAAIT,UAAJ,CAAe;AAAEQ,MAAAA,MAAF;AAAUF,MAAAA,OAAV;AAAmB,SAAGJ;AAAtB,KAAf,CAAvB;AACD;;AAED,SAAOO,mBAAIC,YAAJ,CAAiBP,cAAjB,CAAP;AACD","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 idx from '@okta/okta-idx-js';\nimport { OktaAuth } from '../types';\nimport { IdxResponse, RawIdxResponse } from './types/idx-js';\nimport { getOAuthDomain } from '../oidc';\nimport { IDX_API_VERSION } from '../constants';\n\nexport interface IntrospectOptions {\n interactionHandle: string;\n stateHandle?: string;\n}\n\nexport async function introspect (authClient: OktaAuth, options: IntrospectOptions): Promise<IdxResponse> {\n let rawIdxResponse: RawIdxResponse;\n \n // try load from storage first\n rawIdxResponse = authClient.transactionManager.loadIdxResponse();\n \n // call idx.introspect if no existing idx response available in storage\n if (!rawIdxResponse) {\n const version = IDX_API_VERSION;\n const domain = getOAuthDomain(authClient);\n rawIdxResponse = await idx.introspect({ domain, version, ...options });\n }\n\n return idx.makeIdxState(rawIdxResponse);\n}\n"],"file":"introspect.js"}
1
+ {"version":3,"sources":["../../../lib/idx/introspect.ts"],"names":["introspect","authClient","options","useLastResponse","stateTokenExternalId","rawIdxResponse","transactionManager","loadIdxResponse","version","IDX_API_VERSION","domain","idx","err","makeIdxState"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcO,eAAeA,UAAf,CAA2BC,UAA3B,EAAiDC,OAAjD,EAAmG;AACxG,QAAMC,eAAe,GAAG,CAACD,OAAO,CAACE,oBAAjC,CADwG,CACjD;;AACvD,MAAIC,cAAJ;;AAEA,MAAIF,eAAJ,EAAqB;AACnB;AACAE,IAAAA,cAAc,GAAGJ,UAAU,CAACK,kBAAX,CAA8BC,eAA9B,EAAjB;AACD,GAPuG,CASxG;;;AACA,MAAI,CAACF,cAAL,EAAqB;AACnB,UAAMG,OAAO,GAAGC,0BAAhB;AACA,UAAMC,MAAM,GAAG,0BAAeT,UAAf,CAAf;;AACA,QAAI;AACFI,MAAAA,cAAc,GAAG,MAAMM,mBAAIX,UAAJ,CAAe;AAAEU,QAAAA,MAAF;AAAUF,QAAAA,OAAV;AAAmB,WAAGN;AAAtB,OAAf,CAAvB;AACD,KAFD,CAEE,OAAOU,GAAP,EAAY;AACZ,UAAI,6BAAiBA,GAAjB,CAAJ,EAA2B;AACzBP,QAAAA,cAAc,GAAGO,GAAjB;AACD,OAFD,MAEO;AACL,cAAMA,GAAN;AACD;AACF;AACF;;AAED,SAAOD,mBAAIE,YAAJ,CAAiBR,cAAjB,CAAP;AACD","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 idx from '@okta/okta-idx-js';\nimport { OktaAuth } from '../types';\nimport { IdxResponse, isRawIdxResponse, RawIdxResponse } from './types/idx-js';\nimport { getOAuthDomain } from '../oidc';\nimport { IDX_API_VERSION } from '../constants';\n\nexport interface IntrospectOptions {\n interactionHandle?: string;\n stateHandle?: string;\n stateTokenExternalId?: string;\n}\n\nexport async function introspect (authClient: OktaAuth, options: IntrospectOptions): Promise<IdxResponse> {\n const useLastResponse = !options.stateTokenExternalId; // email verify callback: must make a new response\n let rawIdxResponse: RawIdxResponse;\n \n if (useLastResponse) {\n // try load from storage first\n rawIdxResponse = authClient.transactionManager.loadIdxResponse();\n }\n \n // call idx.introspect if no existing idx response available in storage\n if (!rawIdxResponse) {\n const version = IDX_API_VERSION;\n const domain = getOAuthDomain(authClient);\n try {\n rawIdxResponse = await idx.introspect({ domain, version, ...options });\n } catch (err) {\n if (isRawIdxResponse(err)) {\n rawIdxResponse = err;\n } else {\n throw err;\n }\n }\n }\n\n return idx.makeIdxState(rawIdxResponse);\n}\n"],"file":"introspect.js"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ exports.canProceed = canProceed;
4
+ exports.proceed = proceed;
5
+
6
+ var _run = require("./run");
7
+
8
+ var _transactionMeta = require("./transactionMeta");
9
+
10
+ var _flow = require("./flow");
11
+
12
+ var _errors = require("../errors");
13
+
14
+ /*!
15
+ * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
16
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
17
+ *
18
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
21
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ *
23
+ * See the License for the specific language governing permissions and limitations under the License.
24
+ */
25
+ function canProceed(authClient, options) {
26
+ const meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient, options);
27
+ return !!meta;
28
+ }
29
+
30
+ async function proceed(authClient, options = {}) {
31
+ const {
32
+ stateTokenExternalId,
33
+ state
34
+ } = options;
35
+ const meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient, {
36
+ state
37
+ }); // Proceed always needs saved transaction meta, except in the case of email verify callback
38
+
39
+ if (!meta && !stateTokenExternalId) {
40
+ throw new _errors.AuthSdkError('Unable to proceed: saved transaction could not be loaded');
41
+ } // Determine the flow specification based on the saved flow
42
+
43
+
44
+ const flowSpec = (0, _flow.getFlowSpecification)(authClient, meta === null || meta === void 0 ? void 0 : meta.flow);
45
+ return (0, _run.run)(authClient, { ...options,
46
+ ...flowSpec
47
+ });
48
+ }
49
+ //# sourceMappingURL=proceed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/idx/proceed.ts"],"names":["canProceed","authClient","options","meta","proceed","stateTokenExternalId","state","AuthSdkError","flowSpec","flow"],"mappings":";;;;;AAiBA;;AAIA;;AACA;;AACA;;AAvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAmBO,SAASA,UAAT,CAAoBC,UAApB,EAA0CC,OAA1C,EAAwE;AAC7E,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoCC,OAApC,CAAb;AACA,SAAO,CAAC,CAACC,IAAT;AACD;;AAEM,eAAeC,OAAf,CACLH,UADK,EAELC,OAAuB,GAAG,EAFrB,EAGoB;AACzB,QAAM;AAAEG,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MAAkCJ,OAAxC;AACA,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoC;AAAEK,IAAAA;AAAF,GAApC,CAAb,CAFyB,CAIzB;;AACA,MAAI,CAACH,IAAD,IAAS,CAACE,oBAAd,EAAoC;AAClC,UAAM,IAAIE,oBAAJ,CAAiB,0DAAjB,CAAN;AACD,GAPwB,CASzB;;;AACA,QAAMC,QAAQ,GAAG,gCAAqBP,UAArB,EAAiCE,IAAjC,aAAiCA,IAAjC,uBAAiCA,IAAI,CAAEM,IAAvC,CAAjB;AAEA,SAAO,cAAIR,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErB,OAAGM;AAFkB,GAAhB,CAAP;AAID","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 IdxTransaction,\n} from '../types';\nimport { run } from './run';\nimport { AuthenticationOptions } from './authenticate';\nimport { RegistrationOptions } from './register';\nimport { PasswordRecoveryOptions } from './recoverPassword';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { getFlowSpecification } from './flow';\nimport { AuthSdkError } from '../errors';\n\nexport type ProceedOptions = AuthenticationOptions\n & RegistrationOptions\n & PasswordRecoveryOptions;\n\nexport function canProceed(authClient: OktaAuth, options?: { state?: string }) {\n const meta = getSavedTransactionMeta(authClient, options);\n return !!meta;\n}\n\nexport async function proceed(\n authClient: OktaAuth,\n options: ProceedOptions = {}\n): Promise<IdxTransaction> {\n const { stateTokenExternalId, state } = options;\n const meta = getSavedTransactionMeta(authClient, { state });\n\n // Proceed always needs saved transaction meta, except in the case of email verify callback\n if (!meta && !stateTokenExternalId) {\n throw new AuthSdkError('Unable to proceed: saved transaction could not be loaded');\n }\n\n // Determine the flow specification based on the saved flow\n const flowSpec = getFlowSpecification(authClient, meta?.flow);\n\n return run(authClient, { \n ...options, \n ...flowSpec\n });\n}\n"],"file":"proceed.js"}
@@ -4,9 +4,7 @@ exports.recoverPassword = recoverPassword;
4
4
 
5
5
  var _run = require("./run");
6
6
 
7
- var _remediators = require("./remediators");
8
-
9
- var _flowMonitors = require("./flowMonitors");
7
+ var _flow = require("./flow");
10
8
 
11
9
  /*!
12
10
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
@@ -19,22 +17,10 @@ var _flowMonitors = require("./flowMonitors");
19
17
  *
20
18
  * See the License for the specific language governing permissions and limitations under the License.
21
19
  */
22
- const flow = {
23
- 'identify': _remediators.Identify,
24
- 'identify-recovery': _remediators.Identify,
25
- 'select-authenticator-authenticate': _remediators.SelectAuthenticatorAuthenticate,
26
- 'challenge-authenticator': _remediators.ChallengeAuthenticator,
27
- 'authenticator-verification-data': _remediators.AuthenticatorVerificationData,
28
- 'reset-authenticator': _remediators.ResetAuthenticator,
29
- 'reenroll-authenticator': _remediators.ReEnrollAuthenticator
30
- };
31
-
32
20
  async function recoverPassword(authClient, options) {
33
- const flowMonitor = new _flowMonitors.PasswordRecoveryFlowMonitor(authClient);
21
+ const flowSpec = (0, _flow.getFlowSpecification)(authClient, 'recoverPassword');
34
22
  return (0, _run.run)(authClient, { ...options,
35
- flow,
36
- flowMonitor,
37
- actions: ['currentAuthenticator-recover', 'currentAuthenticatorEnrollment-recover']
23
+ ...flowSpec
38
24
  });
39
25
  }
40
26
  //# sourceMappingURL=recoverPassword.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/recoverPassword.ts"],"names":["flow","Identify","SelectAuthenticatorAuthenticate","ChallengeAuthenticator","AuthenticatorVerificationData","ResetAuthenticator","ReEnrollAuthenticator","recoverPassword","authClient","options","flowMonitor","PasswordRecoveryFlowMonitor","actions"],"mappings":";;;;AAaA;;AACA;;AAcA;;AA5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyBA,MAAMA,IAAqB,GAAG;AAC5B,cAAYC,qBADgB;AAE5B,uBAAqBA,qBAFO;AAG5B,uCAAqCC,4CAHT;AAI5B,6BAA2BC,mCAJC;AAK5B,qCAAmCC,0CALP;AAM5B,yBAAuBC,+BANK;AAO5B,4BAA0BC;AAPE,CAA9B;;AAkBO,eAAeC,eAAf,CACLC,UADK,EACiBC,OADjB,EAEoB;AACzB,QAAMC,WAAW,GAAG,IAAIC,yCAAJ,CAAgCH,UAAhC,CAApB;AACA,SAAO,cACLA,UADK,EAEL,EACE,GAAGC,OADL;AAEET,IAAAA,IAFF;AAGEU,IAAAA,WAHF;AAIEE,IAAAA,OAAO,EAAE,CACP,8BADO,EAEP,wCAFO;AAJX,GAFK,CAAP;AAYD","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 {\n Identify,\n IdentifyValues,\n SelectAuthenticatorAuthenticate,\n SelectAuthenticatorAuthenticateValues,\n ChallengeAuthenticator,\n ChallengeAuthenticatorValues,\n AuthenticatorVerificationData,\n AuthenticatorVerificationDataValues,\n ResetAuthenticator,\n ResetAuthenticatorValues,\n ReEnrollAuthenticator,\n ReEnrollAuthenticatorValues,\n} from './remediators';\nimport { PasswordRecoveryFlowMonitor } from './flowMonitors';\nimport { \n OktaAuth, \n IdxOptions, \n IdxTransaction,\n} from '../types';\n\nconst flow: RemediationFlow = {\n 'identify': Identify,\n 'identify-recovery': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'reset-authenticator': ResetAuthenticator,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n};\n\nexport type PasswordRecoveryOptions = IdxOptions \n & IdentifyValues \n & SelectAuthenticatorAuthenticateValues \n & ChallengeAuthenticatorValues \n & ResetAuthenticatorValues\n & AuthenticatorVerificationDataValues\n & ReEnrollAuthenticatorValues;\n\nexport async function recoverPassword(\n authClient: OktaAuth, options: PasswordRecoveryOptions\n): Promise<IdxTransaction> {\n const flowMonitor = new PasswordRecoveryFlowMonitor(authClient);\n return run(\n authClient, \n { \n ...options,\n flow,\n flowMonitor,\n actions: [\n 'currentAuthenticator-recover', \n 'currentAuthenticatorEnrollment-recover'\n ],\n }\n );\n}\n"],"file":"recoverPassword.js"}
1
+ {"version":3,"sources":["../../../lib/idx/recoverPassword.ts"],"names":["recoverPassword","authClient","options","flowSpec"],"mappings":";;;;AAaA;;AASA;;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA2BO,eAAeA,eAAf,CACLC,UADK,EACiBC,OADjB,EAEoB;AACzB,QAAMC,QAAQ,GAAG,gCAAqBF,UAArB,EAAiC,iBAAjC,CAAjB;AACA,SAAO,cACLA,UADK,EAEL,EACE,GAAGC,OADL;AAEE,OAAGC;AAFL,GAFK,CAAP;AAOD","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 } from './run';\nimport {\n IdentifyValues,\n SelectAuthenticatorAuthenticateValues,\n ChallengeAuthenticatorValues,\n AuthenticatorVerificationDataValues,\n ResetAuthenticatorValues,\n ReEnrollAuthenticatorValues,\n} from './remediators';\nimport { getFlowSpecification } from './flow';\nimport { \n OktaAuth, \n IdxOptions, \n IdxTransaction,\n} from '../types';\n\nexport type PasswordRecoveryOptions = IdxOptions \n & IdentifyValues \n & SelectAuthenticatorAuthenticateValues \n & ChallengeAuthenticatorValues \n & ResetAuthenticatorValues\n & AuthenticatorVerificationDataValues\n & ReEnrollAuthenticatorValues;\n\nexport async function recoverPassword(\n authClient: OktaAuth, options: PasswordRecoveryOptions\n): Promise<IdxTransaction> {\n const flowSpec = getFlowSpecification(authClient, 'recoverPassword');\n return run(\n authClient, \n { \n ...options,\n ...flowSpec,\n }\n );\n}\n"],"file":"recoverPassword.js"}
@@ -8,9 +8,7 @@ var _transactionMeta = require("./transactionMeta");
8
8
 
9
9
  var _startTransaction = require("./startTransaction");
10
10
 
11
- var _remediators = require("./remediators");
12
-
13
- var _flowMonitors = require("./flowMonitors");
11
+ var _flow = require("./flow");
14
12
 
15
13
  var _errors = require("../errors");
16
14
 
@@ -27,21 +25,15 @@ var _types = require("../types");
27
25
  *
28
26
  * See the License for the specific language governing permissions and limitations under the License.
29
27
  */
30
- const flow = {
31
- 'select-enroll-profile': _remediators.SelectEnrollProfile,
32
- 'enroll-profile': _remediators.EnrollProfile,
33
- 'authenticator-enrollment-data': _remediators.AuthenticatorEnrollmentData,
34
- 'select-authenticator-enroll': _remediators.SelectAuthenticatorEnroll,
35
- 'enroll-authenticator': _remediators.EnrollAuthenticator,
36
- 'skip': _remediators.Skip
37
- };
38
-
39
28
  async function register(authClient, options) {
40
29
  // Only check at the beginning of the transaction
41
30
  if (!(0, _transactionMeta.transactionMetaExist)(authClient)) {
42
31
  const {
43
32
  enabledFeatures
44
- } = await (0, _startTransaction.startTransaction)(authClient, options);
33
+ } = await (0, _startTransaction.startTransaction)(authClient, {
34
+ flow: 'register',
35
+ ...options
36
+ });
45
37
 
46
38
  if (enabledFeatures && !enabledFeatures.includes(_types.IdxFeature.REGISTRATION)) {
47
39
  const error = new _errors.AuthSdkError('Registration is not supported based on your current org configuration.');
@@ -52,10 +44,9 @@ async function register(authClient, options) {
52
44
  }
53
45
  }
54
46
 
55
- const flowMonitor = new _flowMonitors.RegistrationFlowMonitor(authClient);
47
+ const flowSpec = (0, _flow.getFlowSpecification)(authClient, 'register');
56
48
  return (0, _run.run)(authClient, { ...options,
57
- flow,
58
- flowMonitor
49
+ ...flowSpec
59
50
  });
60
51
  }
61
52
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/register.ts"],"names":["flow","SelectEnrollProfile","EnrollProfile","AuthenticatorEnrollmentData","SelectAuthenticatorEnroll","EnrollAuthenticator","Skip","register","authClient","options","enabledFeatures","includes","IdxFeature","REGISTRATION","error","AuthSdkError","status","IdxStatus","FAILURE","flowMonitor","RegistrationFlowMonitor"],"mappings":";;;;AAaA;;AACA;;AACA;;AACA;;AAaA;;AACA;;AACA;;AA/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA6BA,MAAMA,IAAqB,GAAG;AAC5B,2BAAyBC,gCADG;AAE5B,oBAAkBC,0BAFU;AAG5B,mCAAiCC,wCAHL;AAI5B,iCAA+BC,sCAJH;AAK5B,0BAAwBC,gCALI;AAM5B,UAAQC;AANoB,CAA9B;;AAgBO,eAAeC,QAAf,CACLC,UADK,EACiBC,OADjB,EAEoB;AACzB;AACA,MAAI,CAAC,2CAAqBD,UAArB,CAAL,EAAuC;AACrC,UAAM;AAAEE,MAAAA;AAAF,QAAsB,MAAM,wCAAiBF,UAAjB,EAA6BC,OAA7B,CAAlC;;AACA,QAAIC,eAAe,IAAI,CAACA,eAAe,CAACC,QAAhB,CAAyBC,kBAAWC,YAApC,CAAxB,EAA2E;AACzE,YAAMC,KAAK,GAAG,IAAIC,oBAAJ,CAAiB,wEAAjB,CAAd;AACA,aAAO;AAAEC,QAAAA,MAAM,EAAEC,iBAAUC,OAApB;AAA6BJ,QAAAA;AAA7B,OAAP;AACD;AACF;;AAED,QAAMK,WAAW,GAAG,IAAIC,qCAAJ,CAA4BZ,UAA5B,CAApB;AACA,SAAO,cAAIA,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErBT,IAAAA,IAFqB;AAGrBmB,IAAAA;AAHqB,GAAhB,CAAP;AAKD","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
+ {"version":3,"sources":["../../../lib/idx/register.ts"],"names":["register","authClient","options","enabledFeatures","flow","includes","IdxFeature","REGISTRATION","error","AuthSdkError","status","IdxStatus","FAILURE","flowSpec"],"mappings":";;;;AAaA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA8BO,eAAeA,QAAf,CACLC,UADK,EACiBC,OADjB,EAEoB;AACzB;AACA,MAAI,CAAC,2CAAqBD,UAArB,CAAL,EAAuC;AACrC,UAAM;AAAEE,MAAAA;AAAF,QAAsB,MAAM,wCAAiBF,UAAjB,EAA6B;AAAEG,MAAAA,IAAI,EAAE,UAAR;AAAoB,SAAGF;AAAvB,KAA7B,CAAlC;;AACA,QAAIC,eAAe,IAAI,CAACA,eAAe,CAACE,QAAhB,CAAyBC,kBAAWC,YAApC,CAAxB,EAA2E;AACzE,YAAMC,KAAK,GAAG,IAAIC,oBAAJ,CAAiB,wEAAjB,CAAd;AACA,aAAO;AAAEC,QAAAA,MAAM,EAAEC,iBAAUC,OAApB;AAA6BJ,QAAAA;AAA7B,OAAP;AACD;AACF;;AAED,QAAMK,QAAQ,GAAG,gCAAqBZ,UAArB,EAAiC,UAAjC,CAAjB;AACA,SAAO,cAAIA,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErB,OAAGW;AAFkB,GAAhB,CAAP;AAID","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 } from './run';\nimport { transactionMetaExist } from './transactionMeta';\nimport { startTransaction } from './startTransaction';\nimport { \n EnrollProfileValues,\n SelectAuthenticatorEnrollValues,\n EnrollAuthenticatorValues,\n AuthenticatorEnrollmentDataValues,\n SkipValues,\n} from './remediators';\nimport { getFlowSpecification } from './flow';\nimport { AuthSdkError } from '../errors';\nimport { \n IdxOptions, \n IdxTransaction, \n OktaAuth, \n IdxFeature,\n IdxStatus,\n} from '../types';\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, { flow: 'register', ...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 flowSpec = getFlowSpecification(authClient, 'register');\n return run(authClient, { \n ...options, \n ...flowSpec\n });\n}\n"],"file":"register.js"}
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  exports.getRemediator = getRemediator;
6
4
  exports.remediate = remediate;
7
5
 
8
- var _oktaIdxJs = _interopRequireDefault(require("@okta/okta-idx-js"));
9
-
10
6
  var _errors = require("../errors");
11
7
 
12
8
  var _idxJs = require("./types/idx-js");
@@ -27,20 +23,20 @@ var _idxJs = require("./types/idx-js");
27
23
  // Return first match idxRemediation in allowed remediators
28
24
  function getRemediator(idxRemediations, values, options) {
29
25
  const {
30
- flow,
26
+ remediators,
31
27
  flowMonitor
32
28
  } = options;
33
29
  let remediator;
34
30
  const remediatorCandidates = [];
35
31
 
36
32
  for (let remediation of idxRemediations) {
37
- const isRemeditionInFlow = Object.keys(flow).includes(remediation.name);
33
+ const isRemeditionInFlow = Object.keys(remediators).includes(remediation.name);
38
34
 
39
35
  if (!isRemeditionInFlow) {
40
36
  continue;
41
37
  }
42
38
 
43
- const T = flow[remediation.name];
39
+ const T = remediators[remediation.name];
44
40
  remediator = new T(remediation, values);
45
41
 
46
42
  if (flowMonitor.isRemediatorCandidate(remediator, idxRemediations, values)) {
@@ -87,12 +83,12 @@ function canResendFn(idxResponse) {
87
83
  return Object.keys(idxResponse.actions).some(actionName => actionName.includes('resend'));
88
84
  }
89
85
 
90
- function getIdxMessages(idxResponse, flow) {
86
+ function getIdxMessages(idxResponse, remediators) {
91
87
  var _rawIdxState$messages;
92
88
 
93
89
  let messages = [];
94
90
 
95
- if (!flow) {
91
+ if (!remediators) {
96
92
  return messages;
97
93
  }
98
94
 
@@ -109,7 +105,7 @@ function getIdxMessages(idxResponse, flow) {
109
105
 
110
106
 
111
107
  for (let remediation of neededToProceed) {
112
- const T = flow[remediation.name];
108
+ const T = remediators[remediation.name];
113
109
 
114
110
  if (!T) {
115
111
  continue;
@@ -140,32 +136,32 @@ function getNextStep(remediator, idxResponse) {
140
136
  };
141
137
  }
142
138
 
143
- function handleIdxError(e, flow, remediator) {
139
+ function handleIdxError(e, remediators, remediator) {
144
140
  // Handle idx messages
145
- if ((0, _idxJs.isRawIdxResponse)(e)) {
146
- const idxState = _oktaIdxJs.default.makeIdxState(e);
147
-
148
- const terminal = isTerminalResponse(idxState);
149
- const messages = getIdxMessages(idxState, flow);
141
+ const idxState = (0, _idxJs.isIdxResponse)(e) ? e : null;
150
142
 
151
- if (terminal) {
152
- return {
153
- terminal,
154
- messages
155
- };
156
- } else {
157
- const nextStep = remediator && getNextStep(remediator, idxState);
158
- return {
159
- messages,
160
- ...(nextStep && {
161
- nextStep
162
- })
163
- };
164
- }
165
- } // Thrown error terminates the interaction with idx
143
+ if (!idxState) {
144
+ // Thrown error terminates the interaction with idx
145
+ throw e;
146
+ }
166
147
 
148
+ const terminal = isTerminalResponse(idxState);
149
+ const messages = getIdxMessages(idxState, remediators);
167
150
 
168
- throw e;
151
+ if (terminal) {
152
+ return {
153
+ terminal,
154
+ messages
155
+ };
156
+ } else {
157
+ const nextStep = remediator && getNextStep(remediator, idxState);
158
+ return {
159
+ messages,
160
+ ...(nextStep && {
161
+ nextStep
162
+ })
163
+ };
164
+ }
169
165
  }
170
166
 
171
167
  function getActionFromValues(values, idxResponse) {
@@ -186,7 +182,7 @@ async function remediate(idxResponse, values, options) {
186
182
  interactionCode
187
183
  } = idxResponse;
188
184
  const {
189
- flow,
185
+ remediators,
190
186
  flowMonitor
191
187
  } = options; // If the response contains an interaction code, there is no need to remediate
192
188
 
@@ -198,7 +194,7 @@ async function remediate(idxResponse, values, options) {
198
194
 
199
195
 
200
196
  const terminal = isTerminalResponse(idxResponse);
201
- const messages = getIdxMessages(idxResponse, flow);
197
+ const messages = getIdxMessages(idxResponse, remediators);
202
198
 
203
199
  if (terminal) {
204
200
  return {
@@ -219,7 +215,7 @@ async function remediate(idxResponse, values, options) {
219
215
  try {
220
216
  idxResponse = await idxResponse.actions[action]();
221
217
  } catch (e) {
222
- return handleIdxError(e, flow);
218
+ return handleIdxError(e, remediators);
223
219
  }
224
220
 
225
221
  if (action === 'cancel') {
@@ -274,7 +270,7 @@ async function remediate(idxResponse, values, options) {
274
270
 
275
271
 
276
272
  const terminal = isTerminalResponse(idxResponse);
277
- const messages = getIdxMessages(idxResponse, flow);
273
+ const messages = getIdxMessages(idxResponse, remediators);
278
274
 
279
275
  if (terminal) {
280
276
  return {
@@ -297,7 +293,7 @@ async function remediate(idxResponse, values, options) {
297
293
  values = remediator.getValuesAfterProceed();
298
294
  return remediate(idxResponse, values, options); // recursive call
299
295
  } catch (e) {
300
- return handleIdxError(e, flow, remediator);
296
+ return handleIdxError(e, remediators, remediator);
301
297
  }
302
298
  }
303
299
  //# sourceMappingURL=remediate.js.map