@okta/okta-auth-js 5.10.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +10 -6
  3. package/cjs/AuthStateManager.js +11 -3
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +139 -95
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/OktaUserAgent.js.map +1 -1
  9. package/cjs/PromiseQueue.js +11 -2
  10. package/cjs/PromiseQueue.js.map +1 -1
  11. package/cjs/SavedObject.js +4 -2
  12. package/cjs/SavedObject.js.map +1 -1
  13. package/cjs/StorageManager.js +16 -9
  14. package/cjs/StorageManager.js.map +1 -1
  15. package/cjs/TokenManager.js +38 -22
  16. package/cjs/TokenManager.js.map +1 -1
  17. package/cjs/TransactionManager.js +26 -7
  18. package/cjs/TransactionManager.js.map +1 -1
  19. package/cjs/browser/browserStorage.js +25 -14
  20. package/cjs/browser/browserStorage.js.map +1 -1
  21. package/cjs/browser/fingerprint.js +12 -4
  22. package/cjs/browser/fingerprint.js.map +1 -1
  23. package/cjs/builderUtil.js +7 -19
  24. package/cjs/builderUtil.js.map +1 -1
  25. package/cjs/clock.js +5 -1
  26. package/cjs/clock.js.map +1 -1
  27. package/cjs/crypto/base64.js +18 -0
  28. package/cjs/crypto/base64.js.map +1 -1
  29. package/cjs/crypto/index.js +6 -4
  30. package/cjs/crypto/index.js.map +1 -1
  31. package/cjs/crypto/oidcHash.js +5 -1
  32. package/cjs/crypto/oidcHash.js.map +1 -1
  33. package/cjs/crypto/webauthn.js +101 -0
  34. package/cjs/crypto/webauthn.js.map +1 -0
  35. package/cjs/crypto/webcrypto.js +3 -1
  36. package/cjs/crypto/webcrypto.js.map +1 -1
  37. package/cjs/errors/AuthApiError.js +1 -1
  38. package/cjs/errors/AuthPollStopError.js +1 -1
  39. package/cjs/errors/AuthSdkError.js +1 -1
  40. package/cjs/errors/CustomError.js +5 -1
  41. package/cjs/errors/CustomError.js.map +1 -1
  42. package/cjs/errors/OAuthError.js +1 -1
  43. package/cjs/errors/index.js +1 -1
  44. package/cjs/features.js +9 -3
  45. package/cjs/features.js.map +1 -1
  46. package/cjs/fetch/fetchRequest.js +19 -6
  47. package/cjs/fetch/fetchRequest.js.map +1 -1
  48. package/cjs/http/headers.js.map +1 -1
  49. package/cjs/http/index.js +4 -2
  50. package/cjs/http/index.js.map +1 -1
  51. package/cjs/http/request.js +11 -5
  52. package/cjs/http/request.js.map +1 -1
  53. package/cjs/idx/authenticate.js +8 -5
  54. package/cjs/idx/authenticate.js.map +1 -1
  55. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  56. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  57. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +1 -1
  58. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  59. package/cjs/idx/authenticator/SecurityQuestionVerification.js +2 -1
  60. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  61. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +2 -2
  62. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  63. package/cjs/idx/authenticator/WebauthnEnrollment.js +46 -0
  64. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -0
  65. package/cjs/idx/authenticator/WebauthnVerification.js +55 -0
  66. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -0
  67. package/cjs/idx/authenticator/getAuthenticator.js +17 -6
  68. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  69. package/cjs/idx/authenticator/index.js +34 -6
  70. package/cjs/idx/authenticator/index.js.map +1 -1
  71. package/cjs/idx/cancel.js.map +1 -1
  72. package/cjs/idx/emailVerify.js +73 -0
  73. package/cjs/idx/emailVerify.js.map +1 -0
  74. package/cjs/idx/flow/AccountUnlockFlow.js +30 -0
  75. package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -0
  76. package/cjs/idx/flow/AuthenticationFlow.js +2 -1
  77. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -1
  78. package/cjs/idx/flow/FlowSpecification.js +24 -4
  79. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  80. package/cjs/idx/flow/PasswordRecoveryFlow.js +4 -1
  81. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  82. package/cjs/idx/flow/RegistrationFlow.js +2 -0
  83. package/cjs/idx/flow/RegistrationFlow.js.map +1 -1
  84. package/cjs/idx/flow/index.js +20 -5
  85. package/cjs/idx/flow/index.js.map +1 -1
  86. package/cjs/idx/handleInteractionCodeRedirect.js +6 -1
  87. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  88. package/cjs/idx/headers.js +21 -5
  89. package/cjs/idx/headers.js.map +1 -1
  90. package/cjs/idx/idx-js/client.js +91 -0
  91. package/cjs/idx/idx-js/client.js.map +1 -0
  92. package/cjs/idx/idx-js/index.js +162 -0
  93. package/cjs/idx/idx-js/index.js.map +1 -0
  94. package/cjs/idx/idx-js/interact.js +83 -0
  95. package/cjs/idx/idx-js/interact.js.map +1 -0
  96. package/cjs/idx/idx-js/introspect.js +58 -0
  97. package/cjs/idx/idx-js/introspect.js.map +1 -0
  98. package/cjs/idx/idx-js/parsers.js +41 -0
  99. package/cjs/idx/idx-js/parsers.js.map +1 -0
  100. package/cjs/idx/idx-js/util.js +34 -0
  101. package/cjs/idx/idx-js/util.js.map +1 -0
  102. package/cjs/idx/idx-js/v1/actionParser.js +90 -0
  103. package/cjs/idx/idx-js/v1/actionParser.js.map +1 -0
  104. package/cjs/idx/idx-js/v1/generateIdxAction.js +117 -0
  105. package/cjs/idx/idx-js/v1/generateIdxAction.js.map +1 -0
  106. package/cjs/idx/idx-js/v1/idxResponseParser.js +137 -0
  107. package/cjs/idx/idx-js/v1/idxResponseParser.js.map +1 -0
  108. package/cjs/idx/idx-js/v1/makeIdxState.js +64 -0
  109. package/cjs/idx/idx-js/v1/makeIdxState.js.map +1 -0
  110. package/cjs/idx/idx-js/v1/parsers.js +24 -0
  111. package/cjs/idx/idx-js/v1/parsers.js.map +1 -0
  112. package/cjs/idx/idx-js/v1/remediationParser.js +32 -0
  113. package/cjs/idx/idx-js/v1/remediationParser.js.map +1 -0
  114. package/cjs/idx/index.js +121 -109
  115. package/cjs/idx/index.js.map +1 -1
  116. package/cjs/idx/interact.js +53 -36
  117. package/cjs/idx/interact.js.map +1 -1
  118. package/cjs/idx/introspect.js +17 -19
  119. package/cjs/idx/introspect.js.map +1 -1
  120. package/cjs/idx/poll.js +13 -3
  121. package/cjs/idx/poll.js.map +1 -1
  122. package/cjs/idx/proceed.js +4 -7
  123. package/cjs/idx/proceed.js.map +1 -1
  124. package/cjs/idx/recoverPassword.js +1 -1
  125. package/cjs/idx/recoverPassword.js.map +1 -1
  126. package/cjs/idx/register.js +11 -16
  127. package/cjs/idx/register.js.map +1 -1
  128. package/cjs/idx/remediate.js +74 -27
  129. package/cjs/idx/remediate.js.map +1 -1
  130. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +12 -4
  131. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  132. package/cjs/idx/remediators/AuthenticatorVerificationData.js +13 -7
  133. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  134. package/cjs/idx/remediators/Base/AuthenticatorData.js +31 -13
  135. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  136. package/cjs/idx/remediators/Base/Remediator.js +67 -31
  137. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  138. package/cjs/idx/remediators/Base/SelectAuthenticator.js +46 -30
  139. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  140. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +16 -4
  141. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  142. package/cjs/idx/remediators/ChallengeAuthenticator.js +2 -2
  143. package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
  144. package/cjs/idx/remediators/ChallengePoll.js +2 -2
  145. package/cjs/idx/remediators/EnrollAuthenticator.js +2 -2
  146. package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
  147. package/cjs/idx/remediators/EnrollPoll.js +18 -9
  148. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  149. package/cjs/idx/remediators/EnrollProfile.js +24 -9
  150. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  151. package/cjs/idx/remediators/EnrollmentChannelData.js +96 -0
  152. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -0
  153. package/cjs/idx/remediators/Identify.js +5 -3
  154. package/cjs/idx/remediators/Identify.js.map +1 -1
  155. package/cjs/idx/remediators/ReEnrollAuthenticator.js +6 -3
  156. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  157. package/cjs/idx/remediators/RedirectIdp.js +2 -2
  158. package/cjs/idx/remediators/ResetAuthenticator.js +2 -2
  159. package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
  160. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +7 -5
  161. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  162. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js +2 -2
  163. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
  164. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +72 -0
  165. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -0
  166. package/cjs/idx/remediators/SelectEnrollProfile.js +2 -2
  167. package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
  168. package/cjs/idx/remediators/SelectEnrollmentChannel.js +86 -0
  169. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -0
  170. package/cjs/idx/remediators/Skip.js +5 -3
  171. package/cjs/idx/remediators/Skip.js.map +1 -1
  172. package/cjs/idx/remediators/index.js +57 -16
  173. package/cjs/idx/remediators/index.js.map +1 -1
  174. package/cjs/idx/remediators/util.js +18 -3
  175. package/cjs/idx/remediators/util.js.map +1 -1
  176. package/cjs/idx/run.js +139 -49
  177. package/cjs/idx/run.js.map +1 -1
  178. package/cjs/idx/startTransaction.js +4 -2
  179. package/cjs/idx/startTransaction.js.map +1 -1
  180. package/cjs/idx/transactionMeta.js +82 -69
  181. package/cjs/idx/transactionMeta.js.map +1 -1
  182. package/cjs/idx/types/idx-js.js.map +1 -1
  183. package/cjs/idx/types/index.js +59 -7
  184. package/cjs/idx/types/index.js.map +1 -1
  185. package/cjs/idx/unlockAccount.js +48 -0
  186. package/cjs/idx/unlockAccount.js.map +1 -0
  187. package/cjs/index.js +33 -13
  188. package/cjs/index.js.map +1 -1
  189. package/cjs/oidc/endpoints/authorize.js +10 -2
  190. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  191. package/cjs/oidc/endpoints/index.js +5 -3
  192. package/cjs/oidc/endpoints/index.js.map +1 -1
  193. package/cjs/oidc/endpoints/token.js +16 -3
  194. package/cjs/oidc/endpoints/token.js.map +1 -1
  195. package/cjs/oidc/endpoints/well-known.js +7 -3
  196. package/cjs/oidc/endpoints/well-known.js.map +1 -1
  197. package/cjs/oidc/exchangeCodeForTokens.js +12 -4
  198. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  199. package/cjs/oidc/getToken.js +12 -6
  200. package/cjs/oidc/getToken.js.map +1 -1
  201. package/cjs/oidc/getUserInfo.js +7 -3
  202. package/cjs/oidc/getUserInfo.js.map +1 -1
  203. package/cjs/oidc/getWithPopup.js +8 -2
  204. package/cjs/oidc/getWithPopup.js.map +1 -1
  205. package/cjs/oidc/getWithRedirect.js +15 -38
  206. package/cjs/oidc/getWithRedirect.js.map +1 -1
  207. package/cjs/oidc/getWithoutPrompt.js +8 -2
  208. package/cjs/oidc/getWithoutPrompt.js.map +1 -1
  209. package/cjs/oidc/handleOAuthResponse.js +87 -87
  210. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  211. package/cjs/oidc/index.js +4 -2
  212. package/cjs/oidc/index.js.map +1 -1
  213. package/cjs/oidc/parseFromUrl.js +9 -3
  214. package/cjs/oidc/parseFromUrl.js.map +1 -1
  215. package/cjs/oidc/renewToken.js.map +1 -1
  216. package/cjs/oidc/renewTokens.js +6 -2
  217. package/cjs/oidc/renewTokens.js.map +1 -1
  218. package/cjs/oidc/renewTokensWithRefresh.js +5 -1
  219. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  220. package/cjs/oidc/revokeToken.js +34 -31
  221. package/cjs/oidc/revokeToken.js.map +1 -1
  222. package/cjs/oidc/util/browser.js +5 -1
  223. package/cjs/oidc/util/browser.js.map +1 -1
  224. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  225. package/cjs/oidc/util/errors.js.map +1 -1
  226. package/cjs/oidc/util/index.js +27 -11
  227. package/cjs/oidc/util/index.js.map +1 -1
  228. package/cjs/oidc/util/loginRedirect.js +10 -1
  229. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  230. package/cjs/oidc/util/oauth.js +4 -2
  231. package/cjs/oidc/util/oauth.js.map +1 -1
  232. package/cjs/oidc/util/oauthMeta.js +36 -0
  233. package/cjs/oidc/util/oauthMeta.js.map +1 -0
  234. package/cjs/oidc/util/pkce.js +11 -3
  235. package/cjs/oidc/util/pkce.js.map +1 -1
  236. package/cjs/oidc/util/prepareTokenParams.js +62 -39
  237. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  238. package/cjs/oidc/util/validateClaims.js +3 -1
  239. package/cjs/oidc/util/validateClaims.js.map +1 -1
  240. package/cjs/oidc/verifyToken.js +13 -4
  241. package/cjs/oidc/verifyToken.js.map +1 -1
  242. package/cjs/options.js +12 -6
  243. package/cjs/options.js.map +1 -1
  244. package/cjs/server/serverStorage.js +2 -1
  245. package/cjs/server/serverStorage.js.map +1 -1
  246. package/cjs/services/TokenService.js +3 -0
  247. package/cjs/services/TokenService.js.map +1 -1
  248. package/cjs/tx/AuthTransaction.js +18 -9
  249. package/cjs/tx/AuthTransaction.js.map +1 -1
  250. package/cjs/tx/TransactionState.js +0 -17
  251. package/cjs/tx/TransactionState.js.map +1 -1
  252. package/cjs/tx/api.js +11 -6
  253. package/cjs/tx/api.js.map +1 -1
  254. package/cjs/tx/index.js +7 -5
  255. package/cjs/tx/index.js.map +1 -1
  256. package/cjs/tx/poll.js +6 -4
  257. package/cjs/tx/poll.js.map +1 -1
  258. package/cjs/tx/util.js +5 -1
  259. package/cjs/tx/util.js.map +1 -1
  260. package/cjs/types/Transaction.js +10 -2
  261. package/cjs/types/Transaction.js.map +1 -1
  262. package/cjs/types/index.js +16 -14
  263. package/cjs/types/index.js.map +1 -1
  264. package/cjs/util/index.js +7 -18
  265. package/cjs/util/index.js.map +1 -1
  266. package/cjs/util/misc.js +5 -1
  267. package/cjs/util/misc.js.map +1 -1
  268. package/cjs/util/object.js +16 -6
  269. package/cjs/util/object.js.map +1 -1
  270. package/cjs/util/sharedStorage.js +5 -1
  271. package/cjs/util/sharedStorage.js.map +1 -1
  272. package/cjs/util/url.js.map +1 -1
  273. package/dist/okta-auth-js.min.js +1 -1
  274. package/dist/okta-auth-js.min.js.LICENSE.txt +0 -12
  275. package/dist/okta-auth-js.min.js.map +1 -1
  276. package/dist/okta-auth-js.polyfill.js +1 -1
  277. package/dist/okta-auth-js.polyfill.js.map +1 -1
  278. package/dist/okta-auth-js.umd.js +1 -1
  279. package/dist/okta-auth-js.umd.js.LICENSE.txt +0 -12
  280. package/dist/okta-auth-js.umd.js.map +1 -1
  281. package/esm/index.js +2758 -957
  282. package/esm/index.js.map +1 -1
  283. package/lib/AuthStateManager.d.ts +1 -2
  284. package/lib/OktaAuth.d.ts +10 -13
  285. package/lib/StorageManager.d.ts +2 -2
  286. package/lib/TokenManager.d.ts +4 -4
  287. package/lib/TransactionManager.d.ts +4 -3
  288. package/lib/browser/fingerprint.d.ts +2 -3
  289. package/lib/builderUtil.d.ts +1 -2
  290. package/lib/crypto/base64.d.ts +2 -0
  291. package/lib/crypto/browser.d.ts +1 -1
  292. package/lib/crypto/webauthn.d.ts +25 -0
  293. package/lib/features.d.ts +1 -1
  294. package/lib/http/headers.d.ts +2 -2
  295. package/lib/http/request.d.ts +4 -4
  296. package/lib/idx/authenticate.d.ts +2 -2
  297. package/lib/idx/authenticator/Authenticator.d.ts +4 -5
  298. package/lib/idx/authenticator/OktaPassword.d.ts +7 -9
  299. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +9 -8
  300. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +7 -7
  301. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +6 -2
  302. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +16 -0
  303. package/lib/idx/authenticator/WebauthnVerification.d.ts +17 -0
  304. package/lib/idx/authenticator/getAuthenticator.d.ts +1 -1
  305. package/lib/idx/authenticator/index.d.ts +9 -0
  306. package/lib/idx/cancel.d.ts +2 -2
  307. package/lib/idx/emailVerify.d.ts +26 -0
  308. package/lib/{util/emailVerify.d.ts → idx/flow/AccountUnlockFlow.d.ts} +2 -6
  309. package/lib/idx/flow/FlowSpecification.d.ts +3 -2
  310. package/lib/idx/flow/index.d.ts +1 -0
  311. package/lib/idx/headers.d.ts +3 -2
  312. package/lib/idx/idx-js/client.d.ts +36 -0
  313. package/lib/idx/idx-js/index.d.ts +51 -0
  314. package/lib/idx/idx-js/interact.d.ts +25 -0
  315. package/lib/idx/idx-js/introspect.d.ts +20 -0
  316. package/lib/idx/idx-js/parsers.d.ts +15 -0
  317. package/lib/idx/idx-js/util.d.ts +12 -0
  318. package/lib/idx/idx-js/v1/actionParser.d.ts +16 -0
  319. package/lib/idx/idx-js/v1/generateIdxAction.d.ts +13 -0
  320. package/lib/idx/idx-js/v1/idxResponseParser.d.ts +20 -0
  321. package/lib/idx/idx-js/v1/makeIdxState.d.ts +13 -0
  322. package/lib/idx/idx-js/v1/parsers.d.ts +16 -0
  323. package/lib/idx/idx-js/v1/remediationParser.d.ts +12 -0
  324. package/lib/idx/index.d.ts +12 -10
  325. package/lib/idx/interact.d.ts +7 -13
  326. package/lib/idx/introspect.d.ts +4 -3
  327. package/lib/idx/poll.d.ts +2 -2
  328. package/lib/idx/proceed.d.ts +8 -5
  329. package/lib/idx/recoverPassword.d.ts +2 -2
  330. package/lib/idx/register.d.ts +2 -2
  331. package/lib/idx/remediate.d.ts +10 -4
  332. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +3 -3
  333. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +3 -3
  334. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +8 -7
  335. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +10 -7
  336. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +8 -12
  337. package/lib/idx/remediators/EnrollPoll.d.ts +1 -1
  338. package/lib/idx/remediators/EnrollProfile.d.ts +1 -1
  339. package/lib/idx/remediators/EnrollmentChannelData.d.ts +54 -0
  340. package/lib/idx/remediators/Identify.d.ts +2 -2
  341. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -2
  342. package/lib/idx/remediators/RedirectIdp.d.ts +3 -3
  343. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +38 -0
  344. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +40 -0
  345. package/lib/idx/remediators/index.d.ts +3 -0
  346. package/lib/idx/remediators/util.d.ts +2 -2
  347. package/lib/idx/run.d.ts +5 -3
  348. package/lib/idx/startTransaction.d.ts +3 -2
  349. package/lib/idx/transactionMeta.d.ts +10 -31
  350. package/lib/idx/types/FlowIdentifier.d.ts +1 -1
  351. package/lib/idx/types/idx-js.d.ts +44 -1
  352. package/lib/idx/types/index.d.ts +36 -9
  353. package/lib/idx/unlockAccount.d.ts +15 -0
  354. package/lib/index.d.ts +1 -0
  355. package/lib/oidc/endpoints/well-known.d.ts +3 -3
  356. package/lib/oidc/exchangeCodeForTokens.d.ts +14 -2
  357. package/lib/oidc/getToken.d.ts +2 -2
  358. package/lib/oidc/getWithPopup.d.ts +2 -2
  359. package/lib/oidc/getWithRedirect.d.ts +2 -2
  360. package/lib/oidc/getWithoutPrompt.d.ts +2 -2
  361. package/lib/oidc/handleOAuthResponse.d.ts +2 -2
  362. package/lib/oidc/parseFromUrl.d.ts +1 -1
  363. package/lib/oidc/renewToken.d.ts +2 -2
  364. package/lib/oidc/renewTokens.d.ts +1 -1
  365. package/lib/oidc/renewTokensWithRefresh.d.ts +2 -2
  366. package/lib/oidc/revokeToken.d.ts +2 -2
  367. package/lib/oidc/util/browser.d.ts +3 -3
  368. package/lib/oidc/util/defaultTokenParams.d.ts +2 -2
  369. package/lib/oidc/util/errors.d.ts +2 -2
  370. package/lib/oidc/util/index.d.ts +1 -0
  371. package/lib/oidc/util/loginRedirect.d.ts +4 -4
  372. package/lib/oidc/util/oauth.d.ts +4 -11
  373. package/lib/oidc/util/oauthMeta.d.ts +2 -0
  374. package/lib/oidc/util/prepareTokenParams.d.ts +5 -2
  375. package/lib/oidc/util/validateClaims.d.ts +2 -2
  376. package/lib/oidc/verifyToken.d.ts +2 -2
  377. package/lib/server/serverStorage.d.ts +1 -1
  378. package/lib/services/TokenService.d.ts +2 -2
  379. package/lib/tx/AuthTransaction.d.ts +2 -2
  380. package/lib/tx/TransactionState.d.ts +11 -1
  381. package/lib/tx/api.d.ts +6 -6
  382. package/lib/types/OktaAuthOptions.d.ts +6 -8
  383. package/lib/types/Storage.d.ts +3 -3
  384. package/lib/types/Transaction.d.ts +10 -7
  385. package/lib/types/UserClaims.d.ts +3 -3
  386. package/lib/types/api.d.ts +44 -20
  387. package/lib/types/index.d.ts +0 -1
  388. package/lib/util/console.d.ts +1 -1
  389. package/lib/util/index.d.ts +0 -1
  390. package/lib/util/sharedStorage.d.ts +1 -1
  391. package/lib/util/types.d.ts +1 -1
  392. package/lib/util/url.d.ts +2 -2
  393. package/package.json +10 -7
  394. package/polyfill/index.js +1 -0
  395. package/cjs/util/emailVerify.js +0 -28
  396. package/cjs/util/emailVerify.js.map +0 -1
