@okta/okta-auth-js 5.11.0 → 6.2.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 (421) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +63 -29
  3. package/cjs/AuthStateManager.js +15 -6
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +168 -108
  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/ServiceManager.js +195 -0
  14. package/cjs/ServiceManager.js.map +1 -0
  15. package/cjs/StorageManager.js +16 -9
  16. package/cjs/StorageManager.js.map +1 -1
  17. package/cjs/TokenManager.js +42 -34
  18. package/cjs/TokenManager.js.map +1 -1
  19. package/cjs/TransactionManager.js +26 -7
  20. package/cjs/TransactionManager.js.map +1 -1
  21. package/cjs/browser/browserStorage.js +36 -20
  22. package/cjs/browser/browserStorage.js.map +1 -1
  23. package/cjs/browser/fingerprint.js +12 -4
  24. package/cjs/browser/fingerprint.js.map +1 -1
  25. package/cjs/builderUtil.js +7 -19
  26. package/cjs/builderUtil.js.map +1 -1
  27. package/cjs/clock.js +5 -1
  28. package/cjs/clock.js.map +1 -1
  29. package/cjs/crypto/base64.js +18 -0
  30. package/cjs/crypto/base64.js.map +1 -1
  31. package/cjs/crypto/index.js +6 -4
  32. package/cjs/crypto/index.js.map +1 -1
  33. package/cjs/crypto/node.js +19 -13
  34. package/cjs/crypto/node.js.map +1 -1
  35. package/cjs/crypto/oidcHash.js +5 -1
  36. package/cjs/crypto/oidcHash.js.map +1 -1
  37. package/cjs/crypto/webauthn.js +101 -0
  38. package/cjs/crypto/webauthn.js.map +1 -0
  39. package/cjs/crypto/webcrypto.js +3 -1
  40. package/cjs/crypto/webcrypto.js.map +1 -1
  41. package/cjs/errors/AuthApiError.js +1 -1
  42. package/cjs/errors/AuthPollStopError.js +1 -1
  43. package/cjs/errors/AuthSdkError.js +1 -1
  44. package/cjs/errors/CustomError.js +5 -1
  45. package/cjs/errors/CustomError.js.map +1 -1
  46. package/cjs/errors/OAuthError.js +1 -1
  47. package/cjs/errors/index.js +1 -1
  48. package/cjs/features.js +9 -3
  49. package/cjs/features.js.map +1 -1
  50. package/cjs/fetch/fetchRequest.js +19 -6
  51. package/cjs/fetch/fetchRequest.js.map +1 -1
  52. package/cjs/http/headers.js.map +1 -1
  53. package/cjs/http/index.js +4 -2
  54. package/cjs/http/index.js.map +1 -1
  55. package/cjs/http/request.js +11 -5
  56. package/cjs/http/request.js.map +1 -1
  57. package/cjs/idx/authenticate.js +8 -5
  58. package/cjs/idx/authenticate.js.map +1 -1
  59. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  60. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  61. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +1 -1
  62. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  63. package/cjs/idx/authenticator/SecurityQuestionVerification.js +2 -1
  64. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  65. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +2 -2
  66. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  67. package/cjs/idx/authenticator/WebauthnEnrollment.js +46 -0
  68. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -0
  69. package/cjs/idx/authenticator/WebauthnVerification.js +55 -0
  70. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -0
  71. package/cjs/idx/authenticator/getAuthenticator.js +17 -6
  72. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  73. package/cjs/idx/authenticator/index.js +34 -6
  74. package/cjs/idx/authenticator/index.js.map +1 -1
  75. package/cjs/idx/cancel.js.map +1 -1
  76. package/cjs/idx/emailVerify.js +73 -0
  77. package/cjs/idx/emailVerify.js.map +1 -0
  78. package/cjs/idx/flow/AccountUnlockFlow.js +30 -0
  79. package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -0
  80. package/cjs/idx/flow/FlowSpecification.js +24 -4
  81. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  82. package/cjs/idx/flow/PasswordRecoveryFlow.js +4 -1
  83. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  84. package/cjs/idx/flow/RegistrationFlow.js +2 -0
  85. package/cjs/idx/flow/RegistrationFlow.js.map +1 -1
  86. package/cjs/idx/flow/index.js +20 -5
  87. package/cjs/idx/flow/index.js.map +1 -1
  88. package/cjs/idx/handleInteractionCodeRedirect.js +6 -1
  89. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  90. package/cjs/idx/headers.js +21 -5
  91. package/cjs/idx/headers.js.map +1 -1
  92. package/cjs/idx/idx-js/client.js +91 -0
  93. package/cjs/idx/idx-js/client.js.map +1 -0
  94. package/cjs/idx/idx-js/index.js +162 -0
  95. package/cjs/idx/idx-js/index.js.map +1 -0
  96. package/cjs/idx/idx-js/interact.js +83 -0
  97. package/cjs/idx/idx-js/interact.js.map +1 -0
  98. package/cjs/idx/idx-js/introspect.js +58 -0
  99. package/cjs/idx/idx-js/introspect.js.map +1 -0
  100. package/cjs/idx/idx-js/parsers.js +41 -0
  101. package/cjs/idx/idx-js/parsers.js.map +1 -0
  102. package/cjs/idx/idx-js/util.js +34 -0
  103. package/cjs/idx/idx-js/util.js.map +1 -0
  104. package/cjs/idx/idx-js/v1/actionParser.js +90 -0
  105. package/cjs/idx/idx-js/v1/actionParser.js.map +1 -0
  106. package/cjs/idx/idx-js/v1/generateIdxAction.js +117 -0
  107. package/cjs/idx/idx-js/v1/generateIdxAction.js.map +1 -0
  108. package/cjs/idx/idx-js/v1/idxResponseParser.js +137 -0
  109. package/cjs/idx/idx-js/v1/idxResponseParser.js.map +1 -0
  110. package/cjs/idx/idx-js/v1/makeIdxState.js +64 -0
  111. package/cjs/idx/idx-js/v1/makeIdxState.js.map +1 -0
  112. package/cjs/idx/idx-js/v1/parsers.js +24 -0
  113. package/cjs/idx/idx-js/v1/parsers.js.map +1 -0
  114. package/cjs/idx/idx-js/v1/remediationParser.js +32 -0
  115. package/cjs/idx/idx-js/v1/remediationParser.js.map +1 -0
  116. package/cjs/idx/index.js +121 -109
  117. package/cjs/idx/index.js.map +1 -1
  118. package/cjs/idx/interact.js +53 -36
  119. package/cjs/idx/interact.js.map +1 -1
  120. package/cjs/idx/introspect.js +17 -19
  121. package/cjs/idx/introspect.js.map +1 -1
  122. package/cjs/idx/poll.js +13 -3
  123. package/cjs/idx/poll.js.map +1 -1
  124. package/cjs/idx/proceed.js +4 -7
  125. package/cjs/idx/proceed.js.map +1 -1
  126. package/cjs/idx/recoverPassword.js +1 -1
  127. package/cjs/idx/recoverPassword.js.map +1 -1
  128. package/cjs/idx/register.js +11 -16
  129. package/cjs/idx/register.js.map +1 -1
  130. package/cjs/idx/remediate.js +74 -27
  131. package/cjs/idx/remediate.js.map +1 -1
  132. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +12 -4
  133. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  134. package/cjs/idx/remediators/AuthenticatorVerificationData.js +52 -9
  135. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  136. package/cjs/idx/remediators/Base/AuthenticatorData.js +31 -13
  137. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  138. package/cjs/idx/remediators/Base/Remediator.js +67 -31
  139. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  140. package/cjs/idx/remediators/Base/SelectAuthenticator.js +46 -30
  141. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  142. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +16 -4
  143. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  144. package/cjs/idx/remediators/ChallengeAuthenticator.js +2 -2
  145. package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
  146. package/cjs/idx/remediators/ChallengePoll.js +2 -2
  147. package/cjs/idx/remediators/EnrollAuthenticator.js +2 -2
  148. package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
  149. package/cjs/idx/remediators/EnrollPoll.js +18 -9
  150. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  151. package/cjs/idx/remediators/EnrollProfile.js +24 -9
  152. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  153. package/cjs/idx/remediators/EnrollmentChannelData.js +96 -0
  154. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -0
  155. package/cjs/idx/remediators/Identify.js +5 -3
  156. package/cjs/idx/remediators/Identify.js.map +1 -1
  157. package/cjs/idx/remediators/ReEnrollAuthenticator.js +6 -3
  158. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  159. package/cjs/idx/remediators/RedirectIdp.js +2 -2
  160. package/cjs/idx/remediators/ResetAuthenticator.js +2 -2
  161. package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
  162. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +7 -5
  163. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  164. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js +2 -2
  165. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
  166. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +72 -0
  167. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -0
  168. package/cjs/idx/remediators/SelectEnrollProfile.js +2 -2
  169. package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
  170. package/cjs/idx/remediators/SelectEnrollmentChannel.js +86 -0
  171. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -0
  172. package/cjs/idx/remediators/Skip.js +5 -3
  173. package/cjs/idx/remediators/Skip.js.map +1 -1
  174. package/cjs/idx/remediators/index.js +57 -16
  175. package/cjs/idx/remediators/index.js.map +1 -1
  176. package/cjs/idx/remediators/util.js +18 -3
  177. package/cjs/idx/remediators/util.js.map +1 -1
  178. package/cjs/idx/run.js +145 -49
  179. package/cjs/idx/run.js.map +1 -1
  180. package/cjs/idx/startTransaction.js +4 -2
  181. package/cjs/idx/startTransaction.js.map +1 -1
  182. package/cjs/idx/transactionMeta.js +82 -69
  183. package/cjs/idx/transactionMeta.js.map +1 -1
  184. package/cjs/idx/types/idx-js.js.map +1 -1
  185. package/cjs/idx/types/index.js +59 -7
  186. package/cjs/idx/types/index.js.map +1 -1
  187. package/cjs/idx/unlockAccount.js +48 -0
  188. package/cjs/idx/unlockAccount.js.map +1 -0
  189. package/cjs/index.js +33 -13
  190. package/cjs/index.js.map +1 -1
  191. package/cjs/oidc/endpoints/authorize.js +10 -2
  192. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  193. package/cjs/oidc/endpoints/index.js +5 -3
  194. package/cjs/oidc/endpoints/index.js.map +1 -1
  195. package/cjs/oidc/endpoints/token.js +16 -3
  196. package/cjs/oidc/endpoints/token.js.map +1 -1
  197. package/cjs/oidc/endpoints/well-known.js +7 -3
  198. package/cjs/oidc/endpoints/well-known.js.map +1 -1
  199. package/cjs/oidc/exchangeCodeForTokens.js +12 -4
  200. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  201. package/cjs/oidc/getToken.js +12 -6
  202. package/cjs/oidc/getToken.js.map +1 -1
  203. package/cjs/oidc/getUserInfo.js +7 -3
  204. package/cjs/oidc/getUserInfo.js.map +1 -1
  205. package/cjs/oidc/getWithPopup.js +8 -2
  206. package/cjs/oidc/getWithPopup.js.map +1 -1
  207. package/cjs/oidc/getWithRedirect.js +15 -38
  208. package/cjs/oidc/getWithRedirect.js.map +1 -1
  209. package/cjs/oidc/getWithoutPrompt.js +8 -2
  210. package/cjs/oidc/getWithoutPrompt.js.map +1 -1
  211. package/cjs/oidc/handleOAuthResponse.js +87 -87
  212. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  213. package/cjs/oidc/index.js +4 -2
  214. package/cjs/oidc/index.js.map +1 -1
  215. package/cjs/oidc/parseFromUrl.js +9 -3
  216. package/cjs/oidc/parseFromUrl.js.map +1 -1
  217. package/cjs/oidc/renewToken.js.map +1 -1
  218. package/cjs/oidc/renewTokens.js +6 -2
  219. package/cjs/oidc/renewTokens.js.map +1 -1
  220. package/cjs/oidc/renewTokensWithRefresh.js +5 -1
  221. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  222. package/cjs/oidc/revokeToken.js +34 -31
  223. package/cjs/oidc/revokeToken.js.map +1 -1
  224. package/cjs/oidc/util/browser.js +5 -1
  225. package/cjs/oidc/util/browser.js.map +1 -1
  226. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  227. package/cjs/oidc/util/errors.js.map +1 -1
  228. package/cjs/oidc/util/index.js +27 -11
  229. package/cjs/oidc/util/index.js.map +1 -1
  230. package/cjs/oidc/util/loginRedirect.js +10 -1
  231. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  232. package/cjs/oidc/util/oauth.js +4 -2
  233. package/cjs/oidc/util/oauth.js.map +1 -1
  234. package/cjs/oidc/util/oauthMeta.js +36 -0
  235. package/cjs/oidc/util/oauthMeta.js.map +1 -0
  236. package/cjs/oidc/util/pkce.js +11 -3
  237. package/cjs/oidc/util/pkce.js.map +1 -1
  238. package/cjs/oidc/util/prepareTokenParams.js +62 -39
  239. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  240. package/cjs/oidc/util/validateClaims.js +3 -1
  241. package/cjs/oidc/util/validateClaims.js.map +1 -1
  242. package/cjs/oidc/verifyToken.js +13 -4
  243. package/cjs/oidc/verifyToken.js.map +1 -1
  244. package/cjs/options/browser.js +81 -0
  245. package/cjs/options/browser.js.map +1 -0
  246. package/cjs/options/index.js +94 -0
  247. package/cjs/options/index.js.map +1 -0
  248. package/cjs/options/node.js +46 -0
  249. package/cjs/options/node.js.map +1 -0
  250. package/cjs/server/serverStorage.js +9 -5
  251. package/cjs/server/serverStorage.js.map +1 -1
  252. package/cjs/services/AutoRenewService.js +94 -0
  253. package/cjs/services/AutoRenewService.js.map +1 -0
  254. package/cjs/services/SyncStorageService.js +93 -0
  255. package/cjs/services/SyncStorageService.js.map +1 -0
  256. package/cjs/services/index.js +30 -0
  257. package/cjs/services/index.js.map +1 -0
  258. package/cjs/tx/AuthTransaction.js +18 -9
  259. package/cjs/tx/AuthTransaction.js.map +1 -1
  260. package/cjs/tx/TransactionState.js +0 -17
  261. package/cjs/tx/TransactionState.js.map +1 -1
  262. package/cjs/tx/api.js +11 -6
  263. package/cjs/tx/api.js.map +1 -1
  264. package/cjs/tx/index.js +7 -5
  265. package/cjs/tx/index.js.map +1 -1
  266. package/cjs/tx/poll.js +6 -4
  267. package/cjs/tx/poll.js.map +1 -1
  268. package/cjs/tx/util.js +5 -1
  269. package/cjs/tx/util.js.map +1 -1
  270. package/cjs/types/Service.js +2 -0
  271. package/cjs/types/Service.js.map +1 -0
  272. package/cjs/types/Transaction.js +10 -2
  273. package/cjs/types/Transaction.js.map +1 -1
  274. package/cjs/types/index.js +29 -14
  275. package/cjs/types/index.js.map +1 -1
  276. package/cjs/util/index.js +7 -18
  277. package/cjs/util/index.js.map +1 -1
  278. package/cjs/util/misc.js +5 -1
  279. package/cjs/util/misc.js.map +1 -1
  280. package/cjs/util/object.js +16 -6
  281. package/cjs/util/object.js.map +1 -1
  282. package/cjs/util/sharedStorage.js +5 -1
  283. package/cjs/util/sharedStorage.js.map +1 -1
  284. package/cjs/util/url.js.map +1 -1
  285. package/dist/okta-auth-js.min.js +1 -1
  286. package/dist/okta-auth-js.min.js.LICENSE.txt +0 -20
  287. package/dist/okta-auth-js.min.js.map +1 -1
  288. package/dist/okta-auth-js.polyfill.js +1 -1
  289. package/dist/okta-auth-js.polyfill.js.map +1 -1
  290. package/dist/okta-auth-js.umd.js +1 -1
  291. package/dist/okta-auth-js.umd.js.LICENSE.txt +1 -19
  292. package/dist/okta-auth-js.umd.js.map +1 -1
  293. package/esm/{index.js → esm.browser.js} +3283 -2698
  294. package/esm/esm.browser.js.map +1 -0
  295. package/esm/esm.node.mjs +9277 -0
  296. package/esm/esm.node.mjs.map +1 -0
  297. package/lib/AuthStateManager.d.ts +2 -5
  298. package/lib/OktaAuth.d.ts +14 -16
  299. package/lib/ServiceManager.d.ts +38 -0
  300. package/lib/StorageManager.d.ts +2 -2
  301. package/lib/TokenManager.d.ts +4 -5
  302. package/lib/TransactionManager.d.ts +4 -3
  303. package/lib/browser/fingerprint.d.ts +2 -3
  304. package/lib/builderUtil.d.ts +1 -2
  305. package/lib/crypto/base64.d.ts +2 -0
  306. package/lib/crypto/browser.d.ts +1 -1
  307. package/lib/crypto/webauthn.d.ts +25 -0
  308. package/lib/features.d.ts +1 -1
  309. package/lib/http/headers.d.ts +2 -2
  310. package/lib/http/request.d.ts +4 -4
  311. package/lib/idx/authenticate.d.ts +2 -2
  312. package/lib/idx/authenticator/Authenticator.d.ts +4 -5
  313. package/lib/idx/authenticator/OktaPassword.d.ts +7 -9
  314. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +9 -8
  315. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +7 -7
  316. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +6 -2
  317. package/lib/idx/authenticator/WebauthnEnrollment.d.ts +16 -0
  318. package/lib/idx/authenticator/WebauthnVerification.d.ts +17 -0
  319. package/lib/idx/authenticator/getAuthenticator.d.ts +1 -1
  320. package/lib/idx/authenticator/index.d.ts +9 -0
  321. package/lib/idx/cancel.d.ts +2 -2
  322. package/lib/idx/emailVerify.d.ts +26 -0
  323. package/lib/{util/emailVerify.d.ts → idx/flow/AccountUnlockFlow.d.ts} +2 -6
  324. package/lib/idx/flow/FlowSpecification.d.ts +3 -2
  325. package/lib/idx/flow/index.d.ts +1 -0
  326. package/lib/idx/headers.d.ts +3 -2
  327. package/lib/idx/idx-js/client.d.ts +36 -0
  328. package/lib/idx/idx-js/index.d.ts +51 -0
  329. package/lib/idx/idx-js/interact.d.ts +25 -0
  330. package/lib/idx/idx-js/introspect.d.ts +20 -0
  331. package/lib/idx/idx-js/parsers.d.ts +15 -0
  332. package/lib/idx/idx-js/util.d.ts +12 -0
  333. package/lib/idx/idx-js/v1/actionParser.d.ts +16 -0
  334. package/lib/idx/idx-js/v1/generateIdxAction.d.ts +13 -0
  335. package/lib/idx/idx-js/v1/idxResponseParser.d.ts +20 -0
  336. package/lib/idx/idx-js/v1/makeIdxState.d.ts +13 -0
  337. package/lib/idx/idx-js/v1/parsers.d.ts +16 -0
  338. package/lib/idx/idx-js/v1/remediationParser.d.ts +12 -0
  339. package/lib/idx/index.d.ts +12 -10
  340. package/lib/idx/interact.d.ts +7 -13
  341. package/lib/idx/introspect.d.ts +4 -3
  342. package/lib/idx/poll.d.ts +2 -2
  343. package/lib/idx/proceed.d.ts +8 -5
  344. package/lib/idx/recoverPassword.d.ts +2 -2
  345. package/lib/idx/register.d.ts +2 -2
  346. package/lib/idx/remediate.d.ts +10 -4
  347. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +3 -3
  348. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +5 -5
  349. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +10 -10
  350. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +10 -7
  351. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +8 -12
  352. package/lib/idx/remediators/EnrollProfile.d.ts +1 -1
  353. package/lib/idx/remediators/EnrollmentChannelData.d.ts +54 -0
  354. package/lib/idx/remediators/Identify.d.ts +2 -2
  355. package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -2
  356. package/lib/idx/remediators/RedirectIdp.d.ts +3 -3
  357. package/lib/idx/remediators/SelectAuthenticatorUnlockAccount.d.ts +38 -0
  358. package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +40 -0
  359. package/lib/idx/remediators/index.d.ts +3 -0
  360. package/lib/idx/remediators/util.d.ts +2 -2
  361. package/lib/idx/run.d.ts +5 -3
  362. package/lib/idx/startTransaction.d.ts +3 -2
  363. package/lib/idx/transactionMeta.d.ts +10 -31
  364. package/lib/idx/types/FlowIdentifier.d.ts +1 -1
  365. package/lib/idx/types/idx-js.d.ts +44 -1
  366. package/lib/idx/types/index.d.ts +36 -9
  367. package/lib/idx/unlockAccount.d.ts +15 -0
  368. package/lib/index.d.ts +1 -0
  369. package/lib/oidc/endpoints/well-known.d.ts +3 -3
  370. package/lib/oidc/exchangeCodeForTokens.d.ts +14 -2
  371. package/lib/oidc/getToken.d.ts +2 -2
  372. package/lib/oidc/getWithPopup.d.ts +2 -2
  373. package/lib/oidc/getWithRedirect.d.ts +2 -2
  374. package/lib/oidc/getWithoutPrompt.d.ts +2 -2
  375. package/lib/oidc/handleOAuthResponse.d.ts +2 -2
  376. package/lib/oidc/parseFromUrl.d.ts +1 -1
  377. package/lib/oidc/renewToken.d.ts +2 -2
  378. package/lib/oidc/renewTokens.d.ts +1 -1
  379. package/lib/oidc/renewTokensWithRefresh.d.ts +2 -2
  380. package/lib/oidc/revokeToken.d.ts +2 -2
  381. package/lib/oidc/util/browser.d.ts +3 -3
  382. package/lib/oidc/util/defaultTokenParams.d.ts +2 -2
  383. package/lib/oidc/util/errors.d.ts +2 -2
  384. package/lib/oidc/util/index.d.ts +1 -0
  385. package/lib/oidc/util/loginRedirect.d.ts +4 -4
  386. package/lib/oidc/util/oauth.d.ts +4 -11
  387. package/lib/oidc/util/oauthMeta.d.ts +2 -0
  388. package/lib/oidc/util/prepareTokenParams.d.ts +5 -2
  389. package/lib/oidc/util/validateClaims.d.ts +2 -2
  390. package/lib/oidc/verifyToken.d.ts +2 -2
  391. package/lib/options/browser.d.ts +16 -0
  392. package/lib/{options.d.ts → options/index.d.ts} +1 -1
  393. package/lib/options/node.d.ts +16 -0
  394. package/lib/server/serverStorage.d.ts +1 -1
  395. package/lib/services/AutoRenewService.d.ts +27 -0
  396. package/lib/services/{TokenService.d.ts → SyncStorageService.d.ts} +8 -5
  397. package/lib/services/index.d.ts +13 -0
  398. package/lib/tx/AuthTransaction.d.ts +2 -2
  399. package/lib/tx/TransactionState.d.ts +11 -1
  400. package/lib/tx/api.d.ts +6 -6
  401. package/lib/types/OktaAuthOptions.d.ts +11 -8
  402. package/lib/types/Service.d.ts +23 -0
  403. package/lib/types/Storage.d.ts +3 -3
  404. package/lib/types/Transaction.d.ts +10 -7
  405. package/lib/types/UserClaims.d.ts +3 -3
  406. package/lib/types/api.d.ts +49 -22
  407. package/lib/types/index.d.ts +1 -1
  408. package/lib/util/console.d.ts +1 -1
  409. package/lib/util/index.d.ts +0 -1
  410. package/lib/util/sharedStorage.d.ts +1 -1
  411. package/lib/util/types.d.ts +1 -1
  412. package/lib/util/url.d.ts +2 -2
  413. package/package.json +30 -13
  414. package/polyfill/index.js +1 -0
  415. package/cjs/options.js +0 -154
  416. package/cjs/options.js.map +0 -1
  417. package/cjs/services/TokenService.js +0 -108
  418. package/cjs/services/TokenService.js.map +0 -1
  419. package/cjs/util/emailVerify.js +0 -28
  420. package/cjs/util/emailVerify.js.map +0 -1
  421. package/esm/index.js.map +0 -1
