@okta/okta-auth-js 5.7.0 → 5.10.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 (449) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +12 -2
  3. package/cjs/OktaAuth.js +88 -43
  4. package/cjs/OktaAuth.js.map +1 -1
  5. package/cjs/OktaUserAgent.js +2 -2
  6. package/cjs/OktaUserAgent.js.map +1 -1
  7. package/cjs/StorageManager.js +8 -0
  8. package/cjs/StorageManager.js.map +1 -1
  9. package/cjs/TokenManager.js +24 -2
  10. package/cjs/TokenManager.js.map +1 -1
  11. package/cjs/TransactionManager.js +24 -12
  12. package/cjs/TransactionManager.js.map +1 -1
  13. package/cjs/constants.js +3 -1
  14. package/cjs/constants.js.map +1 -1
  15. package/cjs/features.js +1 -1
  16. package/cjs/features.js.map +1 -1
  17. package/cjs/idx/authenticate.js +3 -18
  18. package/cjs/idx/authenticate.js.map +1 -1
  19. package/cjs/idx/authenticator/Authenticator.js +14 -0
  20. package/cjs/idx/authenticator/Authenticator.js.map +1 -0
  21. package/cjs/idx/authenticator/OktaPassword.js +31 -0
  22. package/cjs/idx/authenticator/OktaPassword.js.map +1 -0
  23. package/cjs/idx/authenticator/OktaVerifyTotp.js +17 -0
  24. package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -0
  25. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +50 -0
  26. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -0
  27. package/cjs/idx/authenticator/SecurityQuestionVerification.js +31 -0
  28. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -0
  29. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +34 -0
  30. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -0
  31. package/cjs/idx/authenticator/getAuthenticator.js +42 -0
  32. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -0
  33. package/cjs/idx/authenticator/index.js +80 -0
  34. package/cjs/idx/authenticator/index.js.map +1 -0
  35. package/cjs/idx/cancel.js +5 -0
  36. package/cjs/idx/cancel.js.map +1 -1
  37. package/cjs/idx/flow/AuthenticationFlow.js +32 -0
  38. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
  39. package/cjs/idx/flow/FlowSpecification.js +39 -0
  40. package/cjs/idx/flow/FlowSpecification.js.map +1 -0
  41. package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
  42. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
  43. package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +16 -12
  44. package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
  45. package/cjs/idx/flow/RemediationFlow.js +2 -0
  46. package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
  47. package/cjs/idx/flow/index.js +67 -0
  48. package/cjs/idx/flow/index.js.map +1 -0
  49. package/cjs/idx/index.js +39 -0
  50. package/cjs/idx/index.js.map +1 -1
  51. package/cjs/idx/interact.js +13 -4
  52. package/cjs/idx/interact.js.map +1 -1
  53. package/cjs/idx/introspect.js +24 -7
  54. package/cjs/idx/introspect.js.map +1 -1
  55. package/cjs/idx/poll.js +59 -0
  56. package/cjs/idx/poll.js.map +1 -0
  57. package/cjs/idx/proceed.js +49 -0
  58. package/cjs/idx/proceed.js.map +1 -0
  59. package/cjs/idx/recoverPassword.js +3 -17
  60. package/cjs/idx/recoverPassword.js.map +1 -1
  61. package/cjs/idx/register.js +22 -20
  62. package/cjs/idx/register.js.map +1 -1
  63. package/cjs/idx/remediate.js +61 -118
  64. package/cjs/idx/remediate.js.map +1 -1
  65. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +9 -12
  66. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  67. package/cjs/idx/remediators/AuthenticatorVerificationData.js +6 -9
  68. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  69. package/cjs/idx/remediators/Base/AuthenticatorData.js +43 -32
  70. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  71. package/cjs/idx/remediators/Base/Remediator.js +51 -20
  72. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  73. package/cjs/idx/remediators/Base/SelectAuthenticator.js +16 -16
  74. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  75. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +8 -28
  76. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  77. package/{esm/idx/remediators/RedirectIdp.js → cjs/idx/remediators/ChallengePoll.js} +13 -25
  78. package/cjs/idx/remediators/ChallengePoll.js.map +1 -0
  79. package/cjs/idx/remediators/EnrollPoll.js +56 -0
  80. package/cjs/idx/remediators/EnrollPoll.js.map +1 -0
  81. package/cjs/idx/remediators/Identify.js +4 -36
  82. package/cjs/idx/remediators/Identify.js.map +1 -1
  83. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +23 -2
  84. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  85. package/cjs/idx/remediators/Skip.js +7 -0
  86. package/cjs/idx/remediators/Skip.js.map +1 -1
  87. package/cjs/idx/remediators/index.js +26 -0
  88. package/cjs/idx/remediators/index.js.map +1 -1
  89. package/cjs/idx/run.js +36 -16
  90. package/cjs/idx/run.js.map +1 -1
  91. package/cjs/idx/startTransaction.js +2 -0
  92. package/cjs/idx/startTransaction.js.map +1 -1
  93. package/cjs/idx/transactionMeta.js +77 -39
  94. package/cjs/idx/transactionMeta.js.map +1 -1
  95. package/cjs/idx/types/FlowIdentifier.js +2 -0
  96. package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
  97. package/cjs/idx/types/idx-js.js +5 -0
  98. package/cjs/idx/types/idx-js.js.map +1 -1
  99. package/cjs/idx/types/index.js +18 -1
  100. package/cjs/idx/types/index.js.map +1 -1
  101. package/cjs/oidc/endpoints/authorize.js +4 -1
  102. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  103. package/cjs/oidc/getWithRedirect.js +2 -6
  104. package/cjs/oidc/getWithRedirect.js.map +1 -1
  105. package/cjs/oidc/util/loginRedirect.js +9 -5
  106. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  107. package/cjs/oidc/util/urlParams.js +1 -1
  108. package/cjs/oidc/util/urlParams.js.map +1 -1
  109. package/cjs/options.js +12 -2
  110. package/cjs/options.js.map +1 -1
  111. package/cjs/server/serverStorage.js +2 -1
  112. package/cjs/server/serverStorage.js.map +1 -1
  113. package/cjs/types/Token.js.map +1 -1
  114. package/cjs/types/Transaction.js.map +1 -1
  115. package/{esm/clock.js → cjs/util/emailVerify.js} +14 -18
  116. package/cjs/util/emailVerify.js.map +1 -0
  117. package/cjs/util/index.js +13 -0
  118. package/cjs/util/index.js.map +1 -1
  119. package/dist/okta-auth-js.min.js +2 -74
  120. package/dist/okta-auth-js.min.js.LICENSE.txt +32 -0
  121. package/dist/okta-auth-js.min.js.map +1 -1
  122. package/dist/okta-auth-js.polyfill.js +2 -18
  123. package/{esm/crypto/webcrypto.js → dist/okta-auth-js.polyfill.js.LICENSE.txt} +8 -4
  124. package/dist/okta-auth-js.polyfill.js.map +1 -1
  125. package/dist/okta-auth-js.umd.js +2 -74
  126. package/dist/okta-auth-js.umd.js.LICENSE.txt +32 -0
  127. package/dist/okta-auth-js.umd.js.map +1 -1
  128. package/esm/index.js +8580 -16
  129. package/esm/index.js.map +1 -1
  130. package/lib/OktaAuth.d.ts +6 -3
  131. package/lib/StorageManager.d.ts +1 -0
  132. package/lib/TokenManager.d.ts +2 -0
  133. package/lib/TransactionManager.d.ts +5 -1
  134. package/lib/constants.d.ts +1 -0
  135. package/lib/crypto/base64.d.ts +2 -2
  136. package/lib/crypto/oidcHash.d.ts +1 -1
  137. package/lib/crypto/verifyToken.d.ts +1 -1
  138. package/lib/idx/authenticator/Authenticator.d.ts +12 -0
  139. package/lib/idx/authenticator/OktaPassword.d.ts +11 -0
  140. package/lib/idx/authenticator/OktaVerifyTotp.d.ts +9 -0
  141. package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +28 -0
  142. package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +14 -0
  143. package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +10 -0
  144. package/lib/idx/authenticator/getAuthenticator.d.ts +3 -0
  145. package/lib/idx/authenticator/index.d.ts +6 -0
  146. package/{esm/oidc/endpoints/index.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -5
  147. package/lib/idx/flow/FlowSpecification.d.ts +8 -0
  148. package/{esm/crypto/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -6
  149. package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
  150. package/lib/idx/flow/RemediationFlow.d.ts +13 -0
  151. package/lib/idx/{flowMonitors → flow}/index.d.ts +5 -4
  152. package/lib/idx/index.d.ts +3 -0
  153. package/lib/idx/interact.d.ts +1 -0
  154. package/lib/idx/introspect.d.ts +2 -1
  155. package/lib/idx/poll.d.ts +13 -0
  156. package/lib/idx/proceed.d.ts +21 -0
  157. package/lib/idx/register.d.ts +1 -1
  158. package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +9 -5
  159. package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +0 -1
  160. package/lib/idx/remediators/Base/AuthenticatorData.d.ts +8 -3
  161. package/lib/idx/remediators/Base/Remediator.d.ts +9 -6
  162. package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +5 -4
  163. package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +8 -4
  164. package/lib/idx/remediators/ChallengePoll.d.ts +15 -0
  165. package/{esm/tx/util.js → lib/idx/remediators/EnrollPoll.d.ts} +11 -13
  166. package/lib/idx/remediators/Identify.d.ts +1 -3
  167. package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +6 -2
  168. package/lib/idx/remediators/Skip.d.ts +3 -0
  169. package/lib/idx/remediators/index.d.ts +2 -0
  170. package/lib/idx/run.d.ts +8 -9
  171. package/lib/idx/transactionMeta.d.ts +28 -4
  172. package/lib/idx/types/FlowIdentifier.d.ts +1 -0
  173. package/lib/idx/types/idx-js.d.ts +53 -1
  174. package/lib/idx/types/index.d.ts +18 -4
  175. package/lib/oidc/util/loginRedirect.d.ts +1 -1
  176. package/lib/types/OktaAuthOptions.d.ts +3 -0
  177. package/lib/types/Token.d.ts +1 -0
  178. package/lib/types/Transaction.d.ts +2 -0
  179. package/lib/types/api.d.ts +15 -2
  180. package/lib/{idx/flowMonitors/AuthenticationFlowMonitor.d.ts → util/emailVerify.d.ts} +5 -3
  181. package/lib/util/index.d.ts +1 -0
  182. package/package.json +22 -13
  183. package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -45
  184. package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  185. package/cjs/idx/flowMonitors/FlowMonitor.js +0 -69
  186. package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
  187. package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -55
  188. package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  189. package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js +0 -35
  190. package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  191. package/cjs/idx/flowMonitors/index.js +0 -54
  192. package/cjs/idx/flowMonitors/index.js.map +0 -1
  193. package/esm/AuthStateManager.js +0 -214
  194. package/esm/AuthStateManager.js.map +0 -1
  195. package/esm/OktaAuth.js +0 -681
  196. package/esm/OktaAuth.js.map +0 -1
  197. package/esm/OktaUserAgent.js +0 -49
  198. package/esm/OktaUserAgent.js.map +0 -1
  199. package/esm/PromiseQueue.js +0 -71
  200. package/esm/PromiseQueue.js.map +0 -1
  201. package/esm/SavedObject.js +0 -91
  202. package/esm/SavedObject.js.map +0 -1
  203. package/esm/StorageManager.js +0 -182
  204. package/esm/StorageManager.js.map +0 -1
  205. package/esm/TokenManager.js +0 -455
  206. package/esm/TokenManager.js.map +0 -1
  207. package/esm/TransactionManager.js +0 -316
  208. package/esm/TransactionManager.js.map +0 -1
  209. package/esm/browser/browserStorage.js +0 -256
  210. package/esm/browser/browserStorage.js.map +0 -1
  211. package/esm/browser/fingerprint.js +0 -74
  212. package/esm/browser/fingerprint.js.map +0 -1
  213. package/esm/builderUtil.js +0 -56
  214. package/esm/builderUtil.js.map +0 -1
  215. package/esm/clock.js.map +0 -1
  216. package/esm/constants.js +0 -35
  217. package/esm/constants.js.map +0 -1
  218. package/esm/crypto/base64.js +0 -66
  219. package/esm/crypto/base64.js.map +0 -1
  220. package/esm/crypto/browser.js.map +0 -1
  221. package/esm/crypto/index.js.map +0 -1
  222. package/esm/crypto/node.js +0 -54
  223. package/esm/crypto/node.js.map +0 -1
  224. package/esm/crypto/oidcHash.js +0 -27
  225. package/esm/crypto/oidcHash.js.map +0 -1
  226. package/esm/crypto/verifyToken.js +0 -39
  227. package/esm/crypto/verifyToken.js.map +0 -1
  228. package/esm/crypto/webcrypto.js.map +0 -1
  229. package/esm/errors/AuthApiError.js +0 -30
  230. package/esm/errors/AuthApiError.js.map +0 -1
  231. package/esm/errors/AuthPollStopError.js +0 -20
  232. package/esm/errors/AuthPollStopError.js.map +0 -1
  233. package/esm/errors/AuthSdkError.js +0 -29
  234. package/esm/errors/AuthSdkError.js.map +0 -1
  235. package/esm/errors/CustomError.js +0 -21
  236. package/esm/errors/CustomError.js.map +0 -1
  237. package/esm/errors/OAuthError.js +0 -22
  238. package/esm/errors/OAuthError.js.map +0 -1
  239. package/esm/errors/index.js +0 -22
  240. package/esm/errors/index.js.map +0 -1
  241. package/esm/features.js +0 -64
  242. package/esm/features.js.map +0 -1
  243. package/esm/fetch/fetchRequest.js +0 -92
  244. package/esm/fetch/fetchRequest.js.map +0 -1
  245. package/esm/http/headers.js +0 -17
  246. package/esm/http/headers.js.map +0 -1
  247. package/esm/http/index.js +0 -3
  248. package/esm/http/index.js.map +0 -1
  249. package/esm/http/request.js +0 -145
  250. package/esm/http/request.js.map +0 -1
  251. package/esm/idx/authenticate.js +0 -47
  252. package/esm/idx/authenticate.js.map +0 -1
  253. package/esm/idx/cancel.js +0 -32
  254. package/esm/idx/cancel.js.map +0 -1
  255. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
  256. package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
  257. package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
  258. package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
  259. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
  260. package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
  261. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
  262. package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
  263. package/esm/idx/flowMonitors/index.js +0 -16
  264. package/esm/idx/flowMonitors/index.js.map +0 -1
  265. package/esm/idx/handleInteractionCodeRedirect.js +0 -64
  266. package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
  267. package/esm/idx/headers.js +0 -39
  268. package/esm/idx/headers.js.map +0 -1
  269. package/esm/idx/index.js +0 -20
  270. package/esm/idx/index.js.map +0 -1
  271. package/esm/idx/interact.js +0 -83
  272. package/esm/idx/interact.js.map +0 -1
  273. package/esm/idx/introspect.js +0 -45
  274. package/esm/idx/introspect.js.map +0 -1
  275. package/esm/idx/recoverPassword.js +0 -46
  276. package/esm/idx/recoverPassword.js.map +0 -1
  277. package/esm/idx/register.js +0 -63
  278. package/esm/idx/register.js.map +0 -1
  279. package/esm/idx/remediate.js +0 -302
  280. package/esm/idx/remediate.js.map +0 -1
  281. package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
  282. package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
  283. package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
  284. package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
  285. package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
  286. package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
  287. package/esm/idx/remediators/Base/Remediator.js +0 -221
  288. package/esm/idx/remediators/Base/Remediator.js.map +0 -1
  289. package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
  290. package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
  291. package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -65
  292. package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
  293. package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
  294. package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
  295. package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
  296. package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
  297. package/esm/idx/remediators/EnrollProfile.js +0 -79
  298. package/esm/idx/remediators/EnrollProfile.js.map +0 -1
  299. package/esm/idx/remediators/Identify.js +0 -87
  300. package/esm/idx/remediators/Identify.js.map +0 -1
  301. package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
  302. package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
  303. package/esm/idx/remediators/RedirectIdp.js.map +0 -1
  304. package/esm/idx/remediators/ResetAuthenticator.js +0 -18
  305. package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
  306. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
  307. package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
  308. package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
  309. package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
  310. package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
  311. package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
  312. package/esm/idx/remediators/Skip.js +0 -23
  313. package/esm/idx/remediators/Skip.js.map +0 -1
  314. package/esm/idx/remediators/index.js +0 -26
  315. package/esm/idx/remediators/index.js.map +0 -1
  316. package/esm/idx/remediators/util.js +0 -35
  317. package/esm/idx/remediators/util.js.map +0 -1
  318. package/esm/idx/run.js +0 -201
  319. package/esm/idx/run.js.map +0 -1
  320. package/esm/idx/startTransaction.js +0 -27
  321. package/esm/idx/startTransaction.js.map +0 -1
  322. package/esm/idx/transactionMeta.js +0 -114
  323. package/esm/idx/transactionMeta.js.map +0 -1
  324. package/esm/idx/types/idx-js.js +0 -17
  325. package/esm/idx/types/idx-js.js.map +0 -1
  326. package/esm/idx/types/index.js +0 -44
  327. package/esm/idx/types/index.js.map +0 -1
  328. package/esm/oidc/decodeToken.js +0 -31
  329. package/esm/oidc/decodeToken.js.map +0 -1
  330. package/esm/oidc/endpoints/authorize.js +0 -61
  331. package/esm/oidc/endpoints/authorize.js.map +0 -1
  332. package/esm/oidc/endpoints/index.js.map +0 -1
  333. package/esm/oidc/endpoints/token.js +0 -97
  334. package/esm/oidc/endpoints/token.js.map +0 -1
  335. package/esm/oidc/endpoints/well-known.js +0 -58
  336. package/esm/oidc/endpoints/well-known.js.map +0 -1
  337. package/esm/oidc/exchangeCodeForTokens.js +0 -69
  338. package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
  339. package/esm/oidc/getToken.js +0 -180
  340. package/esm/oidc/getToken.js.map +0 -1
  341. package/esm/oidc/getUserInfo.js +0 -82
  342. package/esm/oidc/getUserInfo.js.map +0 -1
  343. package/esm/oidc/getWithPopup.js +0 -34
  344. package/esm/oidc/getWithPopup.js.map +0 -1
  345. package/esm/oidc/getWithRedirect.js +0 -65
  346. package/esm/oidc/getWithRedirect.js.map +0 -1
  347. package/esm/oidc/getWithoutPrompt.js +0 -29
  348. package/esm/oidc/getWithoutPrompt.js.map +0 -1
  349. package/esm/oidc/handleOAuthResponse.js +0 -148
  350. package/esm/oidc/handleOAuthResponse.js.map +0 -1
  351. package/esm/oidc/index.js +0 -29
  352. package/esm/oidc/index.js.map +0 -1
  353. package/esm/oidc/parseFromUrl.js +0 -144
  354. package/esm/oidc/parseFromUrl.js.map +0 -1
  355. package/esm/oidc/renewToken.js +0 -85
  356. package/esm/oidc/renewToken.js.map +0 -1
  357. package/esm/oidc/renewTokens.js +0 -74
  358. package/esm/oidc/renewTokens.js.map +0 -1
  359. package/esm/oidc/renewTokensWithRefresh.js +0 -55
  360. package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
  361. package/esm/oidc/revokeToken.js +0 -57
  362. package/esm/oidc/revokeToken.js.map +0 -1
  363. package/esm/oidc/util/browser.js +0 -74
  364. package/esm/oidc/util/browser.js.map +0 -1
  365. package/esm/oidc/util/defaultTokenParams.js +0 -42
  366. package/esm/oidc/util/defaultTokenParams.js.map +0 -1
  367. package/esm/oidc/util/errors.js +0 -31
  368. package/esm/oidc/util/errors.js.map +0 -1
  369. package/esm/oidc/util/index.js +0 -25
  370. package/esm/oidc/util/index.js.map +0 -1
  371. package/esm/oidc/util/loginRedirect.js +0 -84
  372. package/esm/oidc/util/loginRedirect.js.map +0 -1
  373. package/esm/oidc/util/oauth.js +0 -70
  374. package/esm/oidc/util/oauth.js.map +0 -1
  375. package/esm/oidc/util/pkce.js +0 -55
  376. package/esm/oidc/util/pkce.js.map +0 -1
  377. package/esm/oidc/util/prepareTokenParams.js +0 -75
  378. package/esm/oidc/util/prepareTokenParams.js.map +0 -1
  379. package/esm/oidc/util/refreshToken.js +0 -24
  380. package/esm/oidc/util/refreshToken.js.map +0 -1
  381. package/esm/oidc/util/urlParams.js +0 -54
  382. package/esm/oidc/util/urlParams.js.map +0 -1
  383. package/esm/oidc/util/validateClaims.js +0 -53
  384. package/esm/oidc/util/validateClaims.js.map +0 -1
  385. package/esm/oidc/util/validateToken.js +0 -21
  386. package/esm/oidc/util/validateToken.js.map +0 -1
  387. package/esm/oidc/verifyToken.js +0 -78
  388. package/esm/oidc/verifyToken.js.map +0 -1
  389. package/esm/options.js +0 -134
  390. package/esm/options.js.map +0 -1
  391. package/esm/server/serverStorage.js +0 -110
  392. package/esm/server/serverStorage.js.map +0 -1
  393. package/esm/services/TokenService.js +0 -103
  394. package/esm/services/TokenService.js.map +0 -1
  395. package/esm/session.js +0 -81
  396. package/esm/session.js.map +0 -1
  397. package/esm/tx/AuthTransaction.js +0 -213
  398. package/esm/tx/AuthTransaction.js.map +0 -1
  399. package/esm/tx/TransactionState.js.map +0 -1
  400. package/esm/tx/api.js +0 -87
  401. package/esm/tx/api.js.map +0 -1
  402. package/esm/tx/index.js +0 -18
  403. package/esm/tx/index.js.map +0 -1
  404. package/esm/tx/poll.js +0 -124
  405. package/esm/tx/poll.js.map +0 -1
  406. package/esm/tx/util.js.map +0 -1
  407. package/esm/types/AuthState.js +0 -3
  408. package/esm/types/Cookies.js +0 -3
  409. package/esm/types/EventEmitter.js +0 -3
  410. package/esm/types/EventEmitter.js.map +0 -1
  411. package/esm/types/JWT.js +0 -3
  412. package/esm/types/JWT.js.map +0 -1
  413. package/esm/types/OAuth.js +0 -3
  414. package/esm/types/OAuth.js.map +0 -1
  415. package/esm/types/OktaAuthOptions.js +0 -3
  416. package/esm/types/OktaAuthOptions.js.map +0 -1
  417. package/esm/types/Storage.js +0 -3
  418. package/esm/types/Storage.js.map +0 -1
  419. package/esm/types/Token.js +0 -29
  420. package/esm/types/Token.js.map +0 -1
  421. package/esm/types/TokenManager.js +0 -3
  422. package/esm/types/TokenManager.js.map +0 -1
  423. package/esm/types/Transaction.js +0 -57
  424. package/esm/types/Transaction.js.map +0 -1
  425. package/esm/types/UserClaims.js +0 -3
  426. package/esm/types/UserClaims.js.map +0 -1
  427. package/esm/types/api.js +0 -3
  428. package/esm/types/api.js.map +0 -1
  429. package/esm/types/http.js +0 -3
  430. package/esm/types/http.js.map +0 -1
  431. package/esm/types/index.js +0 -27
  432. package/esm/types/index.js.map +0 -1
  433. package/esm/util/console.js +0 -53
  434. package/esm/util/console.js.map +0 -1
  435. package/esm/util/index.js +0 -17
  436. package/esm/util/index.js.map +0 -1
  437. package/esm/util/misc.js +0 -33
  438. package/esm/util/misc.js.map +0 -1
  439. package/esm/util/object.js +0 -117
  440. package/esm/util/object.js.map +0 -1
  441. package/esm/util/sharedStorage.js +0 -43
  442. package/esm/util/sharedStorage.js.map +0 -1
  443. package/esm/util/types.js +0 -27
  444. package/esm/util/types.js.map +0 -1
  445. package/esm/util/url.js +0 -64
  446. package/esm/util/url.js.map +0 -1
  447. package/lib/idx/flowMonitors/FlowMonitor.d.ts +0 -23
  448. package/lib/idx/flowMonitors/PasswordRecoveryFlowMonitor.d.ts +0 -16
  449. package/lib/idx/flowMonitors/RegistrationFlowMonitor.d.ts +0 -15
package/esm/oidc/index.js DELETED
@@ -1,29 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
- *
5
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
- * Unless required by applicable law or agreed to in writing, software
7
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
- *
10
- * See the License for the specific language governing permissions and limitations under the License.
11
- *
12
- */
13
- export * from './endpoints';
14
- export * from './util';
15
- export { decodeToken } from './decodeToken';
16
- export { revokeToken } from './revokeToken';
17
- export { renewToken } from './renewToken';
18
- export { renewTokensWithRefresh } from './renewTokensWithRefresh';
19
- export { renewTokens } from './renewTokens';
20
- export { verifyToken } from './verifyToken';
21
- export { getUserInfo } from './getUserInfo';
22
- export { handleOAuthResponse } from './handleOAuthResponse';
23
- export { exchangeCodeForTokens } from './exchangeCodeForTokens';
24
- export { getToken } from './getToken';
25
- export { getWithoutPrompt } from './getWithoutPrompt';
26
- export { getWithPopup } from './getWithPopup';
27
- export { getWithRedirect } from './getWithRedirect';
28
- export { parseFromUrl } from './parseFromUrl';
29
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/oidc/index.ts"],"names":["decodeToken","revokeToken","renewToken","renewTokensWithRefresh","renewTokens","verifyToken","getUserInfo","handleOAuthResponse","exchangeCodeForTokens","getToken","getWithoutPrompt","getWithPopup","getWithRedirect","parseFromUrl"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAd;AACA,cAAc,QAAd;AAEA,SAASA,WAAT,QAA4B,eAA5B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,WAAT,QAA4B,eAA5B;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,qBAAT,QAAsC,yBAAtC;AACA,SAASC,QAAT,QAAyB,YAAzB;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,YAAT,QAA6B,gBAA7B","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nexport * from './endpoints';\nexport * from './util';\n\nexport { decodeToken } from './decodeToken';\nexport { revokeToken } from './revokeToken';\nexport { renewToken } from './renewToken';\nexport { renewTokensWithRefresh } from './renewTokensWithRefresh';\nexport { renewTokens } from './renewTokens';\nexport { verifyToken } from './verifyToken';\nexport { getUserInfo } from './getUserInfo';\nexport { handleOAuthResponse } from './handleOAuthResponse';\nexport { exchangeCodeForTokens } from './exchangeCodeForTokens';\nexport { getToken } from './getToken';\nexport { getWithoutPrompt } from './getWithoutPrompt';\nexport { getWithPopup } from './getWithPopup';\nexport { getWithRedirect } from './getWithRedirect';\nexport { parseFromUrl } from './parseFromUrl';\n"],"file":"index.js"}
@@ -1,144 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
-
3
- /* eslint-disable complexity */
4
-
5
- /*!
6
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
7
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
8
- *
9
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- *
14
- * See the License for the specific language governing permissions and limitations under the License.
15
- *
16
- */
17
- import { AuthSdkError } from '../errors';
18
- import { isInteractionRequiredError, urlParamsToObject } from './util';
19
- import { isString } from '../util';
20
- import { handleOAuthResponse } from './handleOAuthResponse';
21
-
22
- function removeHash(sdk) {
23
- var nativeHistory = sdk.token.parseFromUrl._getHistory();
24
-
25
- var nativeDoc = sdk.token.parseFromUrl._getDocument();
26
-
27
- var nativeLoc = sdk.token.parseFromUrl._getLocation();
28
-
29
- if (nativeHistory && nativeHistory.replaceState) {
30
- nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.search);
31
- } else {
32
- nativeLoc.hash = '';
33
- }
34
- }
35
-
36
- function removeSearch(sdk) {
37
- var nativeHistory = sdk.token.parseFromUrl._getHistory();
38
-
39
- var nativeDoc = sdk.token.parseFromUrl._getDocument();
40
-
41
- var nativeLoc = sdk.token.parseFromUrl._getLocation();
42
-
43
- if (nativeHistory && nativeHistory.replaceState) {
44
- nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.hash);
45
- } else {
46
- nativeLoc.search = '';
47
- }
48
- }
49
-
50
- export function getResponseMode(sdk) {
51
- // https://openid.net/specs/openid-connect-core-1_0.html#Authentication
52
- var defaultResponseMode = sdk.options.pkce ? 'query' : 'fragment';
53
- var responseMode = sdk.options.responseMode || defaultResponseMode;
54
- return responseMode;
55
- }
56
- export function parseOAuthResponseFromUrl(sdk, options) {
57
- options = options || {};
58
-
59
- if (isString(options)) {
60
- options = {
61
- url: options
62
- };
63
- } else {
64
- options = options;
65
- }
66
-
67
- var url = options.url;
68
- var responseMode = options.responseMode || getResponseMode(sdk);
69
-
70
- var nativeLoc = sdk.token.parseFromUrl._getLocation();
71
-
72
- var paramStr;
73
-
74
- if (responseMode === 'query') {
75
- paramStr = url ? url.substring(url.indexOf('?')) : nativeLoc.search;
76
- } else {
77
- paramStr = url ? url.substring(url.indexOf('#')) : nativeLoc.hash;
78
- }
79
-
80
- if (!paramStr) {
81
- throw new AuthSdkError('Unable to parse a token from the url');
82
- }
83
-
84
- return urlParamsToObject(paramStr);
85
- }
86
- export function cleanOAuthResponseFromUrl(sdk, options) {
87
- // Clean hash or search from the url
88
- var responseMode = options.responseMode || getResponseMode(sdk);
89
- responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);
90
- }
91
- export function parseFromUrl(_x, _x2) {
92
- return _parseFromUrl.apply(this, arguments);
93
- }
94
-
95
- function _parseFromUrl() {
96
- _parseFromUrl = _asyncToGenerator(function* (sdk, options) {
97
- options = options || {};
98
-
99
- if (isString(options)) {
100
- options = {
101
- url: options
102
- };
103
- } else {
104
- options = options;
105
- }
106
-
107
- var res = parseOAuthResponseFromUrl(sdk, options);
108
- var state = res.state;
109
- var oauthParams = sdk.transactionManager.load({
110
- oauth: true,
111
- pkce: sdk.options.pkce,
112
- state
113
- });
114
-
115
- if (!oauthParams) {
116
- return Promise.reject(new AuthSdkError('Unable to retrieve OAuth redirect params from storage'));
117
- }
118
-
119
- var urls = oauthParams.urls;
120
- delete oauthParams.urls;
121
-
122
- if (!options.url) {
123
- // Clean hash or search from the url
124
- cleanOAuthResponseFromUrl(sdk, options);
125
- }
126
-
127
- return handleOAuthResponse(sdk, oauthParams, res, urls).catch(err => {
128
- if (!isInteractionRequiredError(err)) {
129
- sdk.transactionManager.clear({
130
- state
131
- });
132
- }
133
-
134
- throw err;
135
- }).then(res => {
136
- sdk.transactionManager.clear({
137
- state
138
- });
139
- return res;
140
- });
141
- });
142
- return _parseFromUrl.apply(this, arguments);
143
- }
144
- //# sourceMappingURL=parseFromUrl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/oidc/parseFromUrl.ts"],"names":["AuthSdkError","isInteractionRequiredError","urlParamsToObject","isString","handleOAuthResponse","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","cleanOAuthResponseFromUrl","res","state","oauthParams","transactionManager","load","oauth","Promise","reject","urls","catch","err","clear","then"],"mappings":"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","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"}
@@ -1,85 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
-
3
- /*!
4
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
5
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
6
- *
7
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- *
12
- * See the License for the specific language governing permissions and limitations under the License.
13
- *
14
- */
15
- import { AuthSdkError } from '../errors';
16
- import { isAccessToken, isIDToken } from '../types';
17
- import { getWithoutPrompt } from './getWithoutPrompt';
18
- import { renewTokensWithRefresh } from './renewTokensWithRefresh';
19
-
20
- function throwInvalidTokenError() {
21
- throw new AuthSdkError('Renew must be passed a token with an array of scopes and an accessToken or idToken');
22
- } // Multiple tokens may have come back. Return only the token which was requested.
23
-
24
-
25
- function getSingleToken(originalToken, tokens) {
26
- if (isIDToken(originalToken)) {
27
- return tokens.idToken;
28
- }
29
-
30
- if (isAccessToken(originalToken)) {
31
- return tokens.accessToken;
32
- }
33
-
34
- throwInvalidTokenError();
35
- } // If we have a refresh token, renew using that, otherwise getWithoutPrompt
36
-
37
-
38
- export function renewToken(_x, _x2) {
39
- return _renewToken.apply(this, arguments);
40
- }
41
-
42
- function _renewToken() {
43
- _renewToken = _asyncToGenerator(function* (sdk, token) {
44
- if (!isIDToken(token) && !isAccessToken(token)) {
45
- throwInvalidTokenError();
46
- }
47
-
48
- var tokens = sdk.tokenManager.getTokensSync();
49
-
50
- if (tokens.refreshToken) {
51
- tokens = yield renewTokensWithRefresh(sdk, {
52
- scopes: token.scopes
53
- }, tokens.refreshToken);
54
- return getSingleToken(token, tokens);
55
- }
56
-
57
- var responseType;
58
-
59
- if (sdk.options.pkce) {
60
- responseType = 'code';
61
- } else if (isAccessToken(token)) {
62
- responseType = 'token';
63
- } else {
64
- responseType = 'id_token';
65
- }
66
-
67
- var {
68
- scopes,
69
- authorizeUrl,
70
- userinfoUrl,
71
- issuer
72
- } = token;
73
- return getWithoutPrompt(sdk, {
74
- responseType,
75
- scopes,
76
- authorizeUrl,
77
- userinfoUrl,
78
- issuer
79
- }).then(function (res) {
80
- return getSingleToken(token, res.tokens);
81
- });
82
- });
83
- return _renewToken.apply(this, arguments);
84
- }
85
- //# sourceMappingURL=renewToken.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/oidc/renewToken.ts"],"names":["AuthSdkError","isAccessToken","isIDToken","getWithoutPrompt","renewTokensWithRefresh","throwInvalidTokenError","getSingleToken","originalToken","tokens","idToken","accessToken","renewToken","sdk","token","tokenManager","getTokensSync","refreshToken","scopes","responseType","options","pkce","authorizeUrl","userinfoUrl","issuer","then","res"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,WAA7B;AACA,SAAkCC,aAAlC,EAAuEC,SAAvE,QAAwF,UAAxF;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;;AAEA,SAASC,sBAAT,GAAkC;AAChC,QAAM,IAAIL,YAAJ,CACJ,oFADI,CAAN;AAGD,C,CAED;;;AACA,SAASM,cAAT,CAAwBC,aAAxB,EAA8CC,MAA9C,EAA8D;AAC5D,MAAIN,SAAS,CAACK,aAAD,CAAb,EAA8B;AAC5B,WAAOC,MAAM,CAACC,OAAd;AACD;;AACD,MAAIR,aAAa,CAACM,aAAD,CAAjB,EAAkC;AAChC,WAAOC,MAAM,CAACE,WAAd;AACD;;AACDL,EAAAA,sBAAsB;AACvB,C,CAED;;;AACA,gBAAsBM,UAAtB;AAAA;AAAA;;;kCAAO,WAA0BC,GAA1B,EAAyCC,KAAzC,EAAuE;AAC5E,QAAI,CAACX,SAAS,CAACW,KAAD,CAAV,IAAqB,CAACZ,aAAa,CAACY,KAAD,CAAvC,EAAgD;AAC9CR,MAAAA,sBAAsB;AACvB;;AAED,QAAIG,MAAM,GAAGI,GAAG,CAACE,YAAJ,CAAiBC,aAAjB,EAAb;;AACA,QAAIP,MAAM,CAACQ,YAAX,EAAyB;AACvBR,MAAAA,MAAM,SAASJ,sBAAsB,CAACQ,GAAD,EAAM;AACzCK,QAAAA,MAAM,EAAEJ,KAAK,CAACI;AAD2B,OAAN,EAElCT,MAAM,CAACQ,YAF2B,CAArC;AAGA,aAAOV,cAAc,CAACO,KAAD,EAAQL,MAAR,CAArB;AACD;;AAED,QAAIU,YAAJ;;AACA,QAAIN,GAAG,CAACO,OAAJ,CAAYC,IAAhB,EAAsB;AACpBF,MAAAA,YAAY,GAAG,MAAf;AACD,KAFD,MAEO,IAAIjB,aAAa,CAACY,KAAD,CAAjB,EAA0B;AAC/BK,MAAAA,YAAY,GAAG,OAAf;AACD,KAFM,MAEA;AACLA,MAAAA,YAAY,GAAG,UAAf;AACD;;AAED,QAAM;AAAED,MAAAA,MAAF;AAAUI,MAAAA,YAAV;AAAwBC,MAAAA,WAAxB;AAAqCC,MAAAA;AAArC,QAAgDV,KAAtD;AACA,WAAOV,gBAAgB,CAACS,GAAD,EAAM;AAC3BM,MAAAA,YAD2B;AAE3BD,MAAAA,MAF2B;AAG3BI,MAAAA,YAH2B;AAI3BC,MAAAA,WAJ2B;AAK3BC,MAAAA;AAL2B,KAAN,CAAhB,CAOJC,IAPI,CAOC,UAAUC,GAAV,EAAe;AACnB,aAAOnB,cAAc,CAACO,KAAD,EAAQY,GAAG,CAACjB,MAAZ,CAArB;AACD,KATI,CAAP;AAUD,G","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { OktaAuth, Token, Tokens, isAccessToken, AccessToken, IDToken, isIDToken } from '../types';\nimport { getWithoutPrompt } from './getWithoutPrompt';\nimport { renewTokensWithRefresh } from './renewTokensWithRefresh';\n\nfunction throwInvalidTokenError() {\n throw new AuthSdkError(\n 'Renew must be passed a token with an array of scopes and an accessToken or idToken'\n );\n}\n\n// Multiple tokens may have come back. Return only the token which was requested.\nfunction getSingleToken(originalToken: Token, tokens: Tokens) {\n if (isIDToken(originalToken)) {\n return tokens.idToken;\n }\n if (isAccessToken(originalToken)) {\n return tokens.accessToken;\n }\n throwInvalidTokenError();\n}\n\n// If we have a refresh token, renew using that, otherwise getWithoutPrompt\nexport async function renewToken(sdk: OktaAuth, token: Token): Promise<Token> {\n if (!isIDToken(token) && !isAccessToken(token)) {\n throwInvalidTokenError();\n }\n\n let tokens = sdk.tokenManager.getTokensSync();\n if (tokens.refreshToken) {\n tokens = await renewTokensWithRefresh(sdk, {\n scopes: token.scopes,\n }, tokens.refreshToken);\n return getSingleToken(token, tokens);\n }\n\n var responseType;\n if (sdk.options.pkce) {\n responseType = 'code';\n } else if (isAccessToken(token)) {\n responseType = 'token';\n } else {\n responseType = 'id_token';\n }\n\n const { scopes, authorizeUrl, userinfoUrl, issuer } = token as (AccessToken & IDToken);\n return getWithoutPrompt(sdk, {\n responseType,\n scopes,\n authorizeUrl,\n userinfoUrl,\n issuer\n })\n .then(function (res) {\n return getSingleToken(token, res.tokens);\n });\n}\n"],"file":"renewToken.js"}
@@ -1,74 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
-
3
- /*!
4
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
5
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
6
- *
7
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- *
12
- * See the License for the specific language governing permissions and limitations under the License.
13
- *
14
- */
15
- import { AuthSdkError } from '../errors';
16
- import { getWithoutPrompt } from './getWithoutPrompt';
17
- import { renewTokensWithRefresh } from './renewTokensWithRefresh';
18
- import { getDefaultTokenParams } from './util'; // If we have a refresh token, renew using that, otherwise getWithoutPrompt
19
- // eslint-disable-next-line complexity
20
-
21
- export function renewTokens(_x, _x2) {
22
- return _renewTokens.apply(this, arguments);
23
- }
24
-
25
- function _renewTokens() {
26
- _renewTokens = _asyncToGenerator(function* (sdk, options) {
27
- var tokens = sdk.tokenManager.getTokensSync();
28
-
29
- if (tokens.refreshToken) {
30
- return renewTokensWithRefresh(sdk, options, tokens.refreshToken);
31
- }
32
-
33
- if (!tokens.accessToken && !tokens.idToken) {
34
- throw new AuthSdkError('renewTokens() was called but there is no existing token');
35
- }
36
-
37
- var accessToken = tokens.accessToken || {};
38
- var idToken = tokens.idToken || {};
39
- var scopes = accessToken.scopes || idToken.scopes;
40
-
41
- if (!scopes) {
42
- throw new AuthSdkError('renewTokens: invalid tokens: could not read scopes');
43
- }
44
-
45
- var authorizeUrl = accessToken.authorizeUrl || idToken.authorizeUrl;
46
-
47
- if (!authorizeUrl) {
48
- throw new AuthSdkError('renewTokens: invalid tokens: could not read authorizeUrl');
49
- }
50
-
51
- var userinfoUrl = accessToken.userinfoUrl || sdk.options.userinfoUrl;
52
- var issuer = idToken.issuer || sdk.options.issuer; // Get tokens using the SSO cookie
53
-
54
- options = Object.assign({
55
- scopes,
56
- authorizeUrl,
57
- userinfoUrl,
58
- issuer
59
- }, options);
60
-
61
- if (sdk.options.pkce) {
62
- options.responseType = 'code';
63
- } else {
64
- var {
65
- responseType
66
- } = getDefaultTokenParams(sdk);
67
- options.responseType = responseType;
68
- }
69
-
70
- return getWithoutPrompt(sdk, options).then(res => res.tokens);
71
- });
72
- return _renewTokens.apply(this, arguments);
73
- }
74
- //# sourceMappingURL=renewTokens.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/oidc/renewTokens.ts"],"names":["AuthSdkError","getWithoutPrompt","renewTokensWithRefresh","getDefaultTokenParams","renewTokens","sdk","options","tokens","tokenManager","getTokensSync","refreshToken","accessToken","idToken","scopes","authorizeUrl","userinfoUrl","issuer","Object","assign","pkce","responseType","then","res"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,WAA7B;AAEA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,sBAAT,QAAuC,0BAAvC;AACA,SAASC,qBAAT,QAAsC,QAAtC,C,CAEA;AACA;;AACA,gBAAsBC,WAAtB;AAAA;AAAA;;;mCAAO,WAA2BC,GAA3B,EAAgCC,OAAhC,EAAuE;AAC5E,QAAMC,MAAM,GAAGF,GAAG,CAACG,YAAJ,CAAiBC,aAAjB,EAAf;;AACA,QAAIF,MAAM,CAACG,YAAX,EAAyB;AACvB,aAAOR,sBAAsB,CAACG,GAAD,EAAMC,OAAN,EAAeC,MAAM,CAACG,YAAtB,CAA7B;AACD;;AAED,QAAI,CAACH,MAAM,CAACI,WAAR,IAAuB,CAACJ,MAAM,CAACK,OAAnC,EAA4C;AAC1C,YAAM,IAAIZ,YAAJ,CAAiB,yDAAjB,CAAN;AACD;;AAED,QAAMW,WAAW,GAAGJ,MAAM,CAACI,WAAP,IAAsB,EAA1C;AACA,QAAMC,OAAO,GAAGL,MAAM,CAACK,OAAP,IAAkB,EAAlC;AACA,QAAMC,MAAM,GAAGF,WAAW,CAACE,MAAZ,IAAsBD,OAAO,CAACC,MAA7C;;AACA,QAAI,CAACA,MAAL,EAAa;AACX,YAAM,IAAIb,YAAJ,CAAiB,oDAAjB,CAAN;AACD;;AACD,QAAMc,YAAY,GAAGH,WAAW,CAACG,YAAZ,IAA4BF,OAAO,CAACE,YAAzD;;AACA,QAAI,CAACA,YAAL,EAAmB;AACjB,YAAM,IAAId,YAAJ,CAAiB,0DAAjB,CAAN;AACD;;AACD,QAAMe,WAAW,GAAGJ,WAAW,CAACI,WAAZ,IAA2BV,GAAG,CAACC,OAAJ,CAAYS,WAA3D;AACA,QAAMC,MAAM,GAAGJ,OAAO,CAACI,MAAR,IAAkBX,GAAG,CAACC,OAAJ,CAAYU,MAA7C,CArB4E,CAuB5E;;AACAV,IAAAA,OAAO,GAAGW,MAAM,CAACC,MAAP,CAAc;AACtBL,MAAAA,MADsB;AAEtBC,MAAAA,YAFsB;AAGtBC,MAAAA,WAHsB;AAItBC,MAAAA;AAJsB,KAAd,EAKPV,OALO,CAAV;;AAOA,QAAID,GAAG,CAACC,OAAJ,CAAYa,IAAhB,EAAsB;AACpBb,MAAAA,OAAO,CAACc,YAAR,GAAuB,MAAvB;AACD,KAFD,MAEO;AACL,UAAM;AAAEA,QAAAA;AAAF,UAAmBjB,qBAAqB,CAACE,GAAD,CAA9C;AACAC,MAAAA,OAAO,CAACc,YAAR,GAAuBA,YAAvB;AACD;;AAED,WAAOnB,gBAAgB,CAACI,GAAD,EAAMC,OAAN,CAAhB,CACJe,IADI,CACCC,GAAG,IAAIA,GAAG,CAACf,MADZ,CAAP;AAGD,G","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\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"}
@@ -1,55 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
-
3
- /*!
4
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
5
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
6
- *
7
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- *
12
- * See the License for the specific language governing permissions and limitations under the License.
13
- *
14
- */
15
- import { AuthSdkError } from '../errors';
16
- import { getOAuthUrls } from './util/oauth';
17
- import { isSameRefreshToken } from './util/refreshToken';
18
- import { handleOAuthResponse } from './handleOAuthResponse';
19
- import { postRefreshToken } from './endpoints/token';
20
- export function renewTokensWithRefresh(_x, _x2, _x3) {
21
- return _renewTokensWithRefresh.apply(this, arguments);
22
- }
23
-
24
- function _renewTokensWithRefresh() {
25
- _renewTokensWithRefresh = _asyncToGenerator(function* (sdk, tokenParams, refreshTokenObject) {
26
- var {
27
- clientId
28
- } = sdk.options;
29
-
30
- if (!clientId) {
31
- throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to renew tokens');
32
- }
33
-
34
- var renewTokenParams = Object.assign({}, tokenParams, {
35
- clientId
36
- });
37
- var tokenResponse = yield postRefreshToken(sdk, renewTokenParams, refreshTokenObject);
38
- var urls = getOAuthUrls(sdk, tokenParams);
39
- var {
40
- tokens
41
- } = yield handleOAuthResponse(sdk, renewTokenParams, tokenResponse, urls); // Support rotating refresh tokens
42
-
43
- var {
44
- refreshToken
45
- } = tokens;
46
-
47
- if (refreshToken && !isSameRefreshToken(refreshToken, refreshTokenObject)) {
48
- sdk.tokenManager.updateRefreshToken(refreshToken);
49
- }
50
-
51
- return tokens;
52
- });
53
- return _renewTokensWithRefresh.apply(this, arguments);
54
- }
55
- //# sourceMappingURL=renewTokensWithRefresh.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/oidc/renewTokensWithRefresh.ts"],"names":["AuthSdkError","getOAuthUrls","isSameRefreshToken","handleOAuthResponse","postRefreshToken","renewTokensWithRefresh","sdk","tokenParams","refreshTokenObject","clientId","options","renewTokenParams","Object","assign","tokenResponse","urls","tokens","refreshToken","tokenManager","updateRefreshToken"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,WAA7B;AACA,SAASC,YAAT,QAA6B,cAA7B;AACA,SAASC,kBAAT,QAAmC,qBAAnC;AAEA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,gBAAT,QAAiC,mBAAjC;AAEA,gBAAsBC,sBAAtB;AAAA;AAAA;;;8CAAO,WACLC,GADK,EAELC,WAFK,EAGLC,kBAHK,EAIY;AACjB,QAAM;AAAEC,MAAAA;AAAF,QAAeH,GAAG,CAACI,OAAzB;;AACA,QAAI,CAACD,QAAL,EAAe;AACb,YAAM,IAAIT,YAAJ,CAAiB,0EAAjB,CAAN;AACD;;AAED,QAAMW,gBAA6B,GAAGC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBN,WAAlB,EAA+B;AACnEE,MAAAA;AADmE,KAA/B,CAAtC;AAGA,QAAMK,aAAa,SAASV,gBAAgB,CAACE,GAAD,EAAMK,gBAAN,EAAwBH,kBAAxB,CAA5C;AACA,QAAMO,IAAI,GAAGd,YAAY,CAACK,GAAD,EAAMC,WAAN,CAAzB;AACA,QAAM;AAAES,MAAAA;AAAF,cAAmBb,mBAAmB,CAACG,GAAD,EAAMK,gBAAN,EAAwBG,aAAxB,EAAuCC,IAAvC,CAA5C,CAXiB,CAajB;;AACA,QAAM;AAAEE,MAAAA;AAAF,QAAmBD,MAAzB;;AACA,QAAIC,YAAY,IAAI,CAACf,kBAAkB,CAACe,YAAD,EAAeT,kBAAf,CAAvC,EAA2E;AACzEF,MAAAA,GAAG,CAACY,YAAJ,CAAiBC,kBAAjB,CAAoCF,YAApC;AACD;;AAED,WAAOD,MAAP;AACD,G","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { getOAuthUrls } from './util/oauth';\nimport { isSameRefreshToken } from './util/refreshToken';\nimport { OktaAuth, TokenParams, RefreshToken, Tokens } from '../types';\nimport { handleOAuthResponse } from './handleOAuthResponse';\nimport { postRefreshToken } from './endpoints/token';\n\nexport async function renewTokensWithRefresh(\n sdk: OktaAuth,\n tokenParams: TokenParams,\n refreshTokenObject: RefreshToken\n): Promise<Tokens> {\n const { clientId } = sdk.options;\n if (!clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to renew tokens');\n }\n\n const renewTokenParams: TokenParams = Object.assign({}, tokenParams, {\n clientId,\n });\n const tokenResponse = await postRefreshToken(sdk, renewTokenParams, refreshTokenObject);\n const urls = getOAuthUrls(sdk, tokenParams);\n const { tokens } = await handleOAuthResponse(sdk, renewTokenParams, tokenResponse, urls);\n\n // Support rotating refresh tokens\n const { refreshToken } = tokens;\n if (refreshToken && !isSameRefreshToken(refreshToken, refreshTokenObject)) {\n sdk.tokenManager.updateRefreshToken(refreshToken);\n }\n\n return tokens;\n}\n"],"file":"renewTokensWithRefresh.js"}
@@ -1,57 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
- *
5
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
- * Unless required by applicable law or agreed to in writing, software
7
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
- *
10
- * See the License for the specific language governing permissions and limitations under the License.
11
- *
12
- */
13
-
14
- /* eslint complexity:[0,8] */
15
- import { post } from '../http';
16
- import { toQueryString } from '../util';
17
- import { getOAuthUrls } from './util/oauth';
18
- import { btoa } from '../crypto';
19
- import AuthSdkError from '../errors/AuthSdkError';
20
- // refresh tokens have precedence to be revoked if no token is specified
21
- export function revokeToken(sdk, token) {
22
- return Promise.resolve().then(function () {
23
- var accessToken;
24
- var refreshToken;
25
-
26
- if (token) {
27
- accessToken = token.accessToken;
28
- refreshToken = token.refreshToken;
29
- }
30
-
31
- if (!accessToken && !refreshToken) {
32
- throw new AuthSdkError('A valid access or refresh token object is required');
33
- }
34
-
35
- var clientId = sdk.options.clientId;
36
- var clientSecret = sdk.options.clientSecret;
37
-
38
- if (!clientId) {
39
- throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to revoke a token');
40
- }
41
-
42
- var revokeUrl = getOAuthUrls(sdk).revokeUrl;
43
- var args = toQueryString({
44
- // eslint-disable-next-line camelcase
45
- token_type_hint: refreshToken ? 'refresh_token' : 'access_token',
46
- token: refreshToken || accessToken
47
- }).slice(1);
48
- var creds = clientSecret ? btoa("".concat(clientId, ":").concat(clientSecret)) : btoa(clientId);
49
- return post(sdk, revokeUrl, args, {
50
- headers: {
51
- 'Content-Type': 'application/x-www-form-urlencoded',
52
- 'Authorization': 'Basic ' + creds
53
- }
54
- });
55
- });
56
- }
57
- //# sourceMappingURL=revokeToken.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../lib/oidc/revokeToken.ts"],"names":["post","toQueryString","getOAuthUrls","btoa","AuthSdkError","revokeToken","sdk","token","Promise","resolve","then","accessToken","refreshToken","clientId","options","clientSecret","revokeUrl","args","token_type_hint","slice","creds","headers"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,IAAT,QAAqB,SAArB;AACA,SAASC,aAAT,QAA8B,SAA9B;AACA,SACEC,YADF,QAEO,cAFP;AAGA,SAASC,IAAT,QAAqB,WAArB;AACA,OAAOC,YAAP,MAAyB,wBAAzB;AAQA;AACA,OAAO,SAASC,WAAT,CAAqBC,GAArB,EAAoCC,KAApC,EAAyE;AAC9E,SAAOC,OAAO,CAACC,OAAR,GACJC,IADI,CACC,YAAY;AAChB,QAAIC,WAAJ;AACA,QAAIC,YAAJ;;AACA,QAAIL,KAAJ,EAAW;AACPI,MAAAA,WAAW,GAAIJ,KAAD,CAAuBI,WAArC;AACAC,MAAAA,YAAY,GAAIL,KAAD,CAAwBK,YAAvC;AACH;;AAED,QAAG,CAACD,WAAD,IAAgB,CAACC,YAApB,EAAkC;AAChC,YAAM,IAAIR,YAAJ,CAAiB,oDAAjB,CAAN;AACD;;AACD,QAAIS,QAAQ,GAAGP,GAAG,CAACQ,OAAJ,CAAYD,QAA3B;AACA,QAAIE,YAAY,GAAGT,GAAG,CAACQ,OAAJ,CAAYC,YAA/B;;AACA,QAAI,CAACF,QAAL,EAAe;AACb,YAAM,IAAIT,YAAJ,CAAiB,4EAAjB,CAAN;AACD;;AACD,QAAIY,SAAS,GAAGd,YAAY,CAACI,GAAD,CAAZ,CAAkBU,SAAlC;AACA,QAAIC,IAAI,GAAGhB,aAAa,CAAC;AACvB;AACAiB,MAAAA,eAAe,EAAEN,YAAY,GAAG,eAAH,GAAqB,cAF3B;AAGvBL,MAAAA,KAAK,EAAEK,YAAY,IAAID;AAHA,KAAD,CAAb,CAIRQ,KAJQ,CAIF,CAJE,CAAX;AAKA,QAAIC,KAAK,GAAGL,YAAY,GAAGZ,IAAI,WAAIU,QAAJ,cAAgBE,YAAhB,EAAP,GAAyCZ,IAAI,CAACU,QAAD,CAArE;AACA,WAAOb,IAAI,CAACM,GAAD,EAAMU,SAAN,EAAiBC,IAAjB,EAAuB;AAChCI,MAAAA,OAAO,EAAE;AACP,wBAAgB,mCADT;AAEP,yBAAiB,WAAWD;AAFrB;AADuB,KAAvB,CAAX;AAMD,GA9BI,CAAP;AA+BD","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 complexity:[0,8] */\nimport { post } from '../http';\nimport { toQueryString } from '../util';\nimport {\n getOAuthUrls,\n} from './util/oauth';\nimport { btoa } from '../crypto';\nimport AuthSdkError from '../errors/AuthSdkError';\nimport {\n OktaAuth,\n RevocableToken,\n AccessToken,\n RefreshToken\n} from '../types';\n\n// refresh tokens have precedence to be revoked if no token is specified\nexport function revokeToken(sdk: OktaAuth, token: RevocableToken): Promise<any> {\n return Promise.resolve()\n .then(function () {\n var accessToken: string;\n var refreshToken: string;\n if (token) { \n accessToken = (token as AccessToken).accessToken;\n refreshToken = (token as RefreshToken).refreshToken; \n }\n \n if(!accessToken && !refreshToken) { \n throw new AuthSdkError('A valid access or refresh token object is required');\n }\n var clientId = sdk.options.clientId;\n var clientSecret = sdk.options.clientSecret;\n if (!clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to revoke a token');\n }\n var revokeUrl = getOAuthUrls(sdk).revokeUrl;\n var args = toQueryString({\n // eslint-disable-next-line camelcase\n token_type_hint: refreshToken ? 'refresh_token' : 'access_token', \n token: refreshToken || accessToken,\n }).slice(1);\n var creds = clientSecret ? btoa(`${clientId}:${clientSecret}`) : btoa(clientId);\n return post(sdk, revokeUrl, args, {\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Authorization': 'Basic ' + creds\n }\n });\n });\n}"],"file":"revokeToken.js"}
@@ -1,74 +0,0 @@
1
- /*!
2
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
3
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
4
- *
5
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
6
- * Unless required by applicable law or agreed to in writing, software
7
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
8
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
- *
10
- * See the License for the specific language governing permissions and limitations under the License.
11
- *
12
- */
13
-
14
- /* global window, document */
15
-
16
- /* eslint-disable complexity, max-statements */
17
- import { AuthSdkError } from '../../errors';
18
- export function addListener(eventTarget, name, fn) {
19
- if (eventTarget.addEventListener) {
20
- eventTarget.addEventListener(name, fn);
21
- } else {
22
- eventTarget.attachEvent('on' + name, fn);
23
- }
24
- }
25
- export function removeListener(eventTarget, name, fn) {
26
- if (eventTarget.removeEventListener) {
27
- eventTarget.removeEventListener(name, fn);
28
- } else {
29
- eventTarget.detachEvent('on' + name, fn);
30
- }
31
- }
32
- export function loadFrame(src) {
33
- var iframe = document.createElement('iframe');
34
- iframe.style.display = 'none';
35
- iframe.src = src;
36
- return document.body.appendChild(iframe);
37
- }
38
- export function loadPopup(src, options) {
39
- var title = options.popupTitle || 'External Identity Provider User Authentication';
40
- var appearance = 'toolbar=no, scrollbars=yes, resizable=yes, ' + 'top=100, left=500, width=600, height=600';
41
- return window.open(src, title, appearance);
42
- }
43
- export function addPostMessageListener(sdk, timeout, state) {
44
- var responseHandler;
45
- var timeoutId;
46
- var msgReceivedOrTimeout = new Promise(function (resolve, reject) {
47
- responseHandler = function responseHandler(e) {
48
- if (!e.data || e.data.state !== state) {
49
- // A message not meant for us
50
- return;
51
- } // Configuration mismatch between saved token and current app instance
52
- // This may happen if apps with different issuers are running on the same host url
53
- // If they share the same storage key, they may read and write tokens in the same location.
54
- // Common when developing against http://localhost
55
-
56
-
57
- if (e.origin !== sdk.getIssuerOrigin()) {
58
- return reject(new AuthSdkError('The request does not match client configuration'));
59
- }
60
-
61
- resolve(e.data);
62
- };
63
-
64
- addListener(window, 'message', responseHandler);
65
- timeoutId = setTimeout(function () {
66
- reject(new AuthSdkError('OAuth flow timed out'));
67
- }, timeout || 120000);
68
- });
69
- return msgReceivedOrTimeout.finally(function () {
70
- clearTimeout(timeoutId);
71
- removeListener(window, 'message', responseHandler);
72
- });
73
- }
74
- //# sourceMappingURL=browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../lib/oidc/util/browser.ts"],"names":["AuthSdkError","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","setTimeout","finally","clearTimeout"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AACA;AACA,SAASA,YAAT,QAA6B,cAA7B;AAGA,OAAO,SAASC,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;AAED,OAAO,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;AAED,OAAO,SAASM,SAAT,CAAmBC,GAAnB,EAAwB;AAC7B,MAAIC,MAAM,GAAGC,QAAQ,CAACC,aAAT,CAAuB,QAAvB,CAAb;AACAF,EAAAA,MAAM,CAACG,KAAP,CAAaC,OAAb,GAAuB,MAAvB;AACAJ,EAAAA,MAAM,CAACD,GAAP,GAAaA,GAAb;AAEA,SAAOE,QAAQ,CAACI,IAAT,CAAcC,WAAd,CAA0BN,MAA1B,CAAP;AACD;AAED,OAAO,SAASO,SAAT,CAAmBR,GAAnB,EAAwBS,OAAxB,EAAiC;AACtC,MAAIC,KAAK,GAAGD,OAAO,CAACE,UAAR,IAAsB,gDAAlC;AACA,MAAIC,UAAU,GAAG,gDACf,0CADF;AAEA,SAAOC,MAAM,CAACC,IAAP,CAAYd,GAAZ,EAAiBU,KAAjB,EAAwBE,UAAxB,CAAP;AACD;AAED,OAAO,SAASG,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,IAAInC,YAAJ,CAAiB,iDAAjB,CAAD,CAAb;AACD;;AACDkC,MAAAA,OAAO,CAACE,CAAC,CAACC,IAAH,CAAP;AACD,KAdD;;AAgBApC,IAAAA,WAAW,CAACuB,MAAD,EAAS,SAAT,EAAoBM,eAApB,CAAX;AAEAC,IAAAA,SAAS,GAAGS,UAAU,CAAC,YAAY;AACjCL,MAAAA,MAAM,CAAC,IAAInC,YAAJ,CAAiB,sBAAjB,CAAD,CAAN;AACD,KAFqB,EAEnB4B,OAAO,IAAI,MAFQ,CAAtB;AAGD,GAvB0B,CAA3B;AAyBA,SAAOI,oBAAoB,CACxBS,OADI,CACI,YAAY;AACnBC,IAAAA,YAAY,CAACX,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"}
@@ -1,42 +0,0 @@
1
- /* global window */
2
-
3
- /*!
4
- * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
5
- * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
6
- *
7
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
8
- * Unless required by applicable law or agreed to in writing, software
9
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
- *
12
- * See the License for the specific language governing permissions and limitations under the License.
13
- *
14
- */
15
- import { generateNonce, generateState } from './oauth';
16
- import { isBrowser } from '../../features';
17
- import { removeNils } from '../../util';
18
- export function getDefaultTokenParams(sdk) {
19
- var {
20
- pkce,
21
- clientId,
22
- redirectUri,
23
- responseType,
24
- responseMode,
25
- scopes,
26
- state,
27
- ignoreSignature
28
- } = sdk.options;
29
- var defaultRedirectUri = isBrowser() ? window.location.href : undefined;
30
- return removeNils({
31
- pkce,
32
- clientId,
33
- redirectUri: redirectUri || defaultRedirectUri,
34
- responseType: responseType || ['token', 'id_token'],
35
- responseMode,
36
- state: state || generateState(),
37
- nonce: generateNonce(),
38
- scopes: scopes || ['openid', 'email'],
39
- ignoreSignature
40
- });
41
- }
42
- //# sourceMappingURL=defaultTokenParams.js.map