@@ -12,21 +12,25 @@ var _SecurityQuestionEnrollment = require("./SecurityQuestionEnrollment");
12
12
 
13
13
  var _SecurityQuestionVerification = require("./SecurityQuestionVerification");
14
14
 
15
+ var _WebauthnEnrollment = require("./WebauthnEnrollment");
16
+
17
+ var _WebauthnVerification = require("./WebauthnVerification");
18
+
15
19
  var _types = require("../types");
16
20
 
21
+ /* eslint complexity:[0,8] */
17
22
  function getAuthenticator(remediation) {
18
- const {
19
- relatesTo: {
20
- value
21
- } = {}
22
- } = remediation;
23
+ var _value$contextualData, _value$contextualData2;
24
+
25
+ const relatesTo = remediation.relatesTo;
26
+ const value = (relatesTo === null || relatesTo === void 0 ? void 0 : relatesTo.value) || {};
23
27
 
24
28
  switch (value.key) {
25
29
  case _types.AuthenticatorKey.OKTA_PASSWORD:
26
30
  return new _OktaPassword.OktaPassword(value);
27
31
 
28
32
  case _types.AuthenticatorKey.SECURITY_QUESTION:
29
- if (value.contextualData.enrolledQuestion) {
33
+ if ((_value$contextualData = value.contextualData) !== null && _value$contextualData !== void 0 && _value$contextualData.enrolledQuestion) {
30
34
  return new _SecurityQuestionVerification.SecurityQuestionVerification(value);
31
35
  } else {
32
36
  return new _SecurityQuestionEnrollment.SecurityQuestionEnrollment(value);
@@ -35,6 +39,13 @@ function getAuthenticator(remediation) {
35
39
  case _types.AuthenticatorKey.OKTA_VERIFY:
36
40
  return new _OktaVerifyTotp.OktaVerifyTotp(value);
37
41
 
42
+ case _types.AuthenticatorKey.WEBAUTHN:
43
+ if ((_value$contextualData2 = value.contextualData) !== null && _value$contextualData2 !== void 0 && _value$contextualData2.challengeData) {
44
+ return new _WebauthnVerification.WebauthnVerification(value);
45
+ } else {
46
+ return new _WebauthnEnrollment.WebauthnEnrollment(value);
47
+ }
48
+
38
49
  default:
39
50
  return new _VerificationCodeAuthenticator.VerificationCodeAuthenticator(value);
40
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/idx/authenticator/getAuthenticator.ts"],"names":["getAuthenticator","remediation","relatesTo","value","key","AuthenticatorKey","OKTA_PASSWORD","OktaPassword","SECURITY_QUESTION","contextualData","enrolledQuestion","SecurityQuestionVerification","SecurityQuestionEnrollment","OKTA_VERIFY","OktaVerifyTotp","VerificationCodeAuthenticator"],"mappings":";;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAEO,SAASA,gBAAT,CAA0BC,WAA1B,EAAsE;AAC3E,QAAM;AAAEC,IAAAA,SAAS,EAAE;AAAEC,MAAAA;AAAF,QAAY;AAAzB,MAAgCF,WAAtC;;AACA,UAAQE,KAAK,CAACC,GAAd;AACE,SAAKC,wBAAiBC,aAAtB;AACE,aAAO,IAAIC,0BAAJ,CAAiBJ,KAAjB,CAAP;;AACF,SAAKE,wBAAiBG,iBAAtB;AACE,UAAIL,KAAK,CAACM,cAAN,CAAqBC,gBAAzB,EAA2C;AACzC,eAAO,IAAIC,0DAAJ,CAAiCR,KAAjC,CAAP;AACD,OAFD,MAEO;AACL,eAAO,IAAIS,sDAAJ,CAA+BT,KAA/B,CAAP;AACD;;AACH,SAAKE,wBAAiBQ,WAAtB;AACE,aAAO,IAAIC,8BAAJ,CAAmBX,KAAnB,CAAP;;AACF;AACE,aAAO,IAAIY,4DAAJ,CAAkCZ,KAAlC,CAAP;AAZJ;AAcD","sourcesContent":["import { OktaVerifyTotp } from './OktaVerifyTotp';\nimport { Authenticator } from './Authenticator';\nimport { VerificationCodeAuthenticator } from './VerificationCodeAuthenticator';\nimport { OktaPassword } from './OktaPassword';\nimport { SecurityQuestionEnrollment } from './SecurityQuestionEnrollment';\nimport { SecurityQuestionVerification } from './SecurityQuestionVerification';\nimport { IdxRemediation } from '../types/idx-js';\nimport { AuthenticatorKey } from '../types';\n\nexport function getAuthenticator(remediation: IdxRemediation): Authenticator {\n const { relatesTo: { value } = {} } = remediation;\n switch (value.key) {\n case AuthenticatorKey.OKTA_PASSWORD:\n return new OktaPassword(value);\n case AuthenticatorKey.SECURITY_QUESTION:\n if (value.contextualData.enrolledQuestion) {\n return new SecurityQuestionVerification(value);\n } else {\n return new SecurityQuestionEnrollment(value);\n }\n case AuthenticatorKey.OKTA_VERIFY:\n return new OktaVerifyTotp(value);\n default:\n return new VerificationCodeAuthenticator(value);\n }\n}\n"],"file":"getAuthenticator.js"}
1
+ {"version":3,"sources":["../../../../lib/idx/authenticator/getAuthenticator.ts"],"names":["getAuthenticator","remediation","relatesTo","value","key","AuthenticatorKey","OKTA_PASSWORD","OktaPassword","SECURITY_QUESTION","contextualData","enrolledQuestion","SecurityQuestionVerification","SecurityQuestionEnrollment","OKTA_VERIFY","OktaVerifyTotp","WEBAUTHN","challengeData","WebauthnVerification","WebauthnEnrollment","VerificationCodeAuthenticator"],"mappings":";;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;AACO,SAASA,gBAAT,CAA0BC,WAA1B,EAA2E;AAAA;;AAChF,QAAMC,SAAS,GAAGD,WAAW,CAACC,SAA9B;AACA,QAAMC,KAAK,GAAG,CAAAD,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEC,KAAX,KAAoB,EAAlC;;AACA,UAAQA,KAAK,CAACC,GAAd;AACE,SAAKC,wBAAiBC,aAAtB;AACE,aAAO,IAAIC,0BAAJ,CAAiBJ,KAAjB,CAAP;;AACF,SAAKE,wBAAiBG,iBAAtB;AACE,mCAAIL,KAAK,CAACM,cAAV,kDAAI,sBAAsBC,gBAA1B,EAA4C;AAC1C,eAAO,IAAIC,0DAAJ,CAAiCR,KAAjC,CAAP;AACD,OAFD,MAEO;AACL,eAAO,IAAIS,sDAAJ,CAA+BT,KAA/B,CAAP;AACD;;AACH,SAAKE,wBAAiBQ,WAAtB;AACE,aAAO,IAAIC,8BAAJ,CAAmBX,KAAnB,CAAP;;AACF,SAAKE,wBAAiBU,QAAtB;AACE,oCAAIZ,KAAK,CAACM,cAAV,mDAAI,uBAAsBO,aAA1B,EAAyC;AACvC,eAAO,IAAIC,0CAAJ,CAAyBd,KAAzB,CAAP;AACD,OAFD,MAEO;AACL,eAAO,IAAIe,sCAAJ,CAAuBf,KAAvB,CAAP;AACD;;AACH;AACE,aAAO,IAAIgB,4DAAJ,CAAkChB,KAAlC,CAAP;AAlBJ;AAoBD","sourcesContent":["import { OktaVerifyTotp } from './OktaVerifyTotp';\nimport { Authenticator } from './Authenticator';\nimport { VerificationCodeAuthenticator } from './VerificationCodeAuthenticator';\nimport { OktaPassword } from './OktaPassword';\nimport { SecurityQuestionEnrollment } from './SecurityQuestionEnrollment';\nimport { SecurityQuestionVerification } from './SecurityQuestionVerification';\nimport { WebauthnEnrollment } from './WebauthnEnrollment';\nimport { WebauthnVerification } from './WebauthnVerification';\nimport { IdxAuthenticator, IdxRemediation } from '../types/idx-js';\nimport { AuthenticatorKey } from '../types';\n\n/* eslint complexity:[0,8] */\nexport function getAuthenticator(remediation: IdxRemediation): Authenticator<any> {\n const relatesTo = remediation.relatesTo;\n const value = relatesTo?.value || {} as IdxAuthenticator;\n switch (value.key) {\n case AuthenticatorKey.OKTA_PASSWORD:\n return new OktaPassword(value);\n case AuthenticatorKey.SECURITY_QUESTION:\n if (value.contextualData?.enrolledQuestion) {\n return new SecurityQuestionVerification(value);\n } else {\n return new SecurityQuestionEnrollment(value);\n }\n case AuthenticatorKey.OKTA_VERIFY:\n return new OktaVerifyTotp(value);\n case AuthenticatorKey.WEBAUTHN:\n if (value.contextualData?.challengeData) {\n return new WebauthnVerification(value);\n } else {\n return new WebauthnEnrollment(value);\n }\n default:\n return new VerificationCodeAuthenticator(value);\n }\n}\n"],"file":"getAuthenticator.js"}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
4
+
3
5
  var _getAuthenticator = require("./getAuthenticator");
4
6
 
5
- Object.keys(_getAuthenticator).forEach(function (key) {
7
+ _Object$keys(_getAuthenticator).forEach(function (key) {
6
8
  if (key === "default" || key === "__esModule") return;
7
9
  if (key in exports && exports[key] === _getAuthenticator[key]) return;
8
10
  Object.defineProperty(exports, key, {
@@ -15,7 +17,7 @@ Object.keys(_getAuthenticator).forEach(function (key) {
15
17
 
16
18
  var _Authenticator = require("./Authenticator");
17
19
 
18
- Object.keys(_Authenticator).forEach(function (key) {
20
+ _Object$keys(_Authenticator).forEach(function (key) {
19
21
  if (key === "default" || key === "__esModule") return;
20
22
  if (key in exports && exports[key] === _Authenticator[key]) return;
21
23
  Object.defineProperty(exports, key, {
@@ -28,7 +30,7 @@ Object.keys(_Authenticator).forEach(function (key) {
28
30
 
29
31
  var _VerificationCodeAuthenticator = require("./VerificationCodeAuthenticator");
30
32
 
31
- Object.keys(_VerificationCodeAuthenticator).forEach(function (key) {
33
+ _Object$keys(_VerificationCodeAuthenticator).forEach(function (key) {
32
34
  if (key === "default" || key === "__esModule") return;
33
35
  if (key in exports && exports[key] === _VerificationCodeAuthenticator[key]) return;
34
36
  Object.defineProperty(exports, key, {
@@ -41,7 +43,7 @@ Object.keys(_VerificationCodeAuthenticator).forEach(function (key) {
41
43
 
42
44
  var _OktaPassword = require("./OktaPassword");
43
45
 
44
- Object.keys(_OktaPassword).forEach(function (key) {
46
+ _Object$keys(_OktaPassword).forEach(function (key) {
45
47
  if (key === "default" || key === "__esModule") return;
46
48
  if (key in exports && exports[key] === _OktaPassword[key]) return;
47
49
  Object.defineProperty(exports, key, {
@@ -54,7 +56,7 @@ Object.keys(_OktaPassword).forEach(function (key) {
54
56
 
55
57
  var _SecurityQuestionEnrollment = require("./SecurityQuestionEnrollment");
56
58
 
57
- Object.keys(_SecurityQuestionEnrollment).forEach(function (key) {
59
+ _Object$keys(_SecurityQuestionEnrollment).forEach(function (key) {
58
60
  if (key === "default" || key === "__esModule") return;
59
61
  if (key in exports && exports[key] === _SecurityQuestionEnrollment[key]) return;
60
62
  Object.defineProperty(exports, key, {
@@ -67,7 +69,7 @@ Object.keys(_SecurityQuestionEnrollment).forEach(function (key) {
67
69
 
68
70
  var _SecurityQuestionVerification = require("./SecurityQuestionVerification");
69
71
 
70
- Object.keys(_SecurityQuestionVerification).forEach(function (key) {
72
+ _Object$keys(_SecurityQuestionVerification).forEach(function (key) {
71
73
  if (key === "default" || key === "__esModule") return;
72
74
  if (key in exports && exports[key] === _SecurityQuestionVerification[key]) return;
73
75
  Object.defineProperty(exports, key, {
@@ -77,4 +79,30 @@ Object.keys(_SecurityQuestionVerification).forEach(function (key) {
77
79
  }
78
80
  });
79
81
  });
82
+
83
+ var _WebauthnEnrollment = require("./WebauthnEnrollment");
84
+
85
+ _Object$keys(_WebauthnEnrollment).forEach(function (key) {
86
+ if (key === "default" || key === "__esModule") return;
87
+ if (key in exports && exports[key] === _WebauthnEnrollment[key]) return;
88
+ Object.defineProperty(exports, key, {
89
+ enumerable: true,
90
+ get: function () {
91
+ return _WebauthnEnrollment[key];
92
+ }
93
+ });
94
+ });
95
+
96
+ var _WebauthnVerification = require("./WebauthnVerification");
97
+
98
+ _Object$keys(_WebauthnVerification).forEach(function (key) {
99
+ if (key === "default" || key === "__esModule") return;
100
+ if (key in exports && exports[key] === _WebauthnVerification[key]) return;
101
+ Object.defineProperty(exports, key, {
102
+ enumerable: true,
103
+ get: function () {
104
+ return _WebauthnVerification[key];
105
+ }
106
+ });
107
+ });
80
108
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/idx/authenticator/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","sourcesContent":["export * from './getAuthenticator';\nexport * from './Authenticator';\nexport * from './VerificationCodeAuthenticator';\nexport * from './OktaPassword';\nexport * from './SecurityQuestionEnrollment';\nexport * from './SecurityQuestionVerification';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../lib/idx/authenticator/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":["export * from './getAuthenticator';\nexport * from './Authenticator';\nexport * from './VerificationCodeAuthenticator';\nexport * from './OktaPassword';\nexport * from './SecurityQuestionEnrollment';\nexport * from './SecurityQuestionVerification';\nexport * from './WebauthnEnrollment';\nexport * from './WebauthnVerification';\n\nimport { OktaPasswordInputValues } from './OktaPassword';\nimport { SecurityQuestionEnrollValues } from './SecurityQuestionEnrollment';\nimport { SecurityQuestionVerificationValues } from './SecurityQuestionVerification';\nimport { VerificationCodeValues } from './VerificationCodeAuthenticator';\nimport { WebauthnEnrollValues } from './WebauthnEnrollment';\nimport { WebauthnVerificationValues } from './WebauthnVerification';\n\nexport type AuthenticatorValues = OktaPasswordInputValues\n & SecurityQuestionEnrollValues\n & SecurityQuestionVerificationValues\n & VerificationCodeValues\n & WebauthnEnrollValues\n & WebauthnVerificationValues;\n"],"file":"index.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/cancel.ts"],"names":["cancel","authClient","options","meta","transactionManager","load","flowSpec","flow","actions"],"mappings":";;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQO,eAAeA,MAAf,CAAuBC,UAAvB,EAA6CC,OAA7C,EAAqE;AAC1E,QAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;AACA,QAAMC,QAAQ,GAAG,gCAAqBL,UAArB,EAAiCE,IAAI,CAACI,IAAtC,CAAjB;AACA,SAAO,cAAIN,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErB,OAAGI,QAFkB;AAGrBE,IAAAA,OAAO,EAAE,CAAC,QAAD;AAHY,GAAhB,CAAP;AAKD","sourcesContent":["/*!\n * Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { OktaAuth, IdxOptions, IdxTransactionMeta } from '../types';\nimport { run } from './run';\nimport { getFlowSpecification } from './flow';\n\nexport type CancelOptions = IdxOptions;\n\nexport async function cancel (authClient: OktaAuth, options: CancelOptions) {\n const meta = authClient.transactionManager.load() as IdxTransactionMeta;\n const flowSpec = getFlowSpecification(authClient, meta.flow);\n return run(authClient, {\n ...options,\n ...flowSpec,\n actions: ['cancel']\n });\n}\n"],"file":"cancel.js"}
1
+ {"version":3,"sources":["../../../lib/idx/cancel.ts"],"names":["cancel","authClient","options","meta","transactionManager","load","flowSpec","flow","actions"],"mappings":";;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQO,eAAeA,MAAf,CAAuBC,UAAvB,EAAsDC,OAAtD,EAA+E;AACpF,QAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;AACA,QAAMC,QAAQ,GAAG,gCAAqBL,UAArB,EAAiCE,IAAI,CAACI,IAAtC,CAAjB;AACA,SAAO,cAAIN,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErB,OAAGI,QAFkB;AAGrBE,IAAAA,OAAO,EAAE,CAAC,QAAD;AAHY,GAAhB,CAAP;AAKD","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 { OktaAuthInterface, IdxOptions, IdxTransactionMeta } from '../types';\nimport { run } from './run';\nimport { getFlowSpecification } from './flow';\n\nexport type CancelOptions = IdxOptions;\n\nexport async function cancel (authClient: OktaAuthInterface, options?: CancelOptions) {\n const meta = authClient.transactionManager.load() as IdxTransactionMeta;\n const flowSpec = getFlowSpecification(authClient, meta.flow);\n return run(authClient, {\n ...options,\n ...flowSpec,\n actions: ['cancel']\n });\n}\n"],"file":"cancel.js"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
5
+ exports.isEmailVerifyCallbackError = isEmailVerifyCallbackError;
6
+ exports.isEmailVerifyCallback = isEmailVerifyCallback;
7
+ exports.parseEmailVerifyCallback = parseEmailVerifyCallback;
8
+ exports.handleEmailVerifyCallback = handleEmailVerifyCallback;
9
+ exports.EmailVerifyCallbackError = void 0;
10
+
11
+ var _CustomError = _interopRequireDefault(require("../errors/CustomError"));
12
+
13
+ var _urlParams = require("../oidc/util/urlParams");
14
+
15
+ /*!
16
+ * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
17
+ * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
18
+ *
19
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
20
+ * Unless required by applicable law or agreed to in writing, software
21
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ *
24
+ * See the License for the specific language governing permissions and limitations under the License.
25
+ */
26
+ class EmailVerifyCallbackError extends _CustomError.default {
27
+ constructor(state, otp) {
28
+ super(`Enter the OTP code in the originating client: ${otp}`);
29
+ this.name = 'EmailVerifyCallbackError';
30
+ this.state = state;
31
+ this.otp = otp;
32
+ }
33
+
34
+ }
35
+
36
+ exports.EmailVerifyCallbackError = EmailVerifyCallbackError;
37
+
38
+ function isEmailVerifyCallbackError(error) {
39
+ return error.name === 'EmailVerifyCallbackError';
40
+ } // Check if state && otp have been passed back in the url
41
+
42
+
43
+ function isEmailVerifyCallback(urlPath) {
44
+ return /(otp=)/i.test(urlPath) && /(state=)/i.test(urlPath);
45
+ } // Parse state and otp from a urlPath (should be either a search or fragment from the URL)
46
+
47
+
48
+ function parseEmailVerifyCallback(urlPath) {
49
+ return (0, _urlParams.urlParamsToObject)(urlPath);
50
+ }
51
+
52
+ async function handleEmailVerifyCallback(authClient, search) {
53
+ if (isEmailVerifyCallback(search)) {
54
+ const {
55
+ state,
56
+ otp
57
+ } = parseEmailVerifyCallback(search);
58
+
59
+ if (authClient.idx.canProceed({
60
+ state
61
+ })) {
62
+ // same browser / device
63
+ return await authClient.idx.proceed({
64
+ state,
65
+ otp
66
+ });
67
+ } else {
68
+ // different browser or device
69
+ throw new EmailVerifyCallbackError(state, otp);
70
+ }
71
+ }
72
+ }
73
+ //# sourceMappingURL=emailVerify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../lib/idx/emailVerify.ts"],"names":["EmailVerifyCallbackError","CustomError","constructor","state","otp","name","isEmailVerifyCallbackError","error","isEmailVerifyCallback","urlPath","test","parseEmailVerifyCallback","handleEmailVerifyCallback","authClient","search","idx","canProceed","proceed"],"mappings":";;;;;;;;;;AAeA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYO,MAAMA,wBAAN,SAAuCC,oBAAvC,CAAmD;AAIxDC,EAAAA,WAAW,CAACC,KAAD,EAAgBC,GAAhB,EAA6B;AACtC,UAAO,iDAAgDA,GAAI,EAA3D;AACA,SAAKC,IAAL,GAAY,0BAAZ;AACA,SAAKF,KAAL,GAAaA,KAAb;AACA,SAAKC,GAAL,GAAWA,GAAX;AACD;;AATuD;;;;AAYnD,SAASE,0BAAT,CAAoCC,KAApC,EAAkD;AACvD,SAAQA,KAAK,CAACF,IAAN,KAAe,0BAAvB;AACD,C,CAED;;;AACO,SAASG,qBAAT,CAAgCC,OAAhC,EAA0D;AAC/D,SAAO,UAAUC,IAAV,CAAeD,OAAf,KAA2B,YAAYC,IAAZ,CAAiBD,OAAjB,CAAlC;AACD,C,CAED;;;AACO,SAASE,wBAAT,CAAkCF,OAAlC,EAAgF;AACrF,SAAO,kCAAkBA,OAAlB,CAAP;AACD;;AAEM,eAAeG,yBAAf,CAAyCC,UAAzC,EAAwEC,MAAxE,EAAwF;AAC7F,MAAIN,qBAAqB,CAACM,MAAD,CAAzB,EAAmC;AACjC,UAAM;AAAEX,MAAAA,KAAF;AAASC,MAAAA;AAAT,QAAiBO,wBAAwB,CAACG,MAAD,CAA/C;;AACA,QAAID,UAAU,CAACE,GAAX,CAAeC,UAAf,CAA0B;AAAEb,MAAAA;AAAF,KAA1B,CAAJ,EAA0C;AACxC;AACA,aAAO,MAAMU,UAAU,CAACE,GAAX,CAAeE,OAAf,CAAuB;AAAEd,QAAAA,KAAF;AAASC,QAAAA;AAAT,OAAvB,CAAb;AACD,KAHD,MAGO;AACL;AACA,YAAM,IAAIJ,wBAAJ,CAA6BG,KAA7B,EAAoCC,GAApC,CAAN;AACD;AACF;AACF","sourcesContent":["\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { OktaAuthInterface } from '../types';\n\nimport CustomError from '../errors/CustomError';\nimport { urlParamsToObject } from '../oidc/util/urlParams';\n\nexport interface EmailVerifyCallbackResponse {\n state: string;\n otp: string;\n}\n\nexport class EmailVerifyCallbackError extends CustomError {\n state: string;\n otp: string;\n\n constructor(state: string, otp: string) {\n super(`Enter the OTP code in the originating client: ${otp}`);\n this.name = 'EmailVerifyCallbackError';\n this.state = state;\n this.otp = otp;\n }\n}\n\nexport function isEmailVerifyCallbackError(error: Error) {\n return (error.name === 'EmailVerifyCallbackError');\n}\n\n// Check if state && otp have been passed back in the url\nexport function isEmailVerifyCallback (urlPath: string): boolean {\n return /(otp=)/i.test(urlPath) && /(state=)/i.test(urlPath);\n}\n\n// Parse state and otp from a urlPath (should be either a search or fragment from the URL)\nexport function parseEmailVerifyCallback(urlPath: string): EmailVerifyCallbackResponse {\n return urlParamsToObject(urlPath) as EmailVerifyCallbackResponse;\n}\n\nexport async function handleEmailVerifyCallback(authClient: OktaAuthInterface, search: string) {\n if (isEmailVerifyCallback(search)) {\n const { state, otp } = parseEmailVerifyCallback(search);\n if (authClient.idx.canProceed({ state })) {\n // same browser / device\n return await authClient.idx.proceed({ state, otp });\n } else {\n // different browser or device\n throw new EmailVerifyCallbackError(state, otp);\n }\n }\n}\n"],"file":"emailVerify.js"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ exports.AccountUnlockFlow = void 0;
4
+
5
+ var _remediators = require("../remediators");
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
+ const AccountUnlockFlow = {
19
+ 'identify': _remediators.Identify,
20
+ // NOTE: unlock-account is purposely not included. Handled as action
21
+ // because it's a rememdiation which requires no input
22
+ // 'unlock-account': UnlockAccount,
23
+ 'select-authenticator-unlock-account': _remediators.SelectAuthenticatorUnlockAccount,
24
+ 'select-authenticator-authenticate': _remediators.SelectAuthenticatorAuthenticate,
25
+ 'challenge-authenticator': _remediators.ChallengeAuthenticator,
26
+ 'challenge-poll': _remediators.ChallengePoll,
27
+ 'authenticator-verification-data': _remediators.AuthenticatorVerificationData
28
+ };
29
+ exports.AccountUnlockFlow = AccountUnlockFlow;
30
+ //# sourceMappingURL=AccountUnlockFlow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../lib/idx/flow/AccountUnlockFlow.ts"],"names":["AccountUnlockFlow","Identify","SelectAuthenticatorUnlockAccount","SelectAuthenticatorAuthenticate","ChallengeAuthenticator","ChallengePoll","AuthenticatorVerificationData"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaO,MAAMA,iBAAkC,GAAG;AAChD,cAAYC,qBADoC;AAEhD;AACA;AACA;AACA,yCAAuCC,6CALS;AAMhD,uCAAqCC,4CANW;AAOhD,6BAA2BC,mCAPqB;AAQhD,oBAAkBC,0BAR8B;AAShD,qCAAmCC;AATa,CAA3C","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 { RemediationFlow } from './RemediationFlow';\nimport {\n Identify,\n SelectAuthenticatorUnlockAccount,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n ChallengePoll,\n AuthenticatorVerificationData\n} from '../remediators';\n\nexport const AccountUnlockFlow: RemediationFlow = {\n 'identify': Identify,\n // NOTE: unlock-account is purposely not included. Handled as action\n // because it's a rememdiation which requires no input\n // 'unlock-account': UnlockAccount,\n 'select-authenticator-unlock-account': SelectAuthenticatorUnlockAccount,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'challenge-poll': ChallengePoll,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n};\n"],"file":"AccountUnlockFlow.js"}
@@ -26,7 +26,8 @@ const AuthenticationFlow = {
26
26
  'challenge-poll': _remediators.ChallengePoll,
27
27
  'reenroll-authenticator': _remediators.ReEnrollAuthenticator,
28
28
  'enroll-poll': _remediators.EnrollPoll,
29
- 'redirect-idp': _remediators.RedirectIdp
29
+ 'redirect-idp': _remediators.RedirectIdp,
30
+ 'skip': _remediators.Skip
30
31
  };
31
32
  exports.AuthenticationFlow = AuthenticationFlow;
32
33
  //# sourceMappingURL=AuthenticationFlow.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/idx/flow/AuthenticationFlow.ts"],"names":["AuthenticationFlow","Identify","SelectAuthenticatorAuthenticate","SelectAuthenticatorEnroll","AuthenticatorEnrollmentData","AuthenticatorVerificationData","EnrollAuthenticator","ChallengeAuthenticator","ChallengePoll","ReEnrollAuthenticator","EnrollPoll","RedirectIdp"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBO,MAAMA,kBAAmC,GAAG;AACjD,cAAYC,qBADqC;AAEjD,uCAAqCC,4CAFY;AAGjD,iCAA+BC,sCAHkB;AAIjD,mCAAiCC,wCAJgB;AAKjD,qCAAmCC,0CALc;AAMjD,0BAAwBC,gCANyB;AAOjD,6BAA2BC,mCAPsB;AAQjD,oBAAkBC,0BAR+B;AASjD,4BAA0BC,kCATuB;AAUjD,iBAAeC,uBAVkC;AAWjD,kBAAgBC;AAXiC,CAA5C","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 { RemediationFlow } from './RemediationFlow';\nimport { \n Identify,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n ReEnrollAuthenticator,\n RedirectIdp,\n AuthenticatorEnrollmentData,\n SelectAuthenticatorEnroll,\n EnrollAuthenticator,\n AuthenticatorVerificationData,\n EnrollPoll,\n ChallengePoll\n} from '../remediators';\n\nexport const AuthenticationFlow: RemediationFlow = {\n 'identify': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'enroll-authenticator': EnrollAuthenticator,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'challenge-poll': ChallengePoll,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n 'enroll-poll': EnrollPoll,\n 'redirect-idp': RedirectIdp\n};\n"],"file":"AuthenticationFlow.js"}
1
+ {"version":3,"sources":["../../../../lib/idx/flow/AuthenticationFlow.ts"],"names":["AuthenticationFlow","Identify","SelectAuthenticatorAuthenticate","SelectAuthenticatorEnroll","AuthenticatorEnrollmentData","AuthenticatorVerificationData","EnrollAuthenticator","ChallengeAuthenticator","ChallengePoll","ReEnrollAuthenticator","EnrollPoll","RedirectIdp","Skip"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBO,MAAMA,kBAAmC,GAAG;AACjD,cAAYC,qBADqC;AAEjD,uCAAqCC,4CAFY;AAGjD,iCAA+BC,sCAHkB;AAIjD,mCAAiCC,wCAJgB;AAKjD,qCAAmCC,0CALc;AAMjD,0BAAwBC,gCANyB;AAOjD,6BAA2BC,mCAPsB;AAQjD,oBAAkBC,0BAR+B;AASjD,4BAA0BC,kCATuB;AAUjD,iBAAeC,uBAVkC;AAWjD,kBAAgBC,wBAXiC;AAYjD,UAAQC;AAZyC,CAA5C","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 { RemediationFlow } from './RemediationFlow';\nimport { \n Identify,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n ReEnrollAuthenticator,\n RedirectIdp,\n AuthenticatorEnrollmentData,\n SelectAuthenticatorEnroll,\n EnrollAuthenticator,\n AuthenticatorVerificationData,\n EnrollPoll,\n ChallengePoll, Skip\n} from '../remediators';\n\nexport const AuthenticationFlow: RemediationFlow = {\n 'identify': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'enroll-authenticator': EnrollAuthenticator,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'challenge-poll': ChallengePoll,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n 'enroll-poll': EnrollPoll,\n 'redirect-idp': RedirectIdp,\n 'skip': Skip,\n};\n"],"file":"AuthenticationFlow.js"}
@@ -8,24 +8,43 @@ var _PasswordRecoveryFlow = require("./PasswordRecoveryFlow");
8
8
 
9
9
  var _RegistrationFlow = require("./RegistrationFlow");
10
10
 
11
- function getFlowSpecification(oktaAuth, flow = 'proceed') {
12
- let remediators, actions;
11
+ var _AccountUnlockFlow = require("./AccountUnlockFlow");
12
+
13
+ // eslint-disable-next-line complexity
14
+ function getFlowSpecification(oktaAuth, flow = 'default') {
15
+ let remediators,
16
+ actions,
17
+ withCredentials = true;
13
18
 
14
19
  switch (flow) {
15
20
  case 'register':
16
21
  case 'signup':
17
22
  case 'enrollProfile':
18
23
  remediators = _RegistrationFlow.RegistrationFlow;
24
+ withCredentials = false;
19
25
  break;
20
26
 
21
27
  case 'recoverPassword':
22
28
  case 'resetPassword':
23
29
  remediators = _PasswordRecoveryFlow.PasswordRecoveryFlow;
24
30
  actions = ['currentAuthenticator-recover', 'currentAuthenticatorEnrollment-recover'];
31
+ withCredentials = false;
32
+ break;
33
+
34
+ case 'unlockAccount':
35
+ remediators = _AccountUnlockFlow.AccountUnlockFlow;
36
+ withCredentials = false;
37
+ actions = ['unlock-account'];
38
+ break;
39
+
40
+ case 'authenticate':
41
+ case 'login':
42
+ case 'signin':
43
+ remediators = _AuthenticationFlow.AuthenticationFlow;
25
44
  break;
26
45
 
27
46
  default:
28
- // authenticate
47
+ // default case has no flow monitor
29
48
  remediators = _AuthenticationFlow.AuthenticationFlow;
30
49
  break;
31
50
  }
@@ -33,7 +52,8 @@ function getFlowSpecification(oktaAuth, flow = 'proceed') {
33
52
  return {
34
53
  flow,
35
54
  remediators,
36
- actions
55
+ actions,
56
+ withCredentials
37
57
  };
38
58
  }
39
59
  //# sourceMappingURL=FlowSpecification.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/idx/flow/FlowSpecification.ts"],"names":["getFlowSpecification","oktaAuth","flow","remediators","actions","RegistrationFlow","PasswordRecoveryFlow","AuthenticationFlow"],"mappings":";;;;AACA;;AACA;;AACA;;AASO,SAASA,oBAAT,CAA8BC,QAA9B,EAAkDC,IAAoB,GAAG,SAAzE,EAAuG;AAC5G,MAAIC,WAAJ,EAAiBC,OAAjB;;AACA,UAAQF,IAAR;AACE,SAAK,UAAL;AACA,SAAK,QAAL;AACA,SAAK,eAAL;AACEC,MAAAA,WAAW,GAAGE,kCAAd;AACA;;AACF,SAAK,iBAAL;AACA,SAAK,eAAL;AACEF,MAAAA,WAAW,GAAGG,0CAAd;AACAF,MAAAA,OAAO,GAAG,CACR,8BADQ,EAER,wCAFQ,CAAV;AAIA;;AACF;AACE;AACAD,MAAAA,WAAW,GAAGI,sCAAd;AACA;AAjBJ;;AAmBA,SAAO;AAAEL,IAAAA,IAAF;AAAQC,IAAAA,WAAR;AAAqBC,IAAAA;AAArB,GAAP;AACD","sourcesContent":["import { OktaAuth, FlowIdentifier } from '../../types';\nimport { AuthenticationFlow } from './AuthenticationFlow';\nimport { PasswordRecoveryFlow } from './PasswordRecoveryFlow';\nimport { RegistrationFlow } from './RegistrationFlow';\nimport { RemediationFlow } from './RemediationFlow';\n\nexport interface FlowSpecification {\n flow: FlowIdentifier;\n remediators: RemediationFlow;\n actions?: string[];\n}\n\nexport function getFlowSpecification(oktaAuth: OktaAuth, flow: FlowIdentifier = 'proceed'): FlowSpecification {\n let remediators, actions;\n switch (flow) {\n case 'register':\n case 'signup':\n case 'enrollProfile':\n remediators = RegistrationFlow;\n break;\n case 'recoverPassword':\n case 'resetPassword':\n remediators = PasswordRecoveryFlow;\n actions = [\n 'currentAuthenticator-recover', \n 'currentAuthenticatorEnrollment-recover'\n ];\n break;\n default:\n // authenticate\n remediators = AuthenticationFlow;\n break;\n }\n return { flow, remediators, actions };\n}\n"],"file":"FlowSpecification.js"}
1
+ {"version":3,"sources":["../../../../lib/idx/flow/FlowSpecification.ts"],"names":["getFlowSpecification","oktaAuth","flow","remediators","actions","withCredentials","RegistrationFlow","PasswordRecoveryFlow","AccountUnlockFlow","AuthenticationFlow"],"mappings":";;;;AACA;;AACA;;AACA;;AACA;;AAUA;AACO,SAASA,oBAAT,CAA8BC,QAA9B,EAA2DC,IAAoB,GAAG,SAAlF,EAAgH;AACrH,MAAIC,WAAJ;AAAA,MAAiBC,OAAjB;AAAA,MAA0BC,eAAe,GAAG,IAA5C;;AACA,UAAQH,IAAR;AACE,SAAK,UAAL;AACA,SAAK,QAAL;AACA,SAAK,eAAL;AACEC,MAAAA,WAAW,GAAGG,kCAAd;AACAD,MAAAA,eAAe,GAAG,KAAlB;AACA;;AACF,SAAK,iBAAL;AACA,SAAK,eAAL;AACEF,MAAAA,WAAW,GAAGI,0CAAd;AACAH,MAAAA,OAAO,GAAG,CACR,8BADQ,EAER,wCAFQ,CAAV;AAIAC,MAAAA,eAAe,GAAG,KAAlB;AACA;;AACF,SAAK,eAAL;AACEF,MAAAA,WAAW,GAAGK,oCAAd;AACAH,MAAAA,eAAe,GAAG,KAAlB;AACAD,MAAAA,OAAO,GAAG,CACR,gBADQ,CAAV;AAGA;;AACF,SAAK,cAAL;AACA,SAAK,OAAL;AACA,SAAK,QAAL;AACED,MAAAA,WAAW,GAAGM,sCAAd;AACA;;AACF;AACE;AACAN,MAAAA,WAAW,GAAGM,sCAAd;AACA;AA/BJ;;AAiCA,SAAO;AAAEP,IAAAA,IAAF;AAAQC,IAAAA,WAAR;AAAqBC,IAAAA,OAArB;AAA8BC,IAAAA;AAA9B,GAAP;AACD","sourcesContent":["import { OktaAuthInterface, FlowIdentifier } from '../../types';\nimport { AuthenticationFlow } from './AuthenticationFlow';\nimport { PasswordRecoveryFlow } from './PasswordRecoveryFlow';\nimport { RegistrationFlow } from './RegistrationFlow';\nimport { AccountUnlockFlow } from './AccountUnlockFlow';\nimport { RemediationFlow } from './RemediationFlow';\n\nexport interface FlowSpecification {\n flow: FlowIdentifier;\n remediators: RemediationFlow;\n actions?: string[];\n withCredentials?: boolean;\n}\n\n// eslint-disable-next-line complexity\nexport function getFlowSpecification(oktaAuth: OktaAuthInterface, flow: FlowIdentifier = 'default'): FlowSpecification {\n let remediators, actions, withCredentials = true;\n switch (flow) {\n case 'register':\n case 'signup':\n case 'enrollProfile':\n remediators = RegistrationFlow;\n withCredentials = false;\n break;\n case 'recoverPassword':\n case 'resetPassword':\n remediators = PasswordRecoveryFlow;\n actions = [\n 'currentAuthenticator-recover', \n 'currentAuthenticatorEnrollment-recover'\n ];\n withCredentials = false;\n break;\n case 'unlockAccount':\n remediators = AccountUnlockFlow;\n withCredentials = false;\n actions = [\n 'unlock-account'\n ];\n break;\n case 'authenticate':\n case 'login':\n case 'signin':\n remediators = AuthenticationFlow;\n break;\n default:\n // default case has no flow monitor\n remediators = AuthenticationFlow;\n break;\n }\n return { flow, remediators, actions, withCredentials };\n}\n"],"file":"FlowSpecification.js"}
@@ -19,10 +19,13 @@ const PasswordRecoveryFlow = {
19
19
  'identify': _remediators.Identify,
20
20
  'identify-recovery': _remediators.Identify,
21
21
  'select-authenticator-authenticate': _remediators.SelectAuthenticatorAuthenticate,
22
+ 'select-authenticator-enroll': _remediators.SelectAuthenticatorEnroll,
22
23
  'challenge-authenticator': _remediators.ChallengeAuthenticator,
23
24
  'authenticator-verification-data': _remediators.AuthenticatorVerificationData,
25
+ 'authenticator-enrollment-data': _remediators.AuthenticatorEnrollmentData,
24
26
  'reset-authenticator': _remediators.ResetAuthenticator,
25
- 'reenroll-authenticator': _remediators.ReEnrollAuthenticator
27
+ 'reenroll-authenticator': _remediators.ReEnrollAuthenticator,
28
+ 'enroll-poll': _remediators.EnrollPoll
26
29
  };
27
30
  exports.PasswordRecoveryFlow = PasswordRecoveryFlow;
28
31
  //# sourceMappingURL=PasswordRecoveryFlow.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/idx/flow/PasswordRecoveryFlow.ts"],"names":["PasswordRecoveryFlow","Identify","SelectAuthenticatorAuthenticate","ChallengeAuthenticator","AuthenticatorVerificationData","ResetAuthenticator","ReEnrollAuthenticator"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaO,MAAMA,oBAAqC,GAAG;AACnD,cAAYC,qBADuC;AAEnD,uBAAqBA,qBAF8B;AAGnD,uCAAqCC,4CAHc;AAInD,6BAA2BC,mCAJwB;AAKnD,qCAAmCC,0CALgB;AAMnD,yBAAuBC,+BAN4B;AAOnD,4BAA0BC;AAPyB,CAA9C","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 { RemediationFlow } from './RemediationFlow';\nimport {\n Identify,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n AuthenticatorVerificationData,\n ResetAuthenticator,\n ReEnrollAuthenticator,\n} from '../remediators';\n\nexport const PasswordRecoveryFlow: 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"],"file":"PasswordRecoveryFlow.js"}
1
+ {"version":3,"sources":["../../../../lib/idx/flow/PasswordRecoveryFlow.ts"],"names":["PasswordRecoveryFlow","Identify","SelectAuthenticatorAuthenticate","SelectAuthenticatorEnroll","ChallengeAuthenticator","AuthenticatorVerificationData","AuthenticatorEnrollmentData","ResetAuthenticator","ReEnrollAuthenticator","EnrollPoll"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBO,MAAMA,oBAAqC,GAAG;AACnD,cAAYC,qBADuC;AAEnD,uBAAqBA,qBAF8B;AAGnD,uCAAqCC,4CAHc;AAInD,iCAA+BC,sCAJoB;AAKnD,6BAA2BC,mCALwB;AAMnD,qCAAmCC,0CANgB;AAOnD,mCAAiCC,wCAPkB;AAQnD,yBAAuBC,+BAR4B;AASnD,4BAA0BC,kCATyB;AAUnD,iBAAeC;AAVoC,CAA9C","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 { RemediationFlow } from './RemediationFlow';\nimport {\n Identify,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n AuthenticatorVerificationData,\n ResetAuthenticator,\n ReEnrollAuthenticator,\n SelectAuthenticatorEnroll,\n AuthenticatorEnrollmentData,\n EnrollPoll\n} from '../remediators';\n\nexport const PasswordRecoveryFlow: RemediationFlow = {\n 'identify': Identify,\n 'identify-recovery': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'reset-authenticator': ResetAuthenticator,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n 'enroll-poll': EnrollPoll,\n};\n"],"file":"PasswordRecoveryFlow.js"}
@@ -21,6 +21,8 @@ const RegistrationFlow = {
21
21
  'authenticator-enrollment-data': _remediators.AuthenticatorEnrollmentData,
22
22
  'select-authenticator-enroll': _remediators.SelectAuthenticatorEnroll,
23
23
  'enroll-poll': _remediators.EnrollPoll,
24
+ 'select-enrollment-channel': _remediators.SelectEnrollmentChannel,
25
+ 'enrollment-channel-data': _remediators.EnrollmentChannelData,
24
26
  'enroll-authenticator': _remediators.EnrollAuthenticator,
25
27
  'skip': _remediators.Skip
26
28
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/idx/flow/RegistrationFlow.ts"],"names":["RegistrationFlow","SelectEnrollProfile","EnrollProfile","AuthenticatorEnrollmentData","SelectAuthenticatorEnroll","EnrollPoll","EnrollAuthenticator","Skip"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcO,MAAMA,gBAAiC,GAAG;AAC/C,2BAAyBC,gCADsB;AAE/C,oBAAkBC,0BAF6B;AAG/C,mCAAiCC,wCAHc;AAI/C,iCAA+BC,sCAJgB;AAK/C,iBAAeC,uBALgC;AAM/C,0BAAwBC,gCANuB;AAO/C,UAAQC;AAPuC,CAA1C","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 { RemediationFlow } from './RemediationFlow';\nimport { \n SelectEnrollProfile,\n EnrollPoll,\n EnrollProfile,\n SelectAuthenticatorEnroll,\n EnrollAuthenticator,\n AuthenticatorEnrollmentData,\n Skip,\n} from '../remediators';\n\nexport const RegistrationFlow: RemediationFlow = {\n 'select-enroll-profile': SelectEnrollProfile,\n 'enroll-profile': EnrollProfile,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'enroll-poll': EnrollPoll,\n 'enroll-authenticator': EnrollAuthenticator,\n 'skip': Skip,\n};\n"],"file":"RegistrationFlow.js"}
1
+ {"version":3,"sources":["../../../../lib/idx/flow/RegistrationFlow.ts"],"names":["RegistrationFlow","SelectEnrollProfile","EnrollProfile","AuthenticatorEnrollmentData","SelectAuthenticatorEnroll","EnrollPoll","SelectEnrollmentChannel","EnrollmentChannelData","EnrollAuthenticator","Skip"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBO,MAAMA,gBAAiC,GAAG;AAC/C,2BAAyBC,gCADsB;AAE/C,oBAAkBC,0BAF6B;AAG/C,mCAAiCC,wCAHc;AAI/C,iCAA+BC,sCAJgB;AAK/C,iBAAeC,uBALgC;AAM/C,+BAA6BC,oCANkB;AAO/C,6BAA2BC,kCAPoB;AAQ/C,0BAAwBC,gCARuB;AAS/C,UAAQC;AATuC,CAA1C","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 { RemediationFlow } from './RemediationFlow';\nimport { \n SelectEnrollProfile,\n EnrollPoll,\n SelectEnrollmentChannel,\n EnrollmentChannelData,\n EnrollProfile,\n SelectAuthenticatorEnroll,\n EnrollAuthenticator,\n AuthenticatorEnrollmentData,\n Skip,\n} from '../remediators';\n\nexport const RegistrationFlow: RemediationFlow = {\n 'select-enroll-profile': SelectEnrollProfile,\n 'enroll-profile': EnrollProfile,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'enroll-poll': EnrollPoll,\n 'select-enrollment-channel': SelectEnrollmentChannel,\n 'enrollment-channel-data': EnrollmentChannelData,\n 'enroll-authenticator': EnrollAuthenticator,\n 'skip': Skip,\n};\n"],"file":"RegistrationFlow.js"}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
+ var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
4
+
3
5
  var _AuthenticationFlow = require("./AuthenticationFlow");
4
6
 
5
- Object.keys(_AuthenticationFlow).forEach(function (key) {
7
+ _Object$keys(_AuthenticationFlow).forEach(function (key) {
6
8
  if (key === "default" || key === "__esModule") return;
7
9
  if (key in exports && exports[key] === _AuthenticationFlow[key]) return;
8
10
  Object.defineProperty(exports, key, {
@@ -15,7 +17,7 @@ Object.keys(_AuthenticationFlow).forEach(function (key) {
15
17
 
16
18
  var _FlowSpecification = require("./FlowSpecification");
17
19
 
18
- Object.keys(_FlowSpecification).forEach(function (key) {
20
+ _Object$keys(_FlowSpecification).forEach(function (key) {
19
21
  if (key === "default" || key === "__esModule") return;
20
22
  if (key in exports && exports[key] === _FlowSpecification[key]) return;
21
23
  Object.defineProperty(exports, key, {
@@ -28,7 +30,7 @@ Object.keys(_FlowSpecification).forEach(function (key) {
28
30
 
29
31
  var _PasswordRecoveryFlow = require("./PasswordRecoveryFlow");
30
32
 
31
- Object.keys(_PasswordRecoveryFlow).forEach(function (key) {
33
+ _Object$keys(_PasswordRecoveryFlow).forEach(function (key) {
32
34
  if (key === "default" || key === "__esModule") return;
33
35
  if (key in exports && exports[key] === _PasswordRecoveryFlow[key]) return;
34
36
  Object.defineProperty(exports, key, {
@@ -41,7 +43,7 @@ Object.keys(_PasswordRecoveryFlow).forEach(function (key) {
41
43
 
42
44
  var _RegistrationFlow = require("./RegistrationFlow");
43
45
 
44
- Object.keys(_RegistrationFlow).forEach(function (key) {
46
+ _Object$keys(_RegistrationFlow).forEach(function (key) {
45
47
  if (key === "default" || key === "__esModule") return;
46
48
  if (key in exports && exports[key] === _RegistrationFlow[key]) return;
47
49
  Object.defineProperty(exports, key, {
@@ -52,9 +54,22 @@ Object.keys(_RegistrationFlow).forEach(function (key) {
52
54
  });
53
55
  });
54
56
 
57
+ var _AccountUnlockFlow = require("./AccountUnlockFlow");
58
+
59
+ _Object$keys(_AccountUnlockFlow).forEach(function (key) {
60
+ if (key === "default" || key === "__esModule") return;
61
+ if (key in exports && exports[key] === _AccountUnlockFlow[key]) return;
62
+ Object.defineProperty(exports, key, {
63
+ enumerable: true,
64
+ get: function () {
65
+ return _AccountUnlockFlow[key];
66
+ }
67
+ });
68
+ });
69
+
55
70
  var _RemediationFlow = require("./RemediationFlow");
56
71
 
57
- Object.keys(_RemediationFlow).forEach(function (key) {
72
+ _Object$keys(_RemediationFlow).forEach(function (key) {
58
73
  if (key === "default" || key === "__esModule") return;
59
74
  if (key in exports && exports[key] === _RemediationFlow[key]) return;
60
75
  Object.defineProperty(exports, key, {
@@ -1 +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","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 './FlowSpecification';\nexport * from './PasswordRecoveryFlow';\nexport * from './RegistrationFlow';\nexport * from './RemediationFlow';\n"],"file":"index.js"}
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","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 './FlowSpecification';\nexport * from './PasswordRecoveryFlow';\nexport * from './RegistrationFlow';\nexport * from './AccountUnlockFlow';\nexport * from './RemediationFlow';\n"],"file":"index.js"}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+
3
5
  exports.handleInteractionCodeRedirect = handleInteractionCodeRedirect;
4
6
 
7
+ var _url = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/url"));
8
+
5
9
  var _errors = require("../errors");
6
10
 
7
11
  /*!
@@ -30,13 +34,14 @@ async function handleInteractionCodeRedirect(authClient, url) {
30
34
  searchParams // URL API has been added to the polyfill
31
35
  // eslint-disable-next-line compat/compat
32
36
 
33
- } = new URL(url);
37
+ } = new _url.default(url);
34
38
  const state = searchParams.get('state');
35
39
  const interactionCode = searchParams.get('interaction_code'); // Error handling
36
40
 
37
41
  const error = searchParams.get('error');
38
42
 
39
43
  if (error) {
44
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
40
45
  throw new _errors.OAuthError(error, searchParams.get('error_description'));
41
46
  }
42
47
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/idx/handleInteractionCodeRedirect.ts"],"names":["handleInteractionCodeRedirect","authClient","url","meta","transactionManager","load","AuthSdkError","codeVerifier","state","savedState","searchParams","URL","get","interactionCode","error","OAuthError","tokens","token","exchangeCodeForTokens","tokenManager","setTokens"],"mappings":";;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOO,eAAeA,6BAAf,CACLC,UADK,EAELC,GAFK,EAGU;AACf,QAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;;AACA,MAAI,CAACF,IAAL,EAAW;AACT,UAAM,IAAIG,oBAAJ,CAAiB,0CAAjB,CAAN;AACD;;AAED,QAAM;AACJC,IAAAA,YADI;AAEJC,IAAAA,KAAK,EAAEC;AAFH,MAGFN,IAHJ;AAIA,QAAM;AACJO,IAAAA,YADI,CAEN;AACA;;AAHM,MAIF,IAAIC,GAAJ,CAAQT,GAAR,CAJJ;AAKA,QAAMM,KAAK,GAAGE,YAAY,CAACE,GAAb,CAAiB,OAAjB,CAAd;AACA,QAAMC,eAAe,GAAGH,YAAY,CAACE,GAAb,CAAiB,kBAAjB,CAAxB,CAhBe,CAkBf;;AACA,QAAME,KAAK,GAAGJ,YAAY,CAACE,GAAb,CAAiB,OAAjB,CAAd;;AACA,MAAIE,KAAJ,EAAW;AACT,UAAM,IAAIC,kBAAJ,CAAeD,KAAf,EAAsBJ,YAAY,CAACE,GAAb,CAAiB,mBAAjB,CAAtB,CAAN;AACD;;AACD,MAAIJ,KAAK,KAAKC,UAAd,EAA0B;AACxB,UAAM,IAAIH,oBAAJ,CAAiB,6DAAjB,CAAN;AACD;;AACD,MAAI,CAACO,eAAL,EAAsB;AACpB,UAAM,IAAIP,oBAAJ,CAAiB,+CAAjB,CAAN;AACD,GA5Bc,CA8Bf;;;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAa,MAAMf,UAAU,CAACgB,KAAX,CAAiBC,qBAAjB,CAAuC;AAAEL,IAAAA,eAAF;AAAmBN,IAAAA;AAAnB,GAAvC,CAAzB;AACAN,EAAAA,UAAU,CAACkB,YAAX,CAAwBC,SAAxB,CAAkCJ,MAAlC;AACD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { AuthSdkError, OAuthError } from '../errors';\nimport { OktaAuth } from '..';\nimport {IdxTransactionMeta} from '../types';\n\nexport async function handleInteractionCodeRedirect(\n authClient: OktaAuth, \n url: string\n): Promise<void> {\n const meta = authClient.transactionManager.load() as IdxTransactionMeta;\n if (!meta) {\n throw new AuthSdkError('No transaction data was found in storage');\n }\n\n const { \n codeVerifier,\n state: savedState \n } = meta;\n const { \n searchParams\n // URL API has been added to the polyfill\n // eslint-disable-next-line compat/compat\n } = new URL(url); \n const state = searchParams.get('state');\n const interactionCode = searchParams.get('interaction_code');\n\n // Error handling\n const error = searchParams.get('error');\n if (error) {\n throw new OAuthError(error, searchParams.get('error_description'));\n }\n if (state !== savedState) {\n throw new AuthSdkError('State in redirect uri does not match with transaction state');\n }\n if (!interactionCode) {\n throw new AuthSdkError('Unable to parse interaction_code from the url');\n }\n \n // Save tokens to storage\n const { tokens } = await authClient.token.exchangeCodeForTokens({ interactionCode, codeVerifier });\n authClient.tokenManager.setTokens(tokens);\n}"],"file":"handleInteractionCodeRedirect.js"}
1
+ {"version":3,"sources":["../../../lib/idx/handleInteractionCodeRedirect.ts"],"names":["handleInteractionCodeRedirect","authClient","url","meta","transactionManager","load","AuthSdkError","codeVerifier","state","savedState","searchParams","get","interactionCode","error","OAuthError","tokens","token","exchangeCodeForTokens","tokenManager","setTokens"],"mappings":";;;;;;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOO,eAAeA,6BAAf,CACLC,UADK,EAELC,GAFK,EAGU;AACf,QAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;;AACA,MAAI,CAACF,IAAL,EAAW;AACT,UAAM,IAAIG,oBAAJ,CAAiB,0CAAjB,CAAN;AACD;;AAED,QAAM;AACJC,IAAAA,YADI;AAEJC,IAAAA,KAAK,EAAEC;AAFH,MAGFN,IAHJ;AAIA,QAAM;AACJO,IAAAA,YADI,CAEN;AACA;;AAHM,MAIF,iBAAQR,GAAR,CAJJ;AAKA,QAAMM,KAAK,GAAGE,YAAY,CAACC,GAAb,CAAiB,OAAjB,CAAd;AACA,QAAMC,eAAe,GAAGF,YAAY,CAACC,GAAb,CAAiB,kBAAjB,CAAxB,CAhBe,CAkBf;;AACA,QAAME,KAAK,GAAGH,YAAY,CAACC,GAAb,CAAiB,OAAjB,CAAd;;AACA,MAAIE,KAAJ,EAAW;AACT;AACA,UAAM,IAAIC,kBAAJ,CAAeD,KAAf,EAAsBH,YAAY,CAACC,GAAb,CAAiB,mBAAjB,CAAtB,CAAN;AACD;;AACD,MAAIH,KAAK,KAAKC,UAAd,EAA0B;AACxB,UAAM,IAAIH,oBAAJ,CAAiB,6DAAjB,CAAN;AACD;;AACD,MAAI,CAACM,eAAL,EAAsB;AACpB,UAAM,IAAIN,oBAAJ,CAAiB,+CAAjB,CAAN;AACD,GA7Bc,CA+Bf;;;AACA,QAAM;AAAES,IAAAA;AAAF,MAAa,MAAMd,UAAU,CAACe,KAAX,CAAiBC,qBAAjB,CAAuC;AAAEL,IAAAA,eAAF;AAAmBL,IAAAA;AAAnB,GAAvC,CAAzB;AACAN,EAAAA,UAAU,CAACiB,YAAX,CAAwBC,SAAxB,CAAkCJ,MAAlC;AACD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { AuthSdkError, OAuthError } from '../errors';\nimport { OktaAuth } from '..';\nimport {IdxTransactionMeta} from '../types';\n\nexport async function handleInteractionCodeRedirect(\n authClient: OktaAuth, \n url: string\n): Promise<void> {\n const meta = authClient.transactionManager.load() as IdxTransactionMeta;\n if (!meta) {\n throw new AuthSdkError('No transaction data was found in storage');\n }\n\n const { \n codeVerifier,\n state: savedState \n } = meta;\n const { \n searchParams\n // URL API has been added to the polyfill\n // eslint-disable-next-line compat/compat\n } = new URL(url); \n const state = searchParams.get('state');\n const interactionCode = searchParams.get('interaction_code');\n\n // Error handling\n const error = searchParams.get('error');\n if (error) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n throw new OAuthError(error, searchParams.get('error_description')!);\n }\n if (state !== savedState) {\n throw new AuthSdkError('State in redirect uri does not match with transaction state');\n }\n if (!interactionCode) {\n throw new AuthSdkError('Unable to parse interaction_code from the url');\n }\n \n // Save tokens to storage\n const { tokens } = await authClient.token.exchangeCodeForTokens({ interactionCode, codeVerifier });\n authClient.tokenManager.setTokens(tokens);\n}"],"file":"handleInteractionCodeRedirect.js"}
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
4
 
5
5
  exports.setGlobalRequestInterceptor = setGlobalRequestInterceptor;
6
+ exports.clearGlobalRequestInterceptor = clearGlobalRequestInterceptor;
6
7
  exports.createGlobalRequestInterceptor = createGlobalRequestInterceptor;
7
8
 
8
- var _oktaIdxJs = _interopRequireDefault(require("@okta/okta-idx-js"));
9
+ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
10
+
11
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
12
+
13
+ var _idxJs = _interopRequireDefault(require("./idx-js"));
9
14
 
10
15
  /*!
11
16
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
@@ -24,7 +29,11 @@ var _oktaIdxJs = _interopRequireDefault(require("@okta/okta-idx-js"));
24
29
  // This means that multiple instances of OktaAuth will see the same header modifications
25
30
  // TODO: use AuthJS http agent for IDX API requests. OKTA-417473
26
31
  function setGlobalRequestInterceptor(fn) {
27
- _oktaIdxJs.default.client.interceptors.request.use(fn);
32
+ _idxJs.default.client.interceptors.request.use(fn);
33
+ }
34
+
35
+ function clearGlobalRequestInterceptor() {
36
+ _idxJs.default.client.interceptors.request.clear();
28
37
  } // A factory which returns a function that can be passed to `setGlobalRequestInterceptor`
29
38
 
30
39
 
@@ -33,9 +42,16 @@ function createGlobalRequestInterceptor(sdk) {
33
42
  // Set user-agent and any other custom headers set in the options
34
43
  var oktaUserAgentHeader = sdk._oktaUserAgent.getHttpHeader();
35
44
 
36
- const headers = Object.assign({ ...oktaUserAgentHeader
45
+ const headers = (0, _assign.default)({ ...oktaUserAgentHeader
37
46
  }, sdk.options.headers);
38
- Object.keys(headers).forEach(name => {
47
+ (0, _keys.default)(headers).forEach(name => {
48
+ // X-Device-Token may only be specified if the /interact request includes a `client_secret`
49
+ // which indicates a trusted client which is allowed to present this information on behalf of the end user.
50
+ // https://oktainc.atlassian.net/browse/OKTA-441021
51
+ if (!sdk.options.clientSecret && name === 'X-Device-Token') {
52
+ return;
53
+ }
54
+
39
55
  requestConfig.headers[name] = headers[name];
40
56
  });
41
57
  };