package/cjs/options.js DELETED
@@ -1,154 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- exports.getDefaultOptions = getDefaultOptions;
6
- exports.buildOptions = buildOptions;
7
-
8
- var _util = require("./util");
9
-
10
- var _builderUtil = require("./builderUtil");
11
-
12
- var _fetchRequest = _interopRequireDefault(require("./fetch/fetchRequest"));
13
-
14
- var _browserStorage = _interopRequireDefault(require("./browser/browserStorage"));
15
-
16
- var _serverStorage = _interopRequireDefault(require("./server/serverStorage"));
17
-
18
- var _features = require("./features");
19
-
20
- /*!
21
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
22
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
23
- *
24
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
25
- * Unless required by applicable law or agreed to in writing, software
26
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
27
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
- *
29
- * See the License for the specific language governing permissions and limitations under the License.
30
- */
31
-
32
- /* eslint-disable complexity */
33
- const BROWSER_STORAGE = {
34
- token: {
35
- storageTypes: ['localStorage', 'sessionStorage', 'cookie'],
36
- useMultipleCookies: true
37
- },
38
- cache: {
39
- storageTypes: ['localStorage', 'sessionStorage', 'cookie']
40
- },
41
- transaction: {
42
- storageTypes: ['sessionStorage', 'localStorage', 'cookie']
43
- },
44
- 'shared-transaction': {
45
- storageTypes: ['localStorage']
46
- },
47
- 'original-uri': {
48
- storageTypes: ['localStorage']
49
- }
50
- };
51
- const SERVER_STORAGE = {
52
- token: {
53
- storageTypes: ['memory']
54
- },
55
- cache: {
56
- storageTypes: ['memory']
57
- },
58
- transaction: {
59
- storageTypes: ['memory']
60
- }
61
- };
62
-
63
- function getCookieSettings(args = {}, isHTTPS) {
64
- // Secure cookies will be automatically used on a HTTPS connection
65
- // Non-secure cookies will be automatically used on a HTTP connection
66
- // secure option can override the automatic behavior
67
- var cookieSettings = args.cookies || {};
68
-
69
- if (typeof cookieSettings.secure === 'undefined') {
70
- cookieSettings.secure = isHTTPS;
71
- }
72
-
73
- if (typeof cookieSettings.sameSite === 'undefined') {
74
- cookieSettings.sameSite = cookieSettings.secure ? 'none' : 'lax';
75
- } // If secure=true, but the connection is not HTTPS, set secure=false.
76
-
77
-
78
- if (cookieSettings.secure && !isHTTPS) {
79
- // eslint-disable-next-line no-console
80
- (0, _util.warn)('The current page is not being served with the HTTPS protocol.\n' + 'For security reasons, we strongly recommend using HTTPS.\n' + 'If you cannot use HTTPS, set "cookies.secure" option to false.');
81
- cookieSettings.secure = false;
82
- } // Chrome >= 80 will block cookies with SameSite=None unless they are also Secure
83
- // If sameSite=none, but the connection is not HTTPS, set sameSite=lax.
84
-
85
-
86
- if (cookieSettings.sameSite === 'none' && !cookieSettings.secure) {
87
- cookieSettings.sameSite = 'lax';
88
- }
89
-
90
- return cookieSettings;
91
- }
92
-
93
- function getDefaultOptions() {
94
- const storageUtil = (0, _features.isBrowser)() ? _browserStorage.default : _serverStorage.default;
95
- const storageManager = (0, _features.isBrowser)() ? BROWSER_STORAGE : SERVER_STORAGE;
96
- const enableSharedStorage = (0, _features.isBrowser)() ? true : false; // localStorage for multi-tab flows (browser only)
97
-
98
- return {
99
- devMode: false,
100
- httpRequestClient: _fetchRequest.default,
101
- storageUtil,
102
- storageManager,
103
- transactionManager: {
104
- enableSharedStorage
105
- }
106
- };
107
- }
108
-
109
- function mergeOptions(options, args) {
110
- return Object.assign({}, options, (0, _util.removeNils)(args), {
111
- storageManager: Object.assign({}, options.storageManager, args.storageManager),
112
- transactionManager: Object.assign({}, options.transactionManager, args.transactionManager)
113
- });
114
- }
115
-
116
- function buildOptions(args = {}) {
117
- (0, _builderUtil.assertValidConfig)(args);
118
- args = mergeOptions(getDefaultOptions(), args);
119
- return (0, _util.removeNils)({
120
- // OIDC configuration
121
- issuer: (0, _util.removeTrailingSlash)(args.issuer),
122
- tokenUrl: (0, _util.removeTrailingSlash)(args.tokenUrl),
123
- authorizeUrl: (0, _util.removeTrailingSlash)(args.authorizeUrl),
124
- userinfoUrl: (0, _util.removeTrailingSlash)(args.userinfoUrl),
125
- revokeUrl: (0, _util.removeTrailingSlash)(args.revokeUrl),
126
- logoutUrl: (0, _util.removeTrailingSlash)(args.logoutUrl),
127
- clientId: args.clientId,
128
- redirectUri: args.redirectUri,
129
- state: args.state,
130
- scopes: args.scopes,
131
- postLogoutRedirectUri: args.postLogoutRedirectUri,
132
- responseMode: args.responseMode,
133
- responseType: args.responseType,
134
- pkce: args.pkce === false ? false : true,
135
- // PKCE defaults to true
136
- useInteractionCodeFlow: args.useInteractionCodeFlow,
137
- // Internal options
138
- httpRequestClient: args.httpRequestClient,
139
- transformErrorXHR: args.transformErrorXHR,
140
- transformAuthState: args.transformAuthState,
141
- restoreOriginalUri: args.restoreOriginalUri,
142
- storageUtil: args.storageUtil,
143
- headers: args.headers,
144
- devMode: !!args.devMode,
145
- storageManager: args.storageManager,
146
- transactionManager: args.transactionManager,
147
- cookies: (0, _features.isBrowser)() ? getCookieSettings(args, (0, _features.isHTTPS)()) : args.cookies,
148
- // Give the developer the ability to disable token signature validation.
149
- ignoreSignature: !!args.ignoreSignature,
150
- // Server-side web applications
151
- clientSecret: args.clientSecret
152
- });
153
- }
154
- //# sourceMappingURL=options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../lib/options.ts"],"names":["BROWSER_STORAGE","token","storageTypes","useMultipleCookies","cache","transaction","SERVER_STORAGE","getCookieSettings","args","isHTTPS","cookieSettings","cookies","secure","sameSite","getDefaultOptions","storageUtil","browserStorage","serverStorage","storageManager","enableSharedStorage","devMode","httpRequestClient","fetchRequest","transactionManager","mergeOptions","options","Object","assign","buildOptions","issuer","tokenUrl","authorizeUrl","userinfoUrl","revokeUrl","logoutUrl","clientId","redirectUri","state","scopes","postLogoutRedirectUri","responseMode","responseType","pkce","useInteractionCodeFlow","transformErrorXHR","transformAuthState","restoreOriginalUri","headers","ignoreSignature","clientSecret"],"mappings":";;;;;;;AAcA;;AACA;;AAGA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AAUA,MAAMA,eAAsC,GAAG;AAC7CC,EAAAA,KAAK,EAAE;AACLC,IAAAA,YAAY,EAAE,CACZ,cADY,EAEZ,gBAFY,EAGZ,QAHY,CADT;AAMLC,IAAAA,kBAAkB,EAAE;AANf,GADsC;AAS7CC,EAAAA,KAAK,EAAE;AACLF,IAAAA,YAAY,EAAE,CACZ,cADY,EAEZ,gBAFY,EAGZ,QAH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,iBAAiB,CAACC,IAAD,EAAO,wBAAP,CAA/B,GAAmDA,IAAI,CAACG,OA5BjD;AA8BhB;AACAqC,IAAAA,eAAe,EAAE,CAAC,CAACxC,IAAI,CAACwC,eA/BR;AAiChB;AACAC,IAAAA,YAAY,EAAEzC,IAAI,CAACyC;AAlCH,GAAX,CAAP;AAoCD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n/* eslint-disable complexity */\nimport { removeTrailingSlash, warn, removeNils } from './util';\nimport { assertValidConfig } from './builderUtil';\nimport { OktaAuthOptions, StorageManagerOptions } from './types';\n\nimport fetchRequest from './fetch/fetchRequest';\nimport browserStorage from './browser/browserStorage';\nimport serverStorage from './server/serverStorage';\nimport { isBrowser, isHTTPS } from './features';\n\nconst BROWSER_STORAGE: StorageManagerOptions = {\n token: {\n storageTypes: [\n 'localStorage',\n 'sessionStorage',\n 'cookie'\n ],\n useMultipleCookies: true\n },\n cache: {\n storageTypes: [\n 'localStorage',\n 'sessionStorage',\n 'cookie'\n ]\n },\n transaction: {\n storageTypes: [\n 'sessionStorage',\n 'localStorage',\n 'cookie'\n ]\n },\n 'shared-transaction': {\n storageTypes: [\n 'localStorage'\n ]\n },\n 'original-uri': {\n storageTypes: [\n 'localStorage'\n ]\n }\n};\n\nconst SERVER_STORAGE: StorageManagerOptions = {\n token: {\n storageTypes: [\n 'memory'\n ]\n },\n cache: {\n storageTypes: [\n 'memory'\n ]\n },\n transaction: {\n storageTypes: [\n 'memory'\n ]\n }\n};\n\nfunction getCookieSettings(args: OktaAuthOptions = {}, isHTTPS: boolean) {\n // Secure cookies will be automatically used on a HTTPS connection\n // Non-secure cookies will be automatically used on a HTTP connection\n // secure option can override the automatic behavior\n var cookieSettings = args.cookies || {};\n if (typeof cookieSettings.secure === 'undefined') {\n cookieSettings.secure = isHTTPS;\n }\n if (typeof cookieSettings.sameSite === 'undefined') {\n cookieSettings.sameSite = cookieSettings.secure ? 'none' : 'lax';\n }\n\n // If secure=true, but the connection is not HTTPS, set secure=false.\n if (cookieSettings.secure && !isHTTPS) {\n // eslint-disable-next-line no-console\n warn(\n 'The current page is not being served with the HTTPS protocol.\\n' +\n 'For security reasons, we strongly recommend using HTTPS.\\n' +\n 'If you cannot use HTTPS, set \"cookies.secure\" option to false.'\n );\n cookieSettings.secure = false;\n }\n\n // Chrome >= 80 will block cookies with SameSite=None unless they are also Secure\n // If sameSite=none, but the connection is not HTTPS, set sameSite=lax.\n if (cookieSettings.sameSite === 'none' && !cookieSettings.secure) {\n cookieSettings.sameSite = 'lax';\n }\n\n return cookieSettings;\n}\n\n\nexport function getDefaultOptions(): OktaAuthOptions {\n const storageUtil = isBrowser() ? browserStorage : serverStorage;\n const storageManager = isBrowser() ? BROWSER_STORAGE : SERVER_STORAGE;\n const enableSharedStorage = isBrowser() ? true : false; // localStorage for multi-tab flows (browser only)\n return {\n devMode: false,\n httpRequestClient: fetchRequest,\n storageUtil,\n storageManager,\n transactionManager: {\n enableSharedStorage\n }\n };\n}\n\nfunction mergeOptions(options, args): OktaAuthOptions {\n return Object.assign({}, options, removeNils(args), {\n storageManager: Object.assign({}, options.storageManager, args.storageManager),\n transactionManager: Object.assign({}, options.transactionManager, args.transactionManager),\n });\n}\n\nexport function buildOptions(args: OktaAuthOptions = {}): OktaAuthOptions {\n assertValidConfig(args);\n args = mergeOptions(getDefaultOptions(), args);\n return removeNils({\n // OIDC configuration\n issuer: removeTrailingSlash(args.issuer),\n tokenUrl: removeTrailingSlash(args.tokenUrl),\n authorizeUrl: removeTrailingSlash(args.authorizeUrl),\n userinfoUrl: removeTrailingSlash(args.userinfoUrl),\n revokeUrl: removeTrailingSlash(args.revokeUrl),\n logoutUrl: removeTrailingSlash(args.logoutUrl),\n clientId: args.clientId,\n redirectUri: args.redirectUri,\n state: args.state,\n scopes: args.scopes,\n postLogoutRedirectUri: args.postLogoutRedirectUri,\n responseMode: args.responseMode,\n responseType: args.responseType,\n pkce: args.pkce === false ? false : true, // PKCE defaults to true\n useInteractionCodeFlow: args.useInteractionCodeFlow,\n\n // Internal options\n httpRequestClient: args.httpRequestClient,\n transformErrorXHR: args.transformErrorXHR,\n transformAuthState: args.transformAuthState,\n restoreOriginalUri: args.restoreOriginalUri,\n storageUtil: args.storageUtil,\n headers: args.headers,\n devMode: !!args.devMode,\n storageManager: args.storageManager,\n transactionManager: args.transactionManager,\n cookies: isBrowser() ? getCookieSettings(args, isHTTPS()) : args.cookies,\n\n // Give the developer the ability to disable token signature validation.\n ignoreSignature: !!args.ignoreSignature,\n\n // Server-side web applications\n clientSecret: args.clientSecret\n });\n}\n"],"file":"options.js"}
@@ -1,108 +0,0 @@
1
- "use strict";
2
-
3
- exports.TokenService = void 0;
4
-
5
- var _TokenManager = require("../TokenManager");
6
-
7
- var _errors = require("../errors");
8
-
9
- var _features = require("../features");
10
-
11
- /*!
12
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
13
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
14
- *
15
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- *
20
- * See the License for the specific language governing permissions and limitations under the License.
21
- */
22
-
23
- /* global window */
24
- function shouldThrottleRenew(renewTimeQueue) {
25
- let res = false;
26
- renewTimeQueue.push(Date.now());
27
-
28
- if (renewTimeQueue.length >= 10) {
29
- // get and remove first item from queue
30
- const firstTime = renewTimeQueue.shift();
31
- const lastTime = renewTimeQueue[renewTimeQueue.length - 1];
32
- res = lastTime - firstTime < 30 * 1000;
33
- }
34
-
35
- return res;
36
- }
37
-
38
- class TokenService {
39
- constructor(tokenManager, options = {}) {
40
- this.tokenManager = tokenManager;
41
- this.options = options;
42
- }
43
-
44
- start() {
45
- const renewTimeQueue = [];
46
-
47
- this.onTokenExpiredHandler = key => {
48
- if (this.options.autoRenew) {
49
- if (shouldThrottleRenew(renewTimeQueue)) {
50
- const error = new _errors.AuthSdkError('Too many token renew requests');
51
- this.tokenManager.emitError(error);
52
- } else {
53
- this.tokenManager.renew(key).catch(() => {}); // Renew errors will emit an "error" event
54
- }
55
- } else if (this.options.autoRemove) {
56
- this.tokenManager.remove(key);
57
- }
58
- };
59
-
60
- this.tokenManager.on(_TokenManager.EVENT_EXPIRED, this.onTokenExpiredHandler);
61
- this.tokenManager.setExpireEventTimeoutAll();
62
-
63
- if (this.options.syncStorage && (0, _features.isBrowser)()) {
64
- // Sync authState cross multiple tabs when localStorage is used as the storageProvider
65
- // A StorageEvent is sent to a window when a storage area it has access to is changed
66
- // within the context of another document.
67
- // https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent
68
- this.storageListener = ({
69
- key,
70
- newValue,
71
- oldValue
72
- }) => {
73
- const handleCrossTabsStorageChange = () => {
74
- this.tokenManager.resetExpireEventTimeoutAll();
75
- this.tokenManager.emitEventsForCrossTabsStorageUpdate(newValue, oldValue);
76
- }; // Skip if:
77
- // not from localStorage.clear (event.key is null)
78
- // event.key is not the storageKey
79
- // oldValue === newValue
80
-
81
-
82
- if (key && (key !== this.options.storageKey || newValue === oldValue)) {
83
- return;
84
- } // LocalStorage cross tabs update is not synced in IE, set a 1s timer by default to read latest value
85
- // https://stackoverflow.com/questions/24077117/localstorage-in-win8-1-ie11-does-not-synchronize
86
-
87
-
88
- this.syncTimeout = setTimeout(() => handleCrossTabsStorageChange(), this.options._storageEventDelay);
89
- };
90
-
91
- window.addEventListener('storage', this.storageListener);
92
- }
93
- }
94
-
95
- stop() {
96
- this.tokenManager.clearExpireEventTimeoutAll();
97
- this.tokenManager.off(_TokenManager.EVENT_EXPIRED, this.onTokenExpiredHandler);
98
-
99
- if (this.options.syncStorage && (0, _features.isBrowser)()) {
100
- window.removeEventListener('storage', this.storageListener);
101
- clearTimeout(this.syncTimeout);
102
- }
103
- }
104
-
105
- }
106
-
107
- exports.TokenService = TokenService;
108
- //# sourceMappingURL=TokenService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/services/TokenService.ts"],"names":["shouldThrottleRenew","renewTimeQueue","res","push","Date","now","length","firstTime","shift","lastTime","TokenService","constructor","tokenManager","options","start","onTokenExpiredHandler","key","autoRenew","error","AuthSdkError","emitError","renew","catch","autoRemove","remove","on","EVENT_EXPIRED","setExpireEventTimeoutAll","syncStorage","storageListener","newValue","oldValue","handleCrossTabsStorageChange","resetExpireEventTimeoutAll","emitEventsForCrossTabsStorageUpdate","storageKey","syncTimeout","setTimeout","_storageEventDelay","window","addEventListener","stop","clearExpireEventTimeoutAll","off","removeEventListener","clearTimeout"],"mappings":";;;;AAcA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AAMA,SAASA,mBAAT,CAA6BC,cAA7B,EAA6C;AAC3C,MAAIC,GAAG,GAAG,KAAV;AACAD,EAAAA,cAAc,CAACE,IAAf,CAAoBC,IAAI,CAACC,GAAL,EAApB;;AACA,MAAIJ,cAAc,CAACK,MAAf,IAAyB,EAA7B,EAAiC;AAC/B;AACA,UAAMC,SAAS,GAAGN,cAAc,CAACO,KAAf,EAAlB;AACA,UAAMC,QAAQ,GAAGR,cAAc,CAACA,cAAc,CAACK,MAAf,GAAwB,CAAzB,CAA/B;AACAJ,IAAAA,GAAG,GAAGO,QAAQ,GAAGF,SAAX,GAAuB,KAAK,IAAlC;AACD;;AACD,SAAOL,GAAP;AACD;;AAEM,M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KA,GAAG,KAAK,KAAKH,OAAL,CAAasB,UAArB,IAAmCL,QAAQ,KAAKC,QAArD,CAAP,EAAuE;AACrE;AACD,SAZmE,CAcpE;AACA;;;AACA,aAAKK,WAAL,GAAmBC,UAAU,CAAC,MAAML,4BAA4B,EAAnC,EAAuC,KAAKnB,OAAL,CAAayB,kBAApD,CAA7B;AACD,OAjBD;;AAmBAC,MAAAA,MAAM,CAACC,gBAAP,CAAwB,SAAxB,EAAmC,KAAKX,eAAxC;AACD;AACF;;AAEDY,EAAAA,IAAI,GAAG;AACL,SAAK7B,YAAL,CAAkB8B,0BAAlB;AACA,SAAK9B,YAAL,CAAkB+B,GAAlB,CAAsBjB,2BAAtB,EAAqC,KAAKX,qBAA1C;;AACA,QAAI,KAAKF,OAAL,CAAae,WAAb,IAA4B,0BAAhC,EAA6C;AAC3CW,MAAAA,MAAM,CAACK,mBAAP,CAA2B,SAA3B,EAAsC,KAAKf,eAA3C;AACAgB,MAAAA,YAAY,CAAC,KAAKT,WAAN,CAAZ;AACD;AACF;;AAlEuB","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n/* global window */\nimport { TokenManager, EVENT_EXPIRED } from '../TokenManager';\nimport { AuthSdkError } from '../errors';\nimport { isBrowser } from '../features';\nimport { TokenManagerOptions } from '../types';\n\nfunction shouldThrottleRenew(renewTimeQueue) {\n let res = false;\n renewTimeQueue.push(Date.now());\n if (renewTimeQueue.length >= 10) {\n // get and remove first item from queue\n const firstTime = renewTimeQueue.shift();\n const lastTime = renewTimeQueue[renewTimeQueue.length - 1];\n res = lastTime - firstTime < 30 * 1000;\n }\n return res;\n}\n\nexport class TokenService {\n private tokenManager: TokenManager;\n private options: TokenManagerOptions;\n private storageListener: (event: StorageEvent) => void;\n private onTokenExpiredHandler: (key: string) => void;\n private syncTimeout: unknown;\n\n constructor(tokenManager: TokenManager, options: TokenManagerOptions = {}) {\n this.tokenManager = tokenManager;\n this.options = options;\n }\n\n start() {\n const renewTimeQueue = [];\n this.onTokenExpiredHandler = (key) => {\n if (this.options.autoRenew) {\n if (shouldThrottleRenew(renewTimeQueue)) {\n const error = new AuthSdkError('Too many token renew requests');\n this.tokenManager.emitError(error);\n } else {\n this.tokenManager.renew(key).catch(() => {}); // Renew errors will emit an \"error\" event \n }\n } else if (this.options.autoRemove) {\n this.tokenManager.remove(key);\n }\n };\n this.tokenManager.on(EVENT_EXPIRED, this.onTokenExpiredHandler);\n\n this.tokenManager.setExpireEventTimeoutAll();\n\n if (this.options.syncStorage && isBrowser()) {\n // Sync authState cross multiple tabs when localStorage is used as the storageProvider\n // A StorageEvent is sent to a window when a storage area it has access to is changed \n // within the context of another document.\n // https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent\n\n this.storageListener = ({ key, newValue, oldValue }: StorageEvent) => {\n const handleCrossTabsStorageChange = () => {\n this.tokenManager.resetExpireEventTimeoutAll();\n this.tokenManager.emitEventsForCrossTabsStorageUpdate(newValue, oldValue);\n };\n\n // Skip if:\n // not from localStorage.clear (event.key is null)\n // event.key is not the storageKey\n // oldValue === newValue\n if (key && (key !== this.options.storageKey || newValue === oldValue)) {\n return;\n }\n\n // LocalStorage cross tabs update is not synced in IE, set a 1s timer by default to read latest value\n // https://stackoverflow.com/questions/24077117/localstorage-in-win8-1-ie11-does-not-synchronize\n this.syncTimeout = setTimeout(() => handleCrossTabsStorageChange(), this.options._storageEventDelay);\n };\n\n window.addEventListener('storage', this.storageListener);\n }\n }\n\n stop() {\n this.tokenManager.clearExpireEventTimeoutAll();\n this.tokenManager.off(EVENT_EXPIRED, this.onTokenExpiredHandler);\n if (this.options.syncStorage && isBrowser()) {\n window.removeEventListener('storage', this.storageListener);\n clearTimeout(this.syncTimeout as any);\n }\n }\n}"],"file":"TokenService.js"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- exports.isEmailVerifyCallback = isEmailVerifyCallback;
4
- exports.parseEmailVerifyCallback = parseEmailVerifyCallback;
5
-
6
- var _urlParams = require("../oidc/util/urlParams");
7
-
8
- /*!
9
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
10
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
11
- *
12
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- *
17
- * See the License for the specific language governing permissions and limitations under the License.
18
- */
19
- // Check if state && stateTokenExternalId have been passed back in the url
20
- function isEmailVerifyCallback(urlPath) {
21
- return /(stateTokenExternalId=)/i.test(urlPath) && /(state=)/i.test(urlPath);
22
- } // Parse state and stateTokenExternalId from a urlPath (should be either a search or fragment from the URL)
23
-
24
-
25
- function parseEmailVerifyCallback(urlPath) {
26
- return (0, _urlParams.urlParamsToObject)(urlPath);
27
- }
28
- //# sourceMappingURL=emailVerify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/util/emailVerify.ts"],"names":["isEmailVerifyCallback","urlPath","test","parseEmailVerifyCallback"],"mappings":";;;;;AAaA;;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACO,SAASA,qBAAT,CAAgCC,OAAhC,EAA0D;AAC/D,SAAO,2BAA2BC,IAA3B,CAAgCD,OAAhC,KAA4C,YAAYC,IAAZ,CAAiBD,OAAjB,CAAnD;AACD,C,CAED;;;AACO,SAASE,wBAAT,CAAkCF,OAAlC,EAAgF;AACrF,SAAO,kCAAkBA,OAAlB,CAAP;AACD","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 { urlParamsToObject } from '../oidc/util/urlParams';\n\nexport interface EmailVerifyCallbackResponse {\n state: string;\n stateTokenExternalId: string;\n}\n\n// Check if state && stateTokenExternalId have been passed back in the url\nexport function isEmailVerifyCallback (urlPath: string): boolean {\n return /(stateTokenExternalId=)/i.test(urlPath) && /(state=)/i.test(urlPath);\n}\n\n// Parse state and stateTokenExternalId 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"],"file":"emailVerify.js"}