@okta/okta-auth-js 5.5.0 → 5.9.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 (424) hide show
  1. package/CHANGELOG.md +66 -4
  2. package/README.md +61 -15
  3. package/cjs/AuthStateManager.js +5 -0
  4. package/cjs/AuthStateManager.js.map +1 -1
  5. package/cjs/OktaAuth.js +78 -29
  6. package/cjs/OktaAuth.js.map +1 -1
  7. package/cjs/OktaUserAgent.js +2 -2
  8. package/cjs/StorageManager.js +16 -0
  9. package/cjs/StorageManager.js.map +1 -1
  10. package/cjs/TransactionManager.js +49 -9
  11. package/cjs/TransactionManager.js.map +1 -1
  12. package/cjs/builderUtil.js +6 -0
  13. package/cjs/builderUtil.js.map +1 -1
  14. package/cjs/constants.js +5 -1
  15. package/cjs/constants.js.map +1 -1
  16. package/cjs/features.js +1 -1
  17. package/cjs/features.js.map +1 -1
  18. package/cjs/idx/authenticate.js +3 -18
  19. package/cjs/idx/authenticate.js.map +1 -1
  20. package/cjs/idx/flow/AuthenticationFlow.js +30 -0
  21. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
  22. package/cjs/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.js +0 -0
  23. package/cjs/idx/flow/AuthenticationFlowMonitor.js.map +1 -0
  24. package/cjs/idx/{flowMonitors → flow}/FlowMonitor.js +0 -0
  25. package/cjs/idx/flow/FlowMonitor.js.map +1 -0
  26. package/cjs/idx/flow/FlowSpecification.js +49 -0
  27. package/cjs/idx/flow/FlowSpecification.js.map +1 -0
  28. package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
  29. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
  30. package/cjs/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.js +0 -0
  31. package/cjs/idx/flow/PasswordRecoveryFlowMonitor.js.map +1 -0
  32. package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +15 -12
  33. package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
  34. package/cjs/idx/{flowMonitors → flow}/RegistrationFlowMonitor.js +0 -0
  35. package/cjs/idx/flow/RegistrationFlowMonitor.js.map +1 -0
  36. package/cjs/idx/flow/RemediationFlow.js +2 -0
  37. package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
  38. package/cjs/idx/flow/index.js +119 -0
  39. package/cjs/idx/flow/index.js.map +1 -0
  40. package/cjs/idx/index.js +26 -0
  41. package/cjs/idx/index.js.map +1 -1
  42. package/cjs/idx/interact.js +5 -2
  43. package/cjs/idx/interact.js.map +1 -1
  44. package/cjs/idx/introspect.js +24 -7
  45. package/cjs/idx/introspect.js.map +1 -1
  46. package/cjs/idx/proceed.js +49 -0
  47. package/cjs/idx/proceed.js.map +1 -0
  48. package/cjs/idx/recoverPassword.js +3 -17
  49. package/cjs/idx/recoverPassword.js.map +1 -1
  50. package/cjs/idx/register.js +7 -16
  51. package/cjs/idx/register.js.map +1 -1
  52. package/cjs/idx/remediate.js +46 -52
  53. package/cjs/idx/remediate.js.map +1 -1
  54. package/cjs/idx/remediators/Base/AuthenticatorData.js +7 -7
  55. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  56. package/cjs/idx/remediators/Base/Remediator.js +13 -7
  57. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  58. package/cjs/idx/remediators/Base/SelectAuthenticator.js +6 -6
  59. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  60. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +18 -14
  61. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  62. package/cjs/idx/remediators/EnrollProfile.js +14 -0
  63. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  64. package/cjs/idx/remediators/Identify.js +7 -3
  65. package/cjs/idx/remediators/Identify.js.map +1 -1
  66. package/cjs/idx/remediators/ReEnrollAuthenticator.js +1 -1
  67. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  68. package/cjs/idx/run.js +36 -8
  69. package/cjs/idx/run.js.map +1 -1
  70. package/cjs/idx/startTransaction.js +2 -0
  71. package/cjs/idx/startTransaction.js.map +1 -1
  72. package/cjs/idx/transactionMeta.js +80 -40
  73. package/cjs/idx/transactionMeta.js.map +1 -1
  74. package/cjs/idx/types/FlowIdentifier.js +2 -0
  75. package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
  76. package/cjs/idx/types/idx-js.js +5 -0
  77. package/cjs/idx/types/idx-js.js.map +1 -1
  78. package/cjs/idx/types/index.js +33 -6
  79. package/cjs/idx/types/index.js.map +1 -1
  80. package/cjs/oidc/endpoints/authorize.js +4 -1
  81. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  82. package/cjs/oidc/getToken.js +14 -9
  83. package/cjs/oidc/getToken.js.map +1 -1
  84. package/cjs/oidc/getWithPopup.js +9 -2
  85. package/cjs/oidc/getWithPopup.js.map +1 -1
  86. package/cjs/oidc/getWithRedirect.js.map +1 -1
  87. package/cjs/oidc/parseFromUrl.js +59 -20
  88. package/cjs/oidc/parseFromUrl.js.map +1 -1
  89. package/cjs/oidc/renewTokens.js +28 -5
  90. package/cjs/oidc/renewTokens.js.map +1 -1
  91. package/cjs/oidc/util/browser.js +1 -13
  92. package/cjs/oidc/util/browser.js.map +1 -1
  93. package/cjs/oidc/util/loginRedirect.js +9 -5
  94. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  95. package/cjs/oidc/util/urlParams.js +1 -1
  96. package/cjs/oidc/util/urlParams.js.map +1 -1
  97. package/cjs/options.js +15 -2
  98. package/cjs/options.js.map +1 -1
  99. package/cjs/server/serverStorage.js +2 -1
  100. package/cjs/server/serverStorage.js.map +1 -1
  101. package/cjs/tx/AuthTransaction.js +1 -3
  102. package/cjs/tx/AuthTransaction.js.map +1 -1
  103. package/cjs/tx/api.js +3 -0
  104. package/cjs/tx/api.js.map +1 -1
  105. package/cjs/types/Transaction.js.map +1 -1
  106. package/{esm/clock.js → cjs/util/emailVerify.js} +14 -18
  107. package/cjs/util/emailVerify.js.map +1 -0
  108. package/cjs/util/index.js +13 -0
  109. package/cjs/util/index.js.map +1 -1
  110. package/cjs/util/sharedStorage.js +54 -0
  111. package/cjs/util/sharedStorage.js.map +1 -0
  112. package/dist/okta-auth-js.min.js +2 -74
  113. package/dist/okta-auth-js.min.js.LICENSE.txt +32 -0
  114. package/dist/okta-auth-js.min.js.map +1 -1
  115. package/dist/okta-auth-js.polyfill.js +2 -18
  116. package/{esm/crypto/webcrypto.js → dist/okta-auth-js.polyfill.js.LICENSE.txt} +8 -4
  117. package/dist/okta-auth-js.polyfill.js.map +1 -1
  118. package/dist/okta-auth-js.umd.js +2 -74
  119. package/dist/okta-auth-js.umd.js.LICENSE.txt +32 -0
  120. package/dist/okta-auth-js.umd.js.map +1 -1
  121. package/esm/index.js +8368 -16
  122. package/esm/index.js.map +1 -1
  123. package/lib/AuthStateManager.d.ts +4 -2
  124. package/lib/OktaAuth.d.ts +9 -5
  125. package/lib/StorageManager.d.ts +2 -0
  126. package/lib/TransactionManager.d.ts +6 -1
  127. package/lib/constants.d.ts +2 -0
  128. package/lib/crypto/base64.d.ts +2 -2
  129. package/lib/crypto/oidcHash.d.ts +1 -1
  130. package/lib/crypto/verifyToken.d.ts +1 -1
  131. package/{esm/oidc/endpoints/index.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -5
  132. package/lib/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.d.ts +0 -0
  133. package/lib/idx/{flowMonitors → flow}/FlowMonitor.d.ts +0 -0
  134. package/lib/idx/flow/FlowSpecification.d.ts +10 -0
  135. package/{esm/crypto/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -6
  136. package/lib/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.d.ts +0 -0
  137. package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
  138. package/lib/idx/{flowMonitors → flow}/RegistrationFlowMonitor.d.ts +0 -0
  139. package/lib/idx/flow/RemediationFlow.d.ts +13 -0
  140. package/lib/idx/{flowMonitors → flow}/index.d.ts +7 -2
  141. package/lib/idx/index.d.ts +2 -0
  142. package/lib/idx/introspect.d.ts +2 -1
  143. package/{esm/errors/AuthApiError.js → lib/idx/proceed.d.ts} +9 -19
  144. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +2 -5
  145. package/lib/idx/remediators/Base/Remediator.d.ts +3 -6
  146. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +3 -6
  147. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +1 -1
  148. package/lib/idx/remediators/EnrollProfile.d.ts +1 -0
  149. package/lib/idx/remediators/Identify.d.ts +2 -5
  150. package/lib/idx/run.d.ts +9 -9
  151. package/lib/idx/transactionMeta.d.ts +28 -4
  152. package/lib/idx/types/FlowIdentifier.d.ts +1 -0
  153. package/lib/idx/types/idx-js.d.ts +5 -0
  154. package/lib/idx/types/index.d.ts +28 -10
  155. package/lib/oidc/getToken.d.ts +2 -2
  156. package/lib/oidc/parseFromUrl.d.ts +4 -1
  157. package/lib/oidc/renewTokens.d.ts +0 -12
  158. package/lib/oidc/util/loginRedirect.d.ts +1 -1
  159. package/lib/types/AuthState.d.ts +1 -0
  160. package/lib/types/OktaAuthOptions.d.ts +3 -1
  161. package/lib/types/Transaction.d.ts +7 -1
  162. package/lib/types/api.d.ts +21 -5
  163. package/{esm/errors/AuthPollStopError.js → lib/util/emailVerify.d.ts} +5 -8
  164. package/lib/util/index.d.ts +1 -0
  165. package/lib/util/sharedStorage.d.ts +6 -0
  166. package/package.json +26 -13
  167. package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  168. package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
  169. package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  170. package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  171. package/cjs/idx/flowMonitors/index.js +0 -54
  172. package/cjs/idx/flowMonitors/index.js.map +0 -1
  173. package/esm/AuthStateManager.js +0 -209
  174. package/esm/AuthStateManager.js.map +0 -1
  175. package/esm/OktaAuth.js +0 -665
  176. package/esm/OktaAuth.js.map +0 -1
  177. package/esm/OktaUserAgent.js +0 -49
  178. package/esm/OktaUserAgent.js.map +0 -1
  179. package/esm/PromiseQueue.js +0 -71
  180. package/esm/PromiseQueue.js.map +0 -1
  181. package/esm/SavedObject.js +0 -91
  182. package/esm/SavedObject.js.map +0 -1
  183. package/esm/StorageManager.js +0 -174
  184. package/esm/StorageManager.js.map +0 -1
  185. package/esm/TokenManager.js +0 -455
  186. package/esm/TokenManager.js.map +0 -1
  187. package/esm/TransactionManager.js +0 -289
  188. package/esm/TransactionManager.js.map +0 -1
  189. package/esm/browser/browserStorage.js +0 -256
  190. package/esm/browser/browserStorage.js.map +0 -1
  191. package/esm/browser/fingerprint.js +0 -74
  192. package/esm/browser/fingerprint.js.map +0 -1
  193. package/esm/builderUtil.js +0 -50
  194. package/esm/builderUtil.js.map +0 -1
  195. package/esm/clock.js.map +0 -1
  196. package/esm/constants.js +0 -34
  197. package/esm/constants.js.map +0 -1
  198. package/esm/crypto/base64.js +0 -66
  199. package/esm/crypto/base64.js.map +0 -1
  200. package/esm/crypto/browser.js.map +0 -1
  201. package/esm/crypto/index.js.map +0 -1
  202. package/esm/crypto/node.js +0 -54
  203. package/esm/crypto/node.js.map +0 -1
  204. package/esm/crypto/oidcHash.js +0 -27
  205. package/esm/crypto/oidcHash.js.map +0 -1
  206. package/esm/crypto/verifyToken.js +0 -39
  207. package/esm/crypto/verifyToken.js.map +0 -1
  208. package/esm/crypto/webcrypto.js.map +0 -1
  209. package/esm/errors/AuthApiError.js.map +0 -1
  210. package/esm/errors/AuthPollStopError.js.map +0 -1
  211. package/esm/errors/AuthSdkError.js +0 -29
  212. package/esm/errors/AuthSdkError.js.map +0 -1
  213. package/esm/errors/CustomError.js +0 -21
  214. package/esm/errors/CustomError.js.map +0 -1
  215. package/esm/errors/OAuthError.js +0 -22
  216. package/esm/errors/OAuthError.js.map +0 -1
  217. package/esm/errors/index.js +0 -22
  218. package/esm/errors/index.js.map +0 -1
  219. package/esm/features.js +0 -64
  220. package/esm/features.js.map +0 -1
  221. package/esm/fetch/fetchRequest.js +0 -92
  222. package/esm/fetch/fetchRequest.js.map +0 -1
  223. package/esm/http/headers.js +0 -17
  224. package/esm/http/headers.js.map +0 -1
  225. package/esm/http/index.js +0 -3
  226. package/esm/http/index.js.map +0 -1
  227. package/esm/http/request.js +0 -145
  228. package/esm/http/request.js.map +0 -1
  229. package/esm/idx/authenticate.js +0 -47
  230. package/esm/idx/authenticate.js.map +0 -1
  231. package/esm/idx/cancel.js +0 -32
  232. package/esm/idx/cancel.js.map +0 -1
  233. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
  234. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  235. package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
  236. package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
  237. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
  238. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  239. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
  240. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  241. package/esm/idx/flowMonitors/index.js +0 -16
  242. package/esm/idx/flowMonitors/index.js.map +0 -1
  243. package/esm/idx/handleInteractionCodeRedirect.js +0 -64
  244. package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
  245. package/esm/idx/headers.js +0 -39
  246. package/esm/idx/headers.js.map +0 -1
  247. package/esm/idx/index.js +0 -20
  248. package/esm/idx/index.js.map +0 -1
  249. package/esm/idx/interact.js +0 -83
  250. package/esm/idx/interact.js.map +0 -1
  251. package/esm/idx/introspect.js +0 -45
  252. package/esm/idx/introspect.js.map +0 -1
  253. package/esm/idx/recoverPassword.js +0 -46
  254. package/esm/idx/recoverPassword.js.map +0 -1
  255. package/esm/idx/register.js +0 -63
  256. package/esm/idx/register.js.map +0 -1
  257. package/esm/idx/remediate.js +0 -303
  258. package/esm/idx/remediate.js.map +0 -1
  259. package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
  260. package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
  261. package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
  262. package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
  263. package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
  264. package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
  265. package/esm/idx/remediators/Base/Remediator.js +0 -216
  266. package/esm/idx/remediators/Base/Remediator.js.map +0 -1
  267. package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
  268. package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
  269. package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -62
  270. package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
  271. package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
  272. package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
  273. package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
  274. package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
  275. package/esm/idx/remediators/EnrollProfile.js +0 -62
  276. package/esm/idx/remediators/EnrollProfile.js.map +0 -1
  277. package/esm/idx/remediators/Identify.js +0 -85
  278. package/esm/idx/remediators/Identify.js.map +0 -1
  279. package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
  280. package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
  281. package/esm/idx/remediators/RedirectIdp.js +0 -38
  282. package/esm/idx/remediators/RedirectIdp.js.map +0 -1
  283. package/esm/idx/remediators/ResetAuthenticator.js +0 -18
  284. package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
  285. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
  286. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
  287. package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
  288. package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
  289. package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
  290. package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
  291. package/esm/idx/remediators/Skip.js +0 -23
  292. package/esm/idx/remediators/Skip.js.map +0 -1
  293. package/esm/idx/remediators/index.js +0 -26
  294. package/esm/idx/remediators/index.js.map +0 -1
  295. package/esm/idx/remediators/util.js +0 -35
  296. package/esm/idx/remediators/util.js.map +0 -1
  297. package/esm/idx/run.js +0 -201
  298. package/esm/idx/run.js.map +0 -1
  299. package/esm/idx/startTransaction.js +0 -27
  300. package/esm/idx/startTransaction.js.map +0 -1
  301. package/esm/idx/transactionMeta.js +0 -112
  302. package/esm/idx/transactionMeta.js.map +0 -1
  303. package/esm/idx/types/idx-js.js +0 -17
  304. package/esm/idx/types/idx-js.js.map +0 -1
  305. package/esm/idx/types/index.js +0 -34
  306. package/esm/idx/types/index.js.map +0 -1
  307. package/esm/oidc/decodeToken.js +0 -31
  308. package/esm/oidc/decodeToken.js.map +0 -1
  309. package/esm/oidc/endpoints/authorize.js +0 -61
  310. package/esm/oidc/endpoints/authorize.js.map +0 -1
  311. package/esm/oidc/endpoints/index.js.map +0 -1
  312. package/esm/oidc/endpoints/token.js +0 -97
  313. package/esm/oidc/endpoints/token.js.map +0 -1
  314. package/esm/oidc/endpoints/well-known.js +0 -58
  315. package/esm/oidc/endpoints/well-known.js.map +0 -1
  316. package/esm/oidc/exchangeCodeForTokens.js +0 -69
  317. package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
  318. package/esm/oidc/getToken.js +0 -175
  319. package/esm/oidc/getToken.js.map +0 -1
  320. package/esm/oidc/getUserInfo.js +0 -82
  321. package/esm/oidc/getUserInfo.js.map +0 -1
  322. package/esm/oidc/getWithPopup.js +0 -28
  323. package/esm/oidc/getWithPopup.js.map +0 -1
  324. package/esm/oidc/getWithRedirect.js +0 -61
  325. package/esm/oidc/getWithRedirect.js.map +0 -1
  326. package/esm/oidc/getWithoutPrompt.js +0 -29
  327. package/esm/oidc/getWithoutPrompt.js.map +0 -1
  328. package/esm/oidc/handleOAuthResponse.js +0 -148
  329. package/esm/oidc/handleOAuthResponse.js.map +0 -1
  330. package/esm/oidc/index.js +0 -29
  331. package/esm/oidc/index.js.map +0 -1
  332. package/esm/oidc/parseFromUrl.js +0 -102
  333. package/esm/oidc/parseFromUrl.js.map +0 -1
  334. package/esm/oidc/renewToken.js +0 -85
  335. package/esm/oidc/renewToken.js.map +0 -1
  336. package/esm/oidc/renewTokens.js +0 -52
  337. package/esm/oidc/renewTokens.js.map +0 -1
  338. package/esm/oidc/renewTokensWithRefresh.js +0 -55
  339. package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
  340. package/esm/oidc/revokeToken.js +0 -57
  341. package/esm/oidc/revokeToken.js.map +0 -1
  342. package/esm/oidc/util/browser.js +0 -85
  343. package/esm/oidc/util/browser.js.map +0 -1
  344. package/esm/oidc/util/defaultTokenParams.js +0 -42
  345. package/esm/oidc/util/defaultTokenParams.js.map +0 -1
  346. package/esm/oidc/util/errors.js +0 -31
  347. package/esm/oidc/util/errors.js.map +0 -1
  348. package/esm/oidc/util/index.js +0 -25
  349. package/esm/oidc/util/index.js.map +0 -1
  350. package/esm/oidc/util/loginRedirect.js +0 -84
  351. package/esm/oidc/util/loginRedirect.js.map +0 -1
  352. package/esm/oidc/util/oauth.js +0 -70
  353. package/esm/oidc/util/oauth.js.map +0 -1
  354. package/esm/oidc/util/pkce.js +0 -55
  355. package/esm/oidc/util/pkce.js.map +0 -1
  356. package/esm/oidc/util/prepareTokenParams.js +0 -75
  357. package/esm/oidc/util/prepareTokenParams.js.map +0 -1
  358. package/esm/oidc/util/refreshToken.js +0 -24
  359. package/esm/oidc/util/refreshToken.js.map +0 -1
  360. package/esm/oidc/util/urlParams.js +0 -54
  361. package/esm/oidc/util/urlParams.js.map +0 -1
  362. package/esm/oidc/util/validateClaims.js +0 -53
  363. package/esm/oidc/util/validateClaims.js.map +0 -1
  364. package/esm/oidc/util/validateToken.js +0 -21
  365. package/esm/oidc/util/validateToken.js.map +0 -1
  366. package/esm/oidc/verifyToken.js +0 -78
  367. package/esm/oidc/verifyToken.js.map +0 -1
  368. package/esm/options.js +0 -131
  369. package/esm/options.js.map +0 -1
  370. package/esm/server/serverStorage.js +0 -110
  371. package/esm/server/serverStorage.js.map +0 -1
  372. package/esm/services/TokenService.js +0 -103
  373. package/esm/services/TokenService.js.map +0 -1
  374. package/esm/session.js +0 -81
  375. package/esm/session.js.map +0 -1
  376. package/esm/tx/AuthTransaction.js +0 -215
  377. package/esm/tx/AuthTransaction.js.map +0 -1
  378. package/esm/tx/TransactionState.js.map +0 -1
  379. package/esm/tx/api.js +0 -84
  380. package/esm/tx/api.js.map +0 -1
  381. package/esm/tx/index.js +0 -18
  382. package/esm/tx/index.js.map +0 -1
  383. package/esm/tx/poll.js +0 -124
  384. package/esm/tx/poll.js.map +0 -1
  385. package/esm/tx/util.js +0 -26
  386. package/esm/tx/util.js.map +0 -1
  387. package/esm/types/AuthState.js +0 -3
  388. package/esm/types/Cookies.js +0 -3
  389. package/esm/types/EventEmitter.js +0 -3
  390. package/esm/types/EventEmitter.js.map +0 -1
  391. package/esm/types/JWT.js +0 -3
  392. package/esm/types/JWT.js.map +0 -1
  393. package/esm/types/OAuth.js +0 -3
  394. package/esm/types/OAuth.js.map +0 -1
  395. package/esm/types/OktaAuthOptions.js +0 -3
  396. package/esm/types/OktaAuthOptions.js.map +0 -1
  397. package/esm/types/Storage.js +0 -3
  398. package/esm/types/Storage.js.map +0 -1
  399. package/esm/types/Token.js +0 -29
  400. package/esm/types/Token.js.map +0 -1
  401. package/esm/types/TokenManager.js +0 -3
  402. package/esm/types/TokenManager.js.map +0 -1
  403. package/esm/types/Transaction.js +0 -57
  404. package/esm/types/Transaction.js.map +0 -1
  405. package/esm/types/UserClaims.js +0 -3
  406. package/esm/types/UserClaims.js.map +0 -1
  407. package/esm/types/api.js +0 -3
  408. package/esm/types/api.js.map +0 -1
  409. package/esm/types/http.js +0 -3
  410. package/esm/types/http.js.map +0 -1
  411. package/esm/types/index.js +0 -27
  412. package/esm/types/index.js.map +0 -1
  413. package/esm/util/console.js +0 -53
  414. package/esm/util/console.js.map +0 -1
  415. package/esm/util/index.js +0 -17
  416. package/esm/util/index.js.map +0 -1
  417. package/esm/util/misc.js +0 -33
  418. package/esm/util/misc.js.map +0 -1
  419. package/esm/util/object.js +0 -117
  420. package/esm/util/object.js.map +0 -1
  421. package/esm/util/types.js +0 -27
  422. package/esm/util/types.js.map +0 -1
  423. package/esm/util/url.js +0 -64
  424. package/esm/util/url.js.map +0 -1
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ exports.getResponseMode = getResponseMode;
4
+ exports.parseOAuthResponseFromUrl = parseOAuthResponseFromUrl;
5
+ exports.cleanOAuthResponseFromUrl = cleanOAuthResponseFromUrl;
3
6
  exports.parseFromUrl = parseFromUrl;
4
7
 
5
8
  var _errors = require("../errors");
@@ -52,7 +55,14 @@ function removeSearch(sdk) {
52
55
  }
53
56
  }
54
57
 
55
- function parseFromUrl(sdk, options) {
58
+ function getResponseMode(sdk) {
59
+ // https://openid.net/specs/openid-connect-core-1_0.html#Authentication
60
+ var defaultResponseMode = sdk.options.pkce ? 'query' : 'fragment';
61
+ var responseMode = sdk.options.responseMode || defaultResponseMode;
62
+ return responseMode;
63
+ }
64
+
65
+ function parseOAuthResponseFromUrl(sdk, options) {
56
66
  options = options || {};
57
67
 
58
68
  if ((0, _util2.isString)(options)) {
@@ -61,12 +71,10 @@ function parseFromUrl(sdk, options) {
61
71
  };
62
72
  } else {
63
73
  options = options;
64
- } // https://openid.net/specs/openid-connect-core-1_0.html#Authentication
65
-
74
+ }
66
75
 
67
- var defaultResponseMode = sdk.options.pkce ? 'query' : 'fragment';
68
76
  var url = options.url;
69
- var responseMode = options.responseMode || sdk.options.responseMode || defaultResponseMode;
77
+ var responseMode = options.responseMode || getResponseMode(sdk);
70
78
 
71
79
  var nativeLoc = sdk.token.parseFromUrl._getLocation();
72
80
 
@@ -79,31 +87,62 @@ function parseFromUrl(sdk, options) {
79
87
  }
80
88
 
81
89
  if (!paramStr) {
82
- return Promise.reject(new _errors.AuthSdkError('Unable to parse a token from the url'));
90
+ throw new _errors.AuthSdkError('Unable to parse a token from the url');
83
91
  }
84
92
 
93
+ return (0, _util.urlParamsToObject)(paramStr);
94
+ }
95
+
96
+ function cleanOAuthResponseFromUrl(sdk, options) {
97
+ // Clean hash or search from the url
98
+ const responseMode = options.responseMode || getResponseMode(sdk);
99
+ responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);
100
+ }
101
+
102
+ async function parseFromUrl(sdk, options) {
103
+ options = options || {};
104
+
105
+ if ((0, _util2.isString)(options)) {
106
+ options = {
107
+ url: options
108
+ };
109
+ } else {
110
+ options = options;
111
+ }
112
+
113
+ const res = parseOAuthResponseFromUrl(sdk, options);
114
+ const state = res.state;
85
115
  const oauthParams = sdk.transactionManager.load({
86
116
  oauth: true,
87
- pkce: sdk.options.pkce
117
+ pkce: sdk.options.pkce,
118
+ state
88
119
  });
120
+
121
+ if (!oauthParams) {
122
+ return Promise.reject(new _errors.AuthSdkError('Unable to retrieve OAuth redirect params from storage'));
123
+ }
124
+
89
125
  const urls = oauthParams.urls;
90
126
  delete oauthParams.urls;
91
- return Promise.resolve((0, _util.urlParamsToObject)(paramStr)).then(function (res) {
92
- if (!url) {
93
- // Clean hash or search from the url
94
- responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);
95
- }
96
127
 
97
- return (0, _handleOAuthResponse.handleOAuthResponse)(sdk, oauthParams, res, urls).catch(err => {
98
- if (!(0, _util.isInteractionRequiredError)(err)) {
99
- sdk.transactionManager.clear();
100
- }
128
+ if (!options.url) {
129
+ // Clean hash or search from the url
130
+ cleanOAuthResponseFromUrl(sdk, options);
131
+ }
132
+
133
+ return (0, _handleOAuthResponse.handleOAuthResponse)(sdk, oauthParams, res, urls).catch(err => {
134
+ if (!(0, _util.isInteractionRequiredError)(err)) {
135
+ sdk.transactionManager.clear({
136
+ state
137
+ });
138
+ }
101
139
 
102
- throw err;
103
- }).then(res => {
104
- sdk.transactionManager.clear();
105
- return res;
140
+ throw err;
141
+ }).then(res => {
142
+ sdk.transactionManager.clear({
143
+ state
106
144
  });
145
+ return res;
107
146
  });
108
147
  }
109
148
  //# sourceMappingURL=parseFromUrl.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/oidc/parseFromUrl.ts"],"names":["removeHash","sdk","nativeHistory","token","parseFromUrl","_getHistory","nativeDoc","_getDocument","nativeLoc","_getLocation","replaceState","title","pathname","search","hash","removeSearch","options","url","defaultResponseMode","pkce","responseMode","paramStr","substring","indexOf","Promise","reject","AuthSdkError","oauthParams","transactionManager","load","oauth","urls","resolve","then","res","catch","err","clear"],"mappings":";;;;AAaA;;AACA;;AAEA;;AACA;;AAjBA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,SAASA,UAAT,CAAoBC,GAApB,EAAyB;AACvB,MAAIC,aAAa,GAAGD,GAAG,CAACE,KAAJ,CAAUC,YAAV,CAAuBC,WAAvB,EAApB;;AACA,MAAIC,SAAS,GAAGL,GAAG,CAACE,KAAJ,CAAUC,YAAV,CAAuBG,YAAvB,EAAhB;;AACA,MAAIC,SAAS,GAAGP,GAAG,CAACE,KAAJ,CAAUC,YAAV,CAAuBK,YAAvB,EAAhB;;AACA,MAAIP,aAAa,IAAIA,aAAa,CAACQ,YAAnC,EAAiD;AAC/CR,IAAAA,aAAa,CAACQ,YAAd,CAA2B,IAA3B,EAAiCJ,SAAS,CAACK,KAA3C,EAAkDH,S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D,YAAMD,GAAN;AACD,KANI,EAOJH,IAPI,CAOCC,GAAG,IAAI;AACXjC,MAAAA,GAAG,CAAC2B,kBAAJ,CAAuBS,KAAvB;AACA,aAAOH,GAAP;AACD,KAVI,CAAP;AAWD,GAjBI,CAAP;AAkBD","sourcesContent":["/* eslint-disable complexity */\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 { AuthSdkError } from '../errors';\nimport { isInteractionRequiredError, urlParamsToObject } from './util';\nimport { ParseFromUrlOptions, TokenResponse, CustomUrls, TransactionMeta } from '../types';\nimport { isString } from '../util';\nimport { handleOAuthResponse } from './handleOAuthResponse';\n\nfunction removeHash(sdk) {\n var nativeHistory = sdk.token.parseFromUrl._getHistory();\n var nativeDoc = sdk.token.parseFromUrl._getDocument();\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n if (nativeHistory && nativeHistory.replaceState) {\n nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.search);\n } else {\n nativeLoc.hash = '';\n }\n}\n\nfunction removeSearch(sdk) {\n var nativeHistory = sdk.token.parseFromUrl._getHistory();\n var nativeDoc = sdk.token.parseFromUrl._getDocument();\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n if (nativeHistory && nativeHistory.replaceState) {\n nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.hash);\n } else {\n nativeLoc.search = '';\n }\n}\n\n\nexport function parseFromUrl(sdk, options: string | ParseFromUrlOptions): Promise<TokenResponse> {\n options = options || {};\n if (isString(options)) {\n options = { url: options } as ParseFromUrlOptions;\n } else {\n options = options as ParseFromUrlOptions;\n }\n // https://openid.net/specs/openid-connect-core-1_0.html#Authentication\n var defaultResponseMode = sdk.options.pkce ? 'query' : 'fragment';\n\n var url = options.url;\n var responseMode = options.responseMode || sdk.options.responseMode || defaultResponseMode;\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n var paramStr;\n\n if (responseMode === 'query') {\n paramStr = url ? url.substring(url.indexOf('?')) : nativeLoc.search;\n } else {\n paramStr = url ? url.substring(url.indexOf('#')) : nativeLoc.hash;\n }\n\n if (!paramStr) {\n return Promise.reject(new AuthSdkError('Unable to parse a token from the url'));\n }\n\n const oauthParams: TransactionMeta = sdk.transactionManager.load({\n oauth: true,\n pkce: sdk.options.pkce\n });\n const urls: CustomUrls = oauthParams.urls as CustomUrls;\n delete oauthParams.urls;\n\n return Promise.resolve(urlParamsToObject(paramStr))\n .then(function (res) {\n if (!url) {\n // Clean hash or search from the url\n responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);\n }\n return handleOAuthResponse(sdk, oauthParams, res, urls)\n .catch(err => {\n if (!isInteractionRequiredError(err)) {\n sdk.transactionManager.clear();\n }\n throw err;\n })\n .then(res => {\n sdk.transactionManager.clear();\n return res;\n });\n });\n}\n"],"file":"parseFromUrl.js"}
1
+ {"version":3,"sources":["../../../lib/oidc/parseFromUrl.ts"],"names":["removeHash","sdk","nativeHistory","token","parseFromUrl","_getHistory","nativeDoc","_getDocument","nativeLoc","_getLocation","replaceState","title","pathname","search","hash","removeSearch","getResponseMode","defaultResponseMode","options","pkce","responseMode","parseOAuthResponseFromUrl","url","paramStr","substring","indexOf","AuthSdkError","cleanOAuthResponseFromUrl","res","state","oauthParams","transactionManager","load","oauth","Promise","reject","urls","catch","err","clear","then"],"mappings":";;;;;;;AAaA;;AACA;;AAQA;;AACA;;AAvBA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA,SAASA,UAAT,CAAoBC,GAApB,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JE,IATI,CASCZ,GAAG,IAAI;AACX3B,IAAAA,GAAG,CAAC8B,kBAAJ,CAAuBQ,KAAvB,CAA6B;AAC3BV,MAAAA;AAD2B,KAA7B;AAGA,WAAOD,GAAP;AACD,GAdI,CAAP;AAgBD","sourcesContent":["/* eslint-disable complexity */\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 { AuthSdkError } from '../errors';\nimport { isInteractionRequiredError, urlParamsToObject } from './util';\nimport {\n ParseFromUrlOptions,\n TokenResponse,\n CustomUrls,\n TransactionMeta,\n OAuthResponse\n} from '../types';\nimport { isString } from '../util';\nimport { handleOAuthResponse } from './handleOAuthResponse';\n\nfunction removeHash(sdk) {\n var nativeHistory = sdk.token.parseFromUrl._getHistory();\n var nativeDoc = sdk.token.parseFromUrl._getDocument();\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n if (nativeHistory && nativeHistory.replaceState) {\n nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.search);\n } else {\n nativeLoc.hash = '';\n }\n}\n\nfunction removeSearch(sdk) {\n var nativeHistory = sdk.token.parseFromUrl._getHistory();\n var nativeDoc = sdk.token.parseFromUrl._getDocument();\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n if (nativeHistory && nativeHistory.replaceState) {\n nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.hash);\n } else {\n nativeLoc.search = '';\n }\n}\n\nexport function getResponseMode(sdk): 'query' | 'fragment' {\n // https://openid.net/specs/openid-connect-core-1_0.html#Authentication\n var defaultResponseMode = sdk.options.pkce ? 'query' : 'fragment';\n var responseMode = sdk.options.responseMode || defaultResponseMode;\n return responseMode;\n}\n\nexport function parseOAuthResponseFromUrl(sdk, options: string | ParseFromUrlOptions): OAuthResponse {\n options = options || {};\n if (isString(options)) {\n options = { url: options } as ParseFromUrlOptions;\n } else {\n options = options as ParseFromUrlOptions;\n }\n\n var url = options.url;\n var responseMode = options.responseMode || getResponseMode(sdk);\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n var paramStr;\n\n if (responseMode === 'query') {\n paramStr = url ? url.substring(url.indexOf('?')) : nativeLoc.search;\n } else {\n paramStr = url ? url.substring(url.indexOf('#')) : nativeLoc.hash;\n }\n\n if (!paramStr) {\n throw new AuthSdkError('Unable to parse a token from the url');\n }\n\n return urlParamsToObject(paramStr);\n}\n\nexport function cleanOAuthResponseFromUrl(sdk, options: ParseFromUrlOptions) {\n // Clean hash or search from the url\n const responseMode = options.responseMode || getResponseMode(sdk);\n responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);\n}\n\nexport async function parseFromUrl(sdk, options: string | ParseFromUrlOptions): Promise<TokenResponse> {\n options = options || {};\n if (isString(options)) {\n options = { url: options } as ParseFromUrlOptions;\n } else {\n options = options as ParseFromUrlOptions;\n }\n\n const res: OAuthResponse = parseOAuthResponseFromUrl(sdk, options);\n const state = res.state;\n const oauthParams: TransactionMeta = sdk.transactionManager.load({\n oauth: true,\n pkce: sdk.options.pkce,\n state\n });\n if (!oauthParams) {\n return Promise.reject(new AuthSdkError('Unable to retrieve OAuth redirect params from storage'));\n }\n const urls: CustomUrls = oauthParams.urls as CustomUrls;\n delete oauthParams.urls;\n\n if (!options.url) {\n // Clean hash or search from the url\n cleanOAuthResponseFromUrl(sdk, options);\n }\n\n return handleOAuthResponse(sdk, oauthParams, res, urls)\n .catch(err => {\n if (!isInteractionRequiredError(err)) {\n sdk.transactionManager.clear({\n state\n });\n }\n throw err;\n })\n .then(res => {\n sdk.transactionManager.clear({\n state\n });\n return res;\n });\n\n}\n"],"file":"parseFromUrl.js"}
@@ -2,6 +2,8 @@
2
2
 
3
3
  exports.renewTokens = renewTokens;
4
4
 
5
+ var _errors = require("../errors");
6
+
5
7
  var _getWithoutPrompt = require("./getWithoutPrompt");
6
8
 
7
9
  var _renewTokensWithRefresh = require("./renewTokensWithRefresh");
@@ -21,19 +23,40 @@ var _util = require("./util");
21
23
  *
22
24
  */
23
25
  // If we have a refresh token, renew using that, otherwise getWithoutPrompt
26
+ // eslint-disable-next-line complexity
24
27
  async function renewTokens(sdk, options) {
25
28
  const tokens = sdk.tokenManager.getTokensSync();
26
29
 
27
30
  if (tokens.refreshToken) {
28
31
  return (0, _renewTokensWithRefresh.renewTokensWithRefresh)(sdk, options, tokens.refreshToken);
29
- } // Get tokens using the SSO cookie
32
+ }
33
+
34
+ if (!tokens.accessToken && !tokens.idToken) {
35
+ throw new _errors.AuthSdkError('renewTokens() was called but there is no existing token');
36
+ }
37
+
38
+ const accessToken = tokens.accessToken || {};
39
+ const idToken = tokens.idToken || {};
40
+ const scopes = accessToken.scopes || idToken.scopes;
41
+
42
+ if (!scopes) {
43
+ throw new _errors.AuthSdkError('renewTokens: invalid tokens: could not read scopes');
44
+ }
45
+
46
+ const authorizeUrl = accessToken.authorizeUrl || idToken.authorizeUrl;
47
+
48
+ if (!authorizeUrl) {
49
+ throw new _errors.AuthSdkError('renewTokens: invalid tokens: could not read authorizeUrl');
50
+ }
30
51
 
52
+ const userinfoUrl = accessToken.userinfoUrl || sdk.options.userinfoUrl;
53
+ const issuer = idToken.issuer || sdk.options.issuer; // Get tokens using the SSO cookie
31
54
 
32
55
  options = Object.assign({
33
- scopes: sdk.options.scopes,
34
- authorizeUrl: sdk.options.authorizeUrl,
35
- userinfoUrl: sdk.options.userinfoUrl,
36
- issuer: sdk.options.issuer
56
+ scopes,
57
+ authorizeUrl,
58
+ userinfoUrl,
59
+ issuer
37
60
  }, options);
38
61
 
39
62
  if (sdk.options.pkce) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/oidc/renewTokens.ts"],"names":["renewTokens","sdk","options","tokens","tokenManager","getTokensSync","refreshToken","Object","assign","scopes","authorizeUrl","userinfoUrl","issuer","pkce","responseType","then","res"],"mappings":";;;;AAaA;;AACA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACO,eAAeA,WAAf,CAA2BC,GAA3B,EAAgCC,OAAhC,EAAuE;AAC5E,QAAMC,MAAM,GAAGF,GAAG,CAACG,YAAJ,CAAiBC,aAAjB,EAAf;;AACA,MAAIF,MAAM,CAACG,YAAX,EAAyB;AACvB,WAAO,oDAAuBL,GAAvB,EAA4BC,OAA5B,EAAqCC,MAAM,CAACG,YAA5C,CAAP;AACD,GAJ2E,CAM5E;;;AACAJ,EAAAA,OAAO,GAAGK,MAAM,CAACC,MAAP,CAAc;AACtBC,IAAAA,MAAM,EAAER,GAAG,CAACC,OAAJ,CAAYO,MADE;AAEtBC,IAAAA,YAAY,EAAET,GAAG,CAACC,OAAJ,CAAYQ,YAFJ;AAGtBC,IAAAA,WAAW,EAAEV,GAAG,CAACC,OAAJ,CAAYS,WAHH;AAItBC,IAAAA,MAAM,EAAEX,GAAG,CAACC,OAAJ,CAAYU;AAJE,GAAd,EAKPV,OALO,CAAV;;AAOA,MAAID,GAAG,CAACC,OAAJ,CAAYW,IAAhB,EAAsB;AACpBX,IAAAA,OAAO,CAACY,YAAR,GAAuB,MAAvB;AACD,GAFD,MAEO;AACL,UAAM;AAAEA,MAAAA;AAAF,QAAmB,iCAAsBb,GAAtB,CAAzB;AACAC,IAAAA,OAAO,CAACY,YAAR,GAAuBA,YAAvB;AACD;;AAED,SAAO,wCAAiBb,GAAjB,EAAsBC,OAAtB,EACJa,IADI,CACCC,GAAG,IAAIA,GAAG,CAACb,MADZ,CAAP;AAGD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { TokenParams, Tokens } from '../types';\nimport { getWithoutPrompt } from './getWithoutPrompt';\nimport { renewTokensWithRefresh } from './renewTokensWithRefresh';\nimport { getDefaultTokenParams } from './util';\n\n// If we have a refresh token, renew using that, otherwise getWithoutPrompt\nexport async function renewTokens(sdk, options: TokenParams): Promise<Tokens> {\n const tokens = sdk.tokenManager.getTokensSync();\n if (tokens.refreshToken) {\n return renewTokensWithRefresh(sdk, options, tokens.refreshToken);\n }\n\n // Get tokens using the SSO cookie\n options = Object.assign({\n scopes: sdk.options.scopes,\n authorizeUrl: sdk.options.authorizeUrl,\n userinfoUrl: sdk.options.userinfoUrl,\n issuer: sdk.options.issuer\n }, options);\n\n if (sdk.options.pkce) {\n options.responseType = 'code';\n } else {\n const { responseType } = getDefaultTokenParams(sdk);\n options.responseType = responseType;\n }\n\n return getWithoutPrompt(sdk, options)\n .then(res => res.tokens);\n \n}\n"],"file":"renewTokens.js"}
1
+ {"version":3,"sources":["../../../lib/oidc/renewTokens.ts"],"names":["renewTokens","sdk","options","tokens","tokenManager","getTokensSync","refreshToken","accessToken","idToken","AuthSdkError","scopes","authorizeUrl","userinfoUrl","issuer","Object","assign","pkce","responseType","then","res"],"mappings":";;;;AAYA;;AAEA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACO,eAAeA,WAAf,CAA2BC,GAA3B,EAAgCC,OAAhC,EAAuE;AAC5E,QAAMC,MAAM,GAAGF,GAAG,CAACG,YAAJ,CAAiBC,aAAjB,EAAf;;AACA,MAAIF,MAAM,CA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uBA,YAAvB;AACD;;AAED,SAAO,wCAAiBhB,GAAjB,EAAsBC,OAAtB,EACJgB,IADI,CACCC,GAAG,IAAIA,GAAG,CAAChB,MADZ,CAAP;AAGD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { TokenParams, Tokens } from '../types';\nimport { getWithoutPrompt } from './getWithoutPrompt';\nimport { renewTokensWithRefresh } from './renewTokensWithRefresh';\nimport { getDefaultTokenParams } from './util';\n\n// If we have a refresh token, renew using that, otherwise getWithoutPrompt\n// eslint-disable-next-line complexity\nexport async function renewTokens(sdk, options: TokenParams): Promise<Tokens> {\n const tokens = sdk.tokenManager.getTokensSync();\n if (tokens.refreshToken) {\n return renewTokensWithRefresh(sdk, options, tokens.refreshToken);\n }\n\n if (!tokens.accessToken && !tokens.idToken) {\n throw new AuthSdkError('renewTokens() was called but there is no existing token');\n }\n\n const accessToken = tokens.accessToken || {};\n const idToken = tokens.idToken || {};\n const scopes = accessToken.scopes || idToken.scopes;\n if (!scopes) {\n throw new AuthSdkError('renewTokens: invalid tokens: could not read scopes');\n }\n const authorizeUrl = accessToken.authorizeUrl || idToken.authorizeUrl;\n if (!authorizeUrl) {\n throw new AuthSdkError('renewTokens: invalid tokens: could not read authorizeUrl');\n }\n const userinfoUrl = accessToken.userinfoUrl || sdk.options.userinfoUrl;\n const issuer = idToken.issuer || sdk.options.issuer;\n\n // Get tokens using the SSO cookie\n options = Object.assign({\n scopes,\n authorizeUrl,\n userinfoUrl,\n issuer\n }, options);\n\n if (sdk.options.pkce) {\n options.responseType = 'code';\n } else {\n const { responseType } = getDefaultTokenParams(sdk);\n options.responseType = responseType;\n }\n\n return getWithoutPrompt(sdk, options)\n .then(res => res.tokens);\n \n}\n"],"file":"renewTokens.js"}
@@ -8,8 +8,6 @@ exports.addPostMessageListener = addPostMessageListener;
8
8
 
9
9
  var _errors = require("../../errors");
10
10
 
11
- var _features = require("../../features");
12
-
13
11
  /*!
14
12
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
15
13
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -52,17 +50,7 @@ function loadFrame(src) {
52
50
  function loadPopup(src, options) {
53
51
  var title = options.popupTitle || 'External Identity Provider User Authentication';
54
52
  var appearance = 'toolbar=no, scrollbars=yes, resizable=yes, ' + 'top=100, left=500, width=600, height=600';
55
-
56
- if ((0, _features.isIE11OrLess)()) {
57
- // IE<=11 doesn't fully support postMessage at time of writting.
58
- // the following simple solution happened to solve the issue
59
- // without adding another proxy layer which makes flow more complecated.
60
- var winEl = window.open('/', title, appearance);
61
- winEl.location.href = src;
62
- return winEl;
63
- } else {
64
- return window.open(src, title, appearance);
65
- }
53
+ return window.open(src, title, appearance);
66
54
  }
67
55
 
68
56
  function addPostMessageListener(sdk, timeout, state) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/oidc/util/browser.ts"],"names":["addListener","eventTarget","name","fn","addEventListener","attachEvent","removeListener","removeEventListener","detachEvent","loadFrame","src","iframe","document","createElement","style","display","body","appendChild","loadPopup","options","title","popupTitle","appearance","winEl","window","open","location","href","addPostMessageListener","sdk","timeout","state","responseHandler","timeoutId","msgReceivedOrTimeout","Promise","resolve","reject","e","data","origin","getIssuerOrigin","AuthSdkError","setTimeout","finally","clearTimeout"],"mappings":";;;;;;;;AAcA;;AAEA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AACA;AAKO,SAASA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ACC,IAAP,CAAYf,GAAZ,EAAiBU,KAAjB,EAAwBE,UAAxB,CAAP;AACD;AACF;;AAEM,SAASM,sBAAT,CAAgCC,GAAhC,EAA+CC,OAA/C,EAAwDC,KAAxD,EAA+D;AACpE,MAAIC,eAAJ;AACA,MAAIC,SAAJ;AACA,MAAIC,oBAAoB,GAAG,IAAIC,OAAJ,CAAY,UAAUC,OAAV,EAAmBC,MAAnB,EAA2B;AAEhEL,IAAAA,eAAe,GAAG,SAASA,eAAT,CAAyBM,CAAzB,EAA4B;AAC5C,UAAI,CAACA,CAAC,CAACC,IAAH,IAAWD,CAAC,CAACC,IAAF,CAAOR,KAAP,KAAiBA,KAAhC,EAAuC;AACrC;AACA;AACD,OAJ2C,CAM5C;AACA;AACA;AACA;;;AACA,UAAIO,CAAC,CAACE,MAAF,KAAaX,GAAG,CAACY,eAAJ,EAAjB,EAAwC;AACtC,eAAOJ,MAAM,CAAC,IAAIK,oBAAJ,CAAiB,iDAAjB,CAAD,CAAb;AACD;;AACDN,MAAAA,OAAO,CAACE,CAAC,CAACC,IAAH,CAAP;AACD,KAdD;;AAgBAvC,IAAAA,WAAW,CAACwB,MAAD,EAAS,SAAT,EAAoBQ,eAApB,CAAX;AAEAC,IAAAA,SAAS,GAAGU,UAAU,CAAC,YAAY;AACjCN,MAAAA,MAAM,CAAC,IAAIK,oBAAJ,CAAiB,sBAAjB,CAAD,CAAN;AACD,KAFqB,EAEnBZ,OAAO,IAAI,MAFQ,CAAtB;AAGD,GAvB0B,CAA3B;AAyBA,SAAOI,oBAAoB,CACxBU,OADI,CACI,YAAY;AACnBC,IAAAA,YAAY,CAACZ,SAAD,CAAZ;AACA3B,IAAAA,cAAc,CAACkB,MAAD,EAAS,SAAT,EAAoBQ,eAApB,CAAd;AACD,GAJI,CAAP;AAKD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n/* global window, document */\n/* eslint-disable complexity, max-statements */\nimport { AuthSdkError } from '../../errors';\nimport { OktaAuth } from '../../types';\nimport { isIE11OrLess } from '../../features';\n\nexport function addListener(eventTarget, name, fn) {\n if (eventTarget.addEventListener) {\n eventTarget.addEventListener(name, fn);\n } else {\n eventTarget.attachEvent('on' + name, fn);\n }\n}\n\nexport function removeListener(eventTarget, name, fn) {\n if (eventTarget.removeEventListener) {\n eventTarget.removeEventListener(name, fn);\n } else {\n eventTarget.detachEvent('on' + name, fn);\n }\n}\n\nexport function loadFrame(src) {\n var iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = src;\n\n return document.body.appendChild(iframe);\n}\n\nexport function loadPopup(src, options) {\n var title = options.popupTitle || 'External Identity Provider User Authentication';\n var appearance = 'toolbar=no, scrollbars=yes, resizable=yes, ' +\n 'top=100, left=500, width=600, height=600';\n\n if (isIE11OrLess()) {\n // IE<=11 doesn't fully support postMessage at time of writting.\n // the following simple solution happened to solve the issue\n // without adding another proxy layer which makes flow more complecated.\n var winEl = window.open('/', title, appearance);\n winEl.location.href = src;\n return winEl;\n } else {\n return window.open(src, title, appearance);\n }\n}\n\nexport function addPostMessageListener(sdk: OktaAuth, timeout, state) {\n var responseHandler;\n var timeoutId;\n var msgReceivedOrTimeout = new Promise(function (resolve, reject) {\n\n responseHandler = function responseHandler(e) {\n if (!e.data || e.data.state !== state) {\n // A message not meant for us\n return;\n }\n\n // Configuration mismatch between saved token and current app instance\n // This may happen if apps with different issuers are running on the same host url\n // If they share the same storage key, they may read and write tokens in the same location.\n // Common when developing against http://localhost\n if (e.origin !== sdk.getIssuerOrigin()) {\n return reject(new AuthSdkError('The request does not match client configuration'));\n }\n resolve(e.data);\n };\n\n addListener(window, 'message', responseHandler);\n\n timeoutId = setTimeout(function () {\n reject(new AuthSdkError('OAuth flow timed out'));\n }, timeout || 120000);\n });\n\n return msgReceivedOrTimeout\n .finally(function () {\n clearTimeout(timeoutId);\n removeListener(window, 'message', responseHandler);\n });\n}\n"],"file":"browser.js"}
1
+ {"version":3,"sources":["../../../../lib/oidc/util/browser.ts"],"names":["addListener","eventTarget","name","fn","addEventListener","attachEvent","removeListener","removeEventListener","detachEvent","loadFrame","src","iframe","document","createElement","style","display","body","appendChild","loadPopup","options","title","popupTitle","appearance","window","open","addPostMessageListener","sdk","timeout","state","responseHandler","timeoutId","msgReceivedOrTimeout","Promise","resolve","reject","e","data","origin","getIssuerOrigin","AuthSdkError","setTimeout","finally","clearTimeout"],"mappings":";;;;;;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AACA;AAIO,SAASA,WAAT,CAAqBC,WAArB,EAAkCC,IAAlC,EAAwCC,EAAxC,EAA4C;AACjD,MAAIF,WAAW,CAACG,gBAAhB,EAAkC;AAChCH,IAAAA,WAAW,CAACG,gBAAZ,CAA6BF,IAA7B,EAAmCC,EAAnC;AACD,GAFD,MAEO;AACLF,IAAAA,WAAW,CAACI,WAAZ,CAAwB,OAAOH,IAA/B,EAAqCC,EAArC;AACD;AACF;;AAEM,SAASG,cAAT,CAAwBL,WAAxB,EAAqCC,IAArC,EAA2CC,EAA3C,EAA+C;AACpD,MAAIF,WAAW,CAACM,mBAAhB,EAAqC;AACnCN,IAAAA,WAAW,CAACM,mBAAZ,CAAgCL,IAAhC,EAAsCC,EAAtC;AACD,GAFD,MAEO;AACLF,IAAAA,WAAW,CAACO,WAAZ,CAAwB,OAAON,IAA/B,EAAqCC,EAArC;AACD;AACF;;AAEM,SAASM,SAAT,CAAmBC,GAAnB,EAAwB;AAC7B,MAAIC,MAAM,GAAGC,QAAQ,CAACC,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AAD,CAAN;AACD,KAFqB,EAEnBZ,OAAO,IAAI,MAFQ,CAAtB;AAGD,GAvB0B,CAA3B;AAyBA,SAAOI,oBAAoB,CACxBU,OADI,CACI,YAAY;AACnBC,IAAAA,YAAY,CAACZ,SAAD,CAAZ;AACAxB,IAAAA,cAAc,CAACiB,MAAD,EAAS,SAAT,EAAoBM,eAApB,CAAd;AACD,GAJI,CAAP;AAKD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n/* global window, document */\n/* eslint-disable complexity, max-statements */\nimport { AuthSdkError } from '../../errors';\nimport { OktaAuth } from '../../types';\n\nexport function addListener(eventTarget, name, fn) {\n if (eventTarget.addEventListener) {\n eventTarget.addEventListener(name, fn);\n } else {\n eventTarget.attachEvent('on' + name, fn);\n }\n}\n\nexport function removeListener(eventTarget, name, fn) {\n if (eventTarget.removeEventListener) {\n eventTarget.removeEventListener(name, fn);\n } else {\n eventTarget.detachEvent('on' + name, fn);\n }\n}\n\nexport function loadFrame(src) {\n var iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n iframe.src = src;\n\n return document.body.appendChild(iframe);\n}\n\nexport function loadPopup(src, options) {\n var title = options.popupTitle || 'External Identity Provider User Authentication';\n var appearance = 'toolbar=no, scrollbars=yes, resizable=yes, ' +\n 'top=100, left=500, width=600, height=600';\n return window.open(src, title, appearance);\n}\n\nexport function addPostMessageListener(sdk: OktaAuth, timeout, state) {\n var responseHandler;\n var timeoutId;\n var msgReceivedOrTimeout = new Promise(function (resolve, reject) {\n\n responseHandler = function responseHandler(e) {\n if (!e.data || e.data.state !== state) {\n // A message not meant for us\n return;\n }\n\n // Configuration mismatch between saved token and current app instance\n // This may happen if apps with different issuers are running on the same host url\n // If they share the same storage key, they may read and write tokens in the same location.\n // Common when developing against http://localhost\n if (e.origin !== sdk.getIssuerOrigin()) {\n return reject(new AuthSdkError('The request does not match client configuration'));\n }\n resolve(e.data);\n };\n\n addListener(window, 'message', responseHandler);\n\n timeoutId = setTimeout(function () {\n reject(new AuthSdkError('OAuth flow timed out'));\n }, timeout || 120000);\n });\n\n return msgReceivedOrTimeout\n .finally(function () {\n clearTimeout(timeoutId);\n removeListener(window, 'message', responseHandler);\n });\n}\n"],"file":"browser.js"}
@@ -92,13 +92,17 @@ function isLoginRedirect(sdk) {
92
92
  */
93
93
 
94
94
 
95
- function isInteractionRequired(sdk) {
96
- // First check, is this a redirect URI?
97
- if (!isLoginRedirect(sdk)) {
98
- return false;
95
+ function isInteractionRequired(sdk, hashOrSearch) {
96
+ if (!hashOrSearch) {
97
+ // web only
98
+ // First check, is this a redirect URI?
99
+ if (!isLoginRedirect(sdk)) {
100
+ return false;
101
+ }
102
+
103
+ hashOrSearch = getHashOrSearch(sdk.options);
99
104
  }
100
105
 
101
- var hashOrSearch = getHashOrSearch(sdk.options);
102
106
  return /(error=interaction_required)/i.test(hashOrSearch);
103
107
  }
104
108
  //# sourceMappingURL=loginRedirect.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/oidc/util/loginRedirect.ts"],"names":["hasTokensInHash","hash","test","hasAuthorizationCode","hashOrSearch","hasInteractionCode","hasErrorInUrl","isRedirectUri","uri","sdk","authParams","options","indexOf","redirectUri","isCodeFlow","pkce","responseType","responseMode","getHashOrSearch","codeFlow","useQuery","window","location","search","isLoginRedirect","href","hasCode","isInteractionRequired"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AACA;AAGO,SAASA,eAAT,CAAyBC,IAAzB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C,CAM9C;;;AACA,MAAIU,QAAQ,GAAGL,UAAU,CAACL,GAAG,CAACE,OAAL,CAAzB;AACA,MAAIP,YAAY,GAAGc,eAAe,CAACT,GAAG,CAACE,OAAL,CAAlC;;AAEA,MAAIL,aAAa,CAACF,YAAD,CAAjB,EAAiC;AAC/B,WAAO,IAAP;AACD;;AAED,MAAIe,QAAJ,EAAc;AACZ,QAAIO,OAAO,GAAIvB,oBAAoB,CAACC,YAAD,CAApB,IAAsCC,kBAAkB,CAACD,YAAD,CAAvE;AACA,WAAOsB,OAAP;AACD,GAjB6C,CAmB9C;;;AACA,SAAO1B,eAAe,CAACqB,MAAM,CAACC,QAAP,CAAgBrB,IAAjB,CAAtB;AACD;AAED;AACA;AACA;AACA;;;AACO,SAAS0B,qBAAT,CAAgClB,GAAhC,EAA+C;AAClD;AACA,MAAI,CAACe,eAAe,CAACf,GAAD,CAApB,EAA0B;AACxB,WAAO,KAAP;AACD;;AAEH,MAAIL,YAAY,GAAGc,eAAe,CAACT,GAAG,CAACE,OAAL,CAAlC;AACA,SAAO,gCAAgCT,IAAhC,CAAqCE,YAArC,CAAP;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/* global window */\n/* eslint-disable complexity, max-statements */\nimport { OktaAuth, OktaAuthOptions } from '../../types';\n\nexport function hasTokensInHash(hash: string): boolean {\n return /((id|access)_token=)/i.test(hash);\n}\n\n// authorization_code\nexport function hasAuthorizationCode(hashOrSearch: string): boolean {\n return /(code=)/i.test(hashOrSearch);\n}\n\n// interaction_code\nexport function hasInteractionCode(hashOrSearch: string): boolean {\n return /(interaction_code=)/i.test(hashOrSearch);\n}\n\nexport function hasErrorInUrl(hashOrSearch: string): boolean {\n return /(error=)/i.test(hashOrSearch) || /(error_description)/i.test(hashOrSearch);\n}\n\nexport function isRedirectUri(uri: string, sdk: OktaAuth): boolean {\n var authParams = sdk.options;\n return uri && uri.indexOf(authParams.redirectUri) === 0;\n}\n\nexport function isCodeFlow(options: OktaAuthOptions) {\n return options.pkce || options.responseType === 'code' || options.responseMode === 'query';\n}\n\nexport function getHashOrSearch(options: OktaAuthOptions) {\n var codeFlow = isCodeFlow(options);\n var useQuery = codeFlow && options.responseMode !== 'fragment';\n return useQuery ? window.location.search : window.location.hash;\n}\n\n/**\n * Check if tokens or a code have been passed back into the url, which happens in\n * the OIDC (including social auth IDP) redirect flow.\n */\nexport function isLoginRedirect (sdk: OktaAuth) {\n // First check, is this a redirect URI?\n if (!isRedirectUri(window.location.href, sdk)){\n return false;\n }\n\n // The location contains either a code, token, or an error + error_description\n var codeFlow = isCodeFlow(sdk.options);\n var hashOrSearch = getHashOrSearch(sdk.options);\n\n if (hasErrorInUrl(hashOrSearch)) {\n return true;\n }\n\n if (codeFlow) {\n var hasCode = hasAuthorizationCode(hashOrSearch) || hasInteractionCode(hashOrSearch);\n return hasCode;\n }\n\n // implicit flow, will always be hash fragment\n return hasTokensInHash(window.location.hash);\n}\n\n/**\n * Check if error=interaction_required has been passed back in the url, which happens in\n * the social auth IDP redirect flow.\n */\nexport function isInteractionRequired (sdk: OktaAuth) {\n // First check, is this a redirect URI?\n if (!isLoginRedirect(sdk)){\n return false;\n }\n \n var hashOrSearch = getHashOrSearch(sdk.options);\n return /(error=interaction_required)/i.test(hashOrSearch);\n}"],"file":"loginRedirect.js"}
1
+ {"version":3,"sources":["../../../../lib/oidc/util/loginRedirect.ts"],"names":["hasTokensInHash","hash","test","hasAuthorizationCode","hashOrSearch","hasInteractionCode","hasErrorInUrl","isRedirectUri","uri","sdk","authParams","options","indexOf","redirectUri","isCodeFlow","pkce","responseType","responseMode","getHashOrSearch","codeFlow","useQuery","window","location","search","isLoginRedirect","href","hasCode","isInteractionRequired"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AACA;AAGO,SAASA,eAAT,CAAyBC,IAAzB,EAAgD;AACrD,SAAO,wBAAwBC,IAAxB,CAA6BD,IAA7B,CAAP;AACD,C,CAED;;;AACO,SAASE,oBAAT,CAA8BC,YAA9B,EAA6D;AAClE,SAAO,WAAWF,IAAX,CAAgBE,YAAhB,CAAP;AACD,C,CAED;;;AACO,SAASC,kBAAT,CAA4BD,YAA5B,EAA2D;AAChE,SAAO,uBAAuBF,IAAvB,CAA4BE,YAA5B,CAAP;AACD;;AAEM,SAASE,aAAT,CAAuBF,YAAvB,EAAsD;AAC3D,SAAO,YAAYF,IAAZ,CAAiBE,YAAjB,KAAkC,uBAAuBF,IAAvB,CAA4BE,YAA5B,CAAzC;AACD;;AAEM,SAASG,aAAT,CAAuBC,GAAvB,EAAoCC,GAApC,EAA4D;AACjE,MAAIC,UAAU,GAAGD,GAAG,CAACE,OAArB;AACA,SAAOH,GAAG,IAAIA,GAAG,CAACI,OAAJ,CAAYF,UAAU,CAACG,WAAvB,MAAwC,CAAtD;AACD;;AAEM,SAASC,UAAT,CAAoBH,OAApB,EAA8C;AACnD,SAAOA,OAAO,CAACI,IAAR,IAAgBJ,OAAO,CAACK,YAAR,KAAyB,MAAzC,IAAmDL,OAAO,CAACM,YAAR,KAAyB,OAAnF;AACD;;AAEM,SAASC,eAAT,CAAyBP,OAAzB,EAAmD;AACxD,MAAIQ,QAAQ,GAAGL,UAAU,CAACH,OAAD,CAAzB;AACA,MAAIS,QAAQ,GAAGD,QAAQ,IAAIR,OAAO,CAACM,YAAR,KAAyB,UAApD;AACA,SAAOG,QAAQ,GAAGC,MAAM,CAACC,QAAP,CAAgBC,MAAnB,GAA4BF,MAAM,CAACC,QAAP,CAAgBrB,IAA3D;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASuB,eAAT,CAA0Bf,GAA1B,EAAyC;AAC9C;AACA,MAAI,CAACF,aAAa,CAACc,MAAM,CAACC,QAAP,CAAgBG,IAAjB,EAAuBhB,GAAvB,CAAlB,EAA8C;AAC5C,WAAO,KAAP;AACD,GAJ6C,CAM9C;;;AACA,MAAIU,QAAQ,GAAGL,UAAU,CAACL,GAAG,CAACE,OAAL,CAAzB;AACA,MAAIP,YAAY,GAAGc,eAAe,CAACT,GAAG,CAACE,OAAL,CAAlC;;AAEA,MAAIL,aAAa,CAACF,YAAD,CAAjB,EAAiC;AAC/B,WAAO,IAAP;AACD;;AAED,MAAIe,QAAJ,EAAc;AACZ,QAAIO,OAAO,GAAIvB,oBAAoB,CAACC,YAAD,CAApB,IAAsCC,kBAAkB,CAACD,YAAD,CAAvE;AACA,WAAOsB,OAAP;AACD,GAjB6C,CAmB9C;;;AACA,SAAO1B,eAAe,CAACqB,MAAM,CAACC,QAAP,CAAgBrB,IAAjB,CAAtB;AACD;AAED;AACA;AACA;AACA;;;AACO,SAAS0B,qBAAT,CAAgClB,GAAhC,EAA+CL,YAA/C,EAAsE;AAC3E,MAAI,CAACA,YAAL,EAAmB;AAAE;AACnB;AACA,QAAI,CAACoB,eAAe,CAACf,GAAD,CAApB,EAA0B;AACxB,aAAO,KAAP;AACD;;AAEDL,IAAAA,YAAY,GAAGc,eAAe,CAACT,GAAG,CAACE,OAAL,CAA9B;AACD;;AACD,SAAO,gCAAgCT,IAAhC,CAAqCE,YAArC,CAAP;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/* global window */\n/* eslint-disable complexity, max-statements */\nimport { OktaAuth, OktaAuthOptions } from '../../types';\n\nexport function hasTokensInHash(hash: string): boolean {\n return /((id|access)_token=)/i.test(hash);\n}\n\n// authorization_code\nexport function hasAuthorizationCode(hashOrSearch: string): boolean {\n return /(code=)/i.test(hashOrSearch);\n}\n\n// interaction_code\nexport function hasInteractionCode(hashOrSearch: string): boolean {\n return /(interaction_code=)/i.test(hashOrSearch);\n}\n\nexport function hasErrorInUrl(hashOrSearch: string): boolean {\n return /(error=)/i.test(hashOrSearch) || /(error_description)/i.test(hashOrSearch);\n}\n\nexport function isRedirectUri(uri: string, sdk: OktaAuth): boolean {\n var authParams = sdk.options;\n return uri && uri.indexOf(authParams.redirectUri) === 0;\n}\n\nexport function isCodeFlow(options: OktaAuthOptions) {\n return options.pkce || options.responseType === 'code' || options.responseMode === 'query';\n}\n\nexport function getHashOrSearch(options: OktaAuthOptions) {\n var codeFlow = isCodeFlow(options);\n var useQuery = codeFlow && options.responseMode !== 'fragment';\n return useQuery ? window.location.search : window.location.hash;\n}\n\n/**\n * Check if tokens or a code have been passed back into the url, which happens in\n * the OIDC (including social auth IDP) redirect flow.\n */\nexport function isLoginRedirect (sdk: OktaAuth) {\n // First check, is this a redirect URI?\n if (!isRedirectUri(window.location.href, sdk)){\n return false;\n }\n\n // The location contains either a code, token, or an error + error_description\n var codeFlow = isCodeFlow(sdk.options);\n var hashOrSearch = getHashOrSearch(sdk.options);\n\n if (hasErrorInUrl(hashOrSearch)) {\n return true;\n }\n\n if (codeFlow) {\n var hasCode = hasAuthorizationCode(hashOrSearch) || hasInteractionCode(hashOrSearch);\n return hasCode;\n }\n\n // implicit flow, will always be hash fragment\n return hasTokensInHash(window.location.hash);\n}\n\n/**\n * Check if error=interaction_required has been passed back in the url, which happens in\n * the social auth IDP redirect flow.\n */\nexport function isInteractionRequired (sdk: OktaAuth, hashOrSearch?: string) {\n if (!hashOrSearch) { // web only\n // First check, is this a redirect URI?\n if (!isLoginRedirect(sdk)){\n return false;\n }\n \n hashOrSearch = getHashOrSearch(sdk.options);\n }\n return /(error=interaction_required)/i.test(hashOrSearch);\n}"],"file":"loginRedirect.js"}
@@ -20,7 +20,7 @@ function urlParamsToObject(hashOrSearch) {
20
20
  // Predefine regexs for parsing hash
21
21
  var plus2space = /\+/g;
22
22
  var paramSplit = /([^&=]+)=?([^&]*)/g;
23
- var fragment = hashOrSearch; // Some hash based routers will automatically add a / character after the hash
23
+ var fragment = hashOrSearch || ''; // Some hash based routers will automatically add a / character after the hash
24
24
 
25
25
  if (fragment.charAt(0) === '#' && fragment.charAt(1) === '/') {
26
26
  fragment = fragment.substring(2);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../lib/oidc/util/urlParams.ts"],"names":["urlParamsToObject","hashOrSearch","plus2space","paramSplit","fragment","charAt","substring","obj","param","exec","key","value","decodeURIComponent","replace"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAEO,SAASA,iBAAT,CAA2BC,YAA3B,EAAiD;AACtD;AACA,MAAIC,UAAU,GAAG,KAAjB;AACA,MAAIC,UAAU,GAAG,oBAAjB;AACA,MAAIC,QAAQ,GAAGH,YAAf,CAJsD,CAMtD;;AACA,MAAIG,QAAQ,CAACC,MAAT,CAAgB,CAAhB,MAAuB,GAAvB,IAA8BD,QAAQ,CAACC,MAAT,CAAgB,CAAhB,MAAuB,GAAzD,EAA8D;AAC5DD,IAAAA,QAAQ,GAAGA,QAAQ,CAACE,SAAT,CAAmB,CAAnB,CAAX;AACD,GATqD,CAWtD;;;AACA,MAAIF,QAAQ,CAACC,MAAT,CAAgB,CAAhB,MAAuB,GAAvB,IAA8BD,QAAQ,CAACC,MAAT,CAAgB,CAAhB,MAAuB,GAAzD,EAA8D;AAC5DD,IAAAA,QAAQ,GAAGA,QAAQ,CAACE,SAAT,CAAmB,CAAnB,CAAX;AACD;;AAGD,MAAIC,GAAG,GAAG,EAAV,CAjBsD,CAmBtD;;AACA,MAAIC,KAAJ;;AACA,SAAO,IAAP,EAAa;AAAE;AACbA,IAAAA,KAAK,GAAGL,UAAU,CAACM,IAAX,CAAgBL,QAAhB,CAAR;;AACA,QAAI,CAACI,KAAL,EAAY;AAAE;AAAQ;;AAEtB,QAAIE,GAAG,GAAGF,KAAK,CAAC,CAAD,CAAf;AACA,QAAIG,KAAK,GAAGH,KAAK,CAAC,CAAD,CAAjB,CALW,CAOX;;AACA,QAAIE,GAAG,KAAK,UAAR,IAAsBA,GAAG,KAAK,cAA9B,IAAgDA,GAAG,KAAK,MAA5D,EAAoE;AAClEH,MAAAA,GAAG,CAACG,GAAD,CAAH,GAAWC,KAAX;AACD,KAFD,MAEO;AACLJ,MAAAA,GAAG,CAACG,GAAD,CAAH,GAAWE,kBAAkB,CAACD,KAAK,CAACE,OAAN,CAAcX,UAAd,EAA0B,GAA1B,CAAD,CAA7B;AACD;AACF;;AACD,SAAOK,GAAP;AACD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n/* eslint-disable complexity, max-statements */\n\nexport function urlParamsToObject(hashOrSearch: string) {\n // Predefine regexs for parsing hash\n var plus2space = /\\+/g;\n var paramSplit = /([^&=]+)=?([^&]*)/g;\n var fragment = hashOrSearch;\n\n // Some hash based routers will automatically add a / character after the hash\n if (fragment.charAt(0) === '#' && fragment.charAt(1) === '/') {\n fragment = fragment.substring(2);\n }\n\n // Remove the leading # or ?\n if (fragment.charAt(0) === '#' || fragment.charAt(0) === '?') {\n fragment = fragment.substring(1);\n }\n\n\n var obj = {};\n\n // Loop until we have no more params\n var param;\n while (true) { // eslint-disable-line no-constant-condition\n param = paramSplit.exec(fragment);\n if (!param) { break; }\n\n var key = param[1];\n var value = param[2];\n\n // id_token should remain base64url encoded\n if (key === 'id_token' || key === 'access_token' || key === 'code') {\n obj[key] = value;\n } else {\n obj[key] = decodeURIComponent(value.replace(plus2space, ' '));\n }\n }\n return obj;\n}\n"],"file":"urlParams.js"}
1
+ {"version":3,"sources":["../../../../lib/oidc/util/urlParams.ts"],"names":["urlParamsToObject","hashOrSearch","plus2space","paramSplit","fragment","charAt","substring","obj","param","exec","key","value","decodeURIComponent","replace"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAEO,SAASA,iBAAT,CAA2BC,YAA3B,EAAiD;AACtD;AACA,MAAIC,UAAU,GAAG,KAAjB;AACA,MAAIC,UAAU,GAAG,oBAAjB;AACA,MAAIC,QAAQ,GAAGH,YAAY,IAAI,EAA/B,CAJsD,CAMtD;;AACA,MAAIG,QAAQ,CAACC,MAAT,CAAgB,CAAhB,MAAuB,GAAvB,IAA8BD,QAAQ,CAACC,MAAT,CAAgB,CAAhB,MAAuB,GAAzD,EAA8D;AAC5DD,IAAAA,QAAQ,GAAGA,QAAQ,CAACE,SAAT,CAAmB,CAAnB,CAAX;AACD,GATqD,CAWtD;;;AACA,MAAIF,QAAQ,CAACC,MAAT,CAAgB,CAAhB,MAAuB,GAAvB,IAA8BD,QAAQ,CAACC,MAAT,CAAgB,CAAhB,MAAuB,GAAzD,EAA8D;AAC5DD,IAAAA,QAAQ,GAAGA,QAAQ,CAACE,SAAT,CAAmB,CAAnB,CAAX;AACD;;AAGD,MAAIC,GAAG,GAAG,EAAV,CAjBsD,CAmBtD;;AACA,MAAIC,KAAJ;;AACA,SAAO,IAAP,EAAa;AAAE;AACbA,IAAAA,KAAK,GAAGL,UAAU,CAACM,IAAX,CAAgBL,QAAhB,CAAR;;AACA,QAAI,CAACI,KAAL,EAAY;AAAE;AAAQ;;AAEtB,QAAIE,GAAG,GAAGF,KAAK,CAAC,CAAD,CAAf;AACA,QAAIG,KAAK,GAAGH,KAAK,CAAC,CAAD,CAAjB,CALW,CAOX;;AACA,QAAIE,GAAG,KAAK,UAAR,IAAsBA,GAAG,KAAK,cAA9B,IAAgDA,GAAG,KAAK,MAA5D,EAAoE;AAClEH,MAAAA,GAAG,CAACG,GAAD,CAAH,GAAWC,KAAX;AACD,KAFD,MAEO;AACLJ,MAAAA,GAAG,CAACG,GAAD,CAAH,GAAWE,kBAAkB,CAACD,KAAK,CAACE,OAAN,CAAcX,UAAd,EAA0B,GAA1B,CAAD,CAA7B;AACD;AACF;;AACD,SAAOK,GAAP;AACD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n/* eslint-disable complexity, max-statements */\n\nexport function urlParamsToObject(hashOrSearch: string) {\n // Predefine regexs for parsing hash\n var plus2space = /\\+/g;\n var paramSplit = /([^&=]+)=?([^&]*)/g;\n var fragment = hashOrSearch || '';\n\n // Some hash based routers will automatically add a / character after the hash\n if (fragment.charAt(0) === '#' && fragment.charAt(1) === '/') {\n fragment = fragment.substring(2);\n }\n\n // Remove the leading # or ?\n if (fragment.charAt(0) === '#' || fragment.charAt(0) === '?') {\n fragment = fragment.substring(1);\n }\n\n\n var obj = {};\n\n // Loop until we have no more params\n var param;\n while (true) { // eslint-disable-line no-constant-condition\n param = paramSplit.exec(fragment);\n if (!param) { break; }\n\n var key = param[1];\n var value = param[2];\n\n // id_token should remain base64url encoded\n if (key === 'id_token' || key === 'access_token' || key === 'code') {\n obj[key] = value;\n } else {\n obj[key] = decodeURIComponent(value.replace(plus2space, ' '));\n }\n }\n return obj;\n}\n"],"file":"urlParams.js"}
package/cjs/options.js CHANGED
@@ -40,6 +40,12 @@ const BROWSER_STORAGE = {
40
40
  },
41
41
  transaction: {
42
42
  storageTypes: ['sessionStorage', 'localStorage', 'cookie']
43
+ },
44
+ 'shared-transaction': {
45
+ storageTypes: ['localStorage']
46
+ },
47
+ 'original-uri': {
48
+ storageTypes: ['localStorage']
43
49
  }
44
50
  };
45
51
  const SERVER_STORAGE = {
@@ -87,17 +93,23 @@ function getCookieSettings(args = {}, isHTTPS) {
87
93
  function getDefaultOptions() {
88
94
  const storageUtil = (0, _features.isBrowser)() ? _browserStorage.default : _serverStorage.default;
89
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
+
90
98
  return {
91
99
  devMode: false,
92
100
  httpRequestClient: _fetchRequest.default,
93
101
  storageUtil,
94
- storageManager
102
+ storageManager,
103
+ transactionManager: {
104
+ enableSharedStorage
105
+ }
95
106
  };
96
107
  }
97
108
 
98
109
  function mergeOptions(options, args) {
99
110
  return Object.assign({}, options, (0, _util.removeNils)(args), {
100
- storageManager: Object.assign({}, options.storageManager, args.storageManager)
111
+ storageManager: Object.assign({}, options.storageManager, args.storageManager),
112
+ transactionManager: Object.assign({}, options.transactionManager, args.transactionManager)
101
113
  });
102
114
  }
103
115
 
@@ -131,6 +143,7 @@ function buildOptions(args = {}) {
131
143
  headers: args.headers,
132
144
  devMode: !!args.devMode,
133
145
  storageManager: args.storageManager,
146
+ transactionManager: args.transactionManager,
134
147
  cookies: (0, _features.isBrowser)() ? getCookieSettings(args, (0, _features.isHTTPS)()) : args.cookies,
135
148
  // Give the developer the ability to disable token signature validation.
136
149
  ignoreSignature: !!args.ignoreSignature,
@@ -1 +1 @@
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","devMode","httpRequestClient","fetchRequest","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,QAHY;AADT,GATsC;AAgB7CG,EAAAA,WAAW,EAAE;AACXH,IAAAA,YAAY,EAAE,CACZ,gBADY,EAEZ,cAFY,EAGZ,QAHY;AADH;AAhBgC,CAA/C;AAyBA,MAAMI,cAAqC,GAAG;AAC5CL,EAAAA,KAAK,EAAE;AACLC,IAAAA,YAAY,EAAE,CACZ,QADY;AADT,GADqC;AAM5CE,EAAAA,KAAK,EAAE;AACLF,IAAAA,YAAY,EAAE,CACZ,QADY;AADT,GANqC;AAW5CG,EAAAA,WAAW,EAAE;AACXH,IAAAA,YAAY,EAAE,CACZ,QADY;AADH;AAX+B,CAA9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BsB,IAAAA,iBAAiB,EAAElC,IAAI,CAACkC,iBApBR;AAqBhBC,IAAAA,kBAAkB,EAAEnC,IAAI,CAACmC,kBArBT;AAsBhBC,IAAAA,kBAAkB,EAAEpC,IAAI,CAACoC,kBAtBT;AAuBhB7B,IAAAA,WAAW,EAAEP,IAAI,CAACO,WAvBF;AAwBhB8B,IAAAA,OAAO,EAAErC,IAAI,CAACqC,OAxBE;AAyBhB1B,IAAAA,OAAO,EAAE,CAAC,CAACX,IAAI,CAACW,OAzBA;AA0BhBD,IAAAA,cAAc,EAAEV,IAAI,CAACU,cA1BL;AA2BhBP,IAAAA,OAAO,EAAE,6BAAcJ,iBAAiB,CAACC,IAAD,EAAO,wBAAP,CAA/B,GAAmDA,IAAI,CAACG,OA3BjD;AA6BhB;AACAmC,IAAAA,eAAe,EAAE,CAAC,CAACtC,IAAI,CAACsC,eA9BR;AAgChB;AACAC,IAAAA,YAAY,EAAEvC,IAAI,CAACuC;AAjCH,GAAX,CAAP;AAmCD","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};\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 return {\n devMode: false,\n httpRequestClient: fetchRequest,\n storageUtil,\n storageManager\n };\n}\n\nfunction mergeOptions(options, args): OktaAuthOptions {\n return Object.assign({}, options, removeNils(args), {\n storageManager: Object.assign({}, options.storageManager, args.storageManager)\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 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
+ {"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","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ACqC,kBArBT;AAsBhBC,IAAAA,kBAAkB,EAAEtC,IAAI,CAACsC,kBAtBT;AAuBhB/B,IAAAA,WAAW,EAAEP,IAAI,CAACO,WAvBF;AAwBhBgC,IAAAA,OAAO,EAAEvC,IAAI,CAACuC,OAxBE;AAyBhB3B,IAAAA,OAAO,EAAE,CAAC,CAACZ,IAAI,CAACY,OAzBA;AA0BhBF,IAAAA,cAAc,EAAEV,IAAI,CAACU,cA1BL;AA2BhBK,IAAAA,kBAAkB,EAAEf,IAAI,CAACe,kBA3BT;AA4BhBZ,IAAAA,OAAO,EAAE,6BAAcJ,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"}
@@ -17,9 +17,10 @@ var _errors = require("../errors");
17
17
  *
18
18
  */
19
19
  const NodeCache = require('node-cache'); // commonJS module cannot be imported without esModuleInterop
20
+ // this is a SHARED memory storage to support a stateless http server
20
21
 
21
22
 
22
- const sharedStorage = new NodeCache(); // this is a SHARED memory storage to support a stateless http server
23
+ const sharedStorage = typeof NodeCache === 'function' ? new NodeCache() : null;
23
24
 
24
25
  class ServerCookies {
25
26
  // NodeCache
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../lib/server/serverStorage.ts"],"names":["NodeCache","require","sharedStorage","ServerCookies","constructor","nodeCache","set","name","value","expiresAt","Date","parse","ttl","now","get","delete","del","ServerStorage","storage","testStorageType","storageType","supported","getStorageByType","storageProvider","getStorage","AuthSdkError","findStorageType","getHttpCache","getItem","setItem","key"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,MAAMA,SAAS,GAAGC,OAAO,CAAC,YAAD,CAAzB,C,CAAyC;;;AACzC,MAAMC,aAAa,GAAG,IAAIF,SAAJ,EAAtB,C,CAAuC;;AAEvC,MAAMG,aAAN,CAAuC;AACrB;AAEhBC,EAAAA,WAAW,CAACC,SAAD,EAAY;AACrB,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AAEDC,EAAAA,GAAG,CAACC,IAAD,EAAeC,KAAf,EAA8BC,SAA9B,EAAyD;AAC1D;AACA,QAAI,CAAC,CAAEC,IAAI,CAACC,KAAL,CAAWF,SAAX,CAAP,EAA+B;AAC7B;AACA,UAAIG,GAAG,GAAG,CAACF,IAAI,CAACC,KAAL,CAAWF,SAAX,IAAwBC,IAAI,CAACG,GAAL,EAAzB,IAAuC,IAAjD;AACA,WAAKR,SAAL,CAAeC,GAAf,CAAmBC,IAAnB,EAAyBC,KAAzB,EAAgCI,GAAhC;AACD,KAJD,MAIO;AACL,WAAKP,SAAL,CAAeC,GAAf,CAAmBC,IAAnB,EAAyBC,KAAzB;AACD;;AAED,WAAO,KAAKM,GAAL,CAASP,IAAT,CAAP;AACD;;AAEDO,EAAAA,GAAG,CAACP,IAAD,EAAe;AAChB,WAAO,KAAKF,SAAL,CAAeS,GAAf,CAAmBP,IAAnB,CAAP;AACD;;AAEDQ,EAAAA,MAAM,CAACR,IAAD,EAAO;AACX,WAAO,KAAKF,SAAL,CAAeW,GAAf,CAAmBT,IAAnB,CAAP;AACD;;AA1BoC,C,CA4BvC;;;AACA,MAAMU,aAAN,CAA2C;AACzB;AAEhBb,EAAAA,WAAW,CAACC,SAAD,EAAY;AACrB,SAAKA,SAAL,GAAiBA,SAAjB;AACA,SAAKa,OAAL,GAAe,IAAIf,aAAJ,CAAkBE,SAAlB,CAAf;AACD;;AAEDc,EAAAA,eAAe,CAACC,WAAD,EAAoC;AACjD,QAAIC,SAAS,GAAG,KAAhB;;AACA,YAAQD,WAAR;AACE,WAAK,QAAL;AACEC,QAAAA,SAAS,GAAG,IAAZ;AACA;;AACF;AACE;AALJ;;AAOA,WAAOA,SAAP;AACD;;AAEDC,EAAAA,gBAAgB,CAACF,WAAD,EAA0C;AACxD,QAAIG,eAAe,GAAG,IAAtB;;AACA,YAAQH,WAAR;AACE,WAAK,QAAL;AACEG,QAAAA,eAAe,GAAG,KAAKC,UAAL,EAAlB;AACA;;AACF;AACE,cAAM,IAAIC,oBAAJ,CAAkB,gCAA+BL,WAAY,EAA7D,CAAN;AACA;AANJ;;AAQA,WAAOG,eAAP;AACD;;AAEDG,EAAAA,eAAe,GAAgB;AAC7B,WAAO,QAAP;AACD,GAnCwC,CAqCzC;;;AACAC,EAAAA,YAAY,GAAG;AACb,WAAO,IAAP,CADa,CACA;AACd,GAxCwC,CA0CzC;;;AACAH,EAAAA,UAAU,GAAkB;AAC1B,WAAO;AACLI,MAAAA,OAAO,EAAE,KAAKvB,SAAL,CAAeS,GADnB;AAELe,MAAAA,OAAO,EAAE,CAACC,GAAD,EAAMtB,KAAN,KAAgB;AACvB,aAAKH,SAAL,CAAeC,GAAf,CAAmBwB,GAAnB,EAAwBtB,KAAxB,EAA+B,0BAA/B;AACD;AAJI,KAAP;AAMD;;AAlDwC;;eAqD5B,IAAIS,aAAJ,CAAkBf,aAAlB,C","sourcesContent":["/*!\n * Copyright (c) 2018-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n\nimport { SimpleStorage, StorageType, StorageUtil, Cookies } from '../types';\nimport { AuthSdkError } from '../errors';\nconst NodeCache = require('node-cache'); // commonJS module cannot be imported without esModuleInterop\nconst sharedStorage = new NodeCache(); // this is a SHARED memory storage to support a stateless http server\n\nclass ServerCookies implements Cookies {\n nodeCache: any; // NodeCache\n \n constructor(nodeCache) {\n this.nodeCache = nodeCache;\n }\n\n set(name: string, value: string, expiresAt: string): string {\n // eslint-disable-next-line no-extra-boolean-cast\n if (!!(Date.parse(expiresAt))) {\n // Time to expiration in seconds\n var ttl = (Date.parse(expiresAt) - Date.now()) / 1000;\n this.nodeCache.set(name, value, ttl);\n } else {\n this.nodeCache.set(name, value);\n }\n\n return this.get(name);\n }\n\n get(name): string {\n return this.nodeCache.get(name);\n }\n\n delete(name) {\n return this.nodeCache.del(name);\n }\n}\n// Building this as an object allows us to mock the functions in our tests\nclass ServerStorage implements StorageUtil {\n nodeCache: any; // NodeCache\n storage: Cookies;\n constructor(nodeCache) {\n this.nodeCache = nodeCache;\n this.storage = new ServerCookies(nodeCache);\n }\n\n testStorageType(storageType: StorageType): boolean {\n var supported = false;\n switch (storageType) {\n case 'memory':\n supported = true;\n break;\n default:\n break;\n }\n return supported;\n }\n\n getStorageByType(storageType: StorageType): SimpleStorage {\n let storageProvider = null;\n switch (storageType) {\n case 'memory':\n storageProvider = this.getStorage();\n break;\n default:\n throw new AuthSdkError(`Unrecognized storage option: ${storageType}`);\n break;\n }\n return storageProvider;\n }\n\n findStorageType(): StorageType {\n return 'memory';\n }\n\n // will be removed in next version. OKTA-362589\n getHttpCache() {\n return null; // stubbed in server.js\n }\n\n // shared in-memory using node cache\n getStorage(): SimpleStorage {\n return {\n getItem: this.nodeCache.get,\n setItem: (key, value) => {\n this.nodeCache.set(key, value, '2200-01-01T00:00:00.000Z');\n }\n };\n }\n}\n\nexport default new ServerStorage(sharedStorage);\n"],"file":"serverStorage.js"}
1
+ {"version":3,"sources":["../../../lib/server/serverStorage.ts"],"names":["NodeCache","require","sharedStorage","ServerCookies","constructor","nodeCache","set","name","value","expiresAt","Date","parse","ttl","now","get","delete","del","ServerStorage","storage","testStorageType","storageType","supported","getStorageByType","storageProvider","getStorage","AuthSdkError","findStorageType","getHttpCache","getItem","setItem","key"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,MAAMA,SAAS,GAAGC,OAAO,CAAC,YAAD,CAAzB,C,CAAyC;AAEzC;;;AACA,MAAMC,aAAa,GAAG,OAAOF,SAAP,KAAqB,UAArB,GAAkC,IAAIA,SAAJ,EAAlC,GAAoD,IAA1E;;AAEA,MAAMG,aAAN,CAAuC;AACrB;AAEhBC,EAAAA,WAAW,CAACC,SAAD,EAAY;AACrB,SAAKA,SAAL,GAAiBA,SAAjB;AACD;;AAEDC,EAAAA,GAAG,CAACC,IAAD,EAAeC,KAAf,EAA8BC,SAA9B,EAAyD;AAC1D;AACA,QAAI,CAAC,CAAEC,IAAI,CAACC,KAAL,CAAWF,SAAX,CAAP,EAA+B;AAC7B;AACA,UAAIG,GAAG,GAAG,CAACF,IAAI,CAACC,KAAL,CAAWF,SAAX,IAAwBC,IAAI,CAACG,GAAL,EAAzB,IAAuC,IAAjD;AACA,WAAKR,SAAL,CAAeC,GAAf,CAAmBC,IAAnB,EAAyBC,KAAzB,EAAgCI,GAAhC;AACD,KAJD,MAIO;AACL,WAAKP,SAAL,CAAeC,GAAf,CAAmBC,IAAnB,EAAyBC,KAAzB;AACD;;AAED,WAAO,KAAKM,GAAL,CAASP,IAAT,CAAP;AACD;;A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AA/B;AACD;AAJI,KAAP;AAMD;;AAlDwC;;eAqD5B,IAAIS,aAAJ,CAAkBf,aAAlB,C","sourcesContent":["/*!\n * Copyright (c) 2018-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n\nimport { SimpleStorage, StorageType, StorageUtil, Cookies } from '../types';\nimport { AuthSdkError } from '../errors';\nconst NodeCache = require('node-cache'); // commonJS module cannot be imported without esModuleInterop\n\n// this is a SHARED memory storage to support a stateless http server\nconst sharedStorage = typeof NodeCache === 'function' ? new NodeCache() : null;\n\nclass ServerCookies implements Cookies {\n nodeCache: any; // NodeCache\n \n constructor(nodeCache) {\n this.nodeCache = nodeCache;\n }\n\n set(name: string, value: string, expiresAt: string): string {\n // eslint-disable-next-line no-extra-boolean-cast\n if (!!(Date.parse(expiresAt))) {\n // Time to expiration in seconds\n var ttl = (Date.parse(expiresAt) - Date.now()) / 1000;\n this.nodeCache.set(name, value, ttl);\n } else {\n this.nodeCache.set(name, value);\n }\n\n return this.get(name);\n }\n\n get(name): string {\n return this.nodeCache.get(name);\n }\n\n delete(name) {\n return this.nodeCache.del(name);\n }\n}\n// Building this as an object allows us to mock the functions in our tests\nclass ServerStorage implements StorageUtil {\n nodeCache: any; // NodeCache\n storage: Cookies;\n constructor(nodeCache) {\n this.nodeCache = nodeCache;\n this.storage = new ServerCookies(nodeCache);\n }\n\n testStorageType(storageType: StorageType): boolean {\n var supported = false;\n switch (storageType) {\n case 'memory':\n supported = true;\n break;\n default:\n break;\n }\n return supported;\n }\n\n getStorageByType(storageType: StorageType): SimpleStorage {\n let storageProvider = null;\n switch (storageType) {\n case 'memory':\n storageProvider = this.getStorage();\n break;\n default:\n throw new AuthSdkError(`Unrecognized storage option: ${storageType}`);\n break;\n }\n return storageProvider;\n }\n\n findStorageType(): StorageType {\n return 'memory';\n }\n\n // will be removed in next version. OKTA-362589\n getHttpCache() {\n return null; // stubbed in server.js\n }\n\n // shared in-memory using node cache\n getStorage(): SimpleStorage {\n return {\n getItem: this.nodeCache.get,\n setItem: (key, value) => {\n this.nodeCache.set(key, value, '2200-01-01T00:00:00.000Z');\n }\n };\n }\n}\n\nexport default new ServerStorage(sharedStorage);\n"],"file":"serverStorage.js"}
@@ -142,9 +142,7 @@ function link2fn(sdk, res, obj, link, ref) {
142
142
  }
143
143
 
144
144
  var href = link.href + (0, _util.toQueryString)(params);
145
- return (0, _api.postToTransaction)(sdk, href, data, {
146
- withCredentials: true
147
- });
145
+ return (0, _api.postToTransaction)(sdk, href, data);
148
146
  };
149
147
  }
150
148
  }