@okta/okta-auth-js 7.0.1 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (568) hide show
  1. package/README.md +2 -0
  2. package/cjs/authn/AuthnTransactionImpl.js +6 -8
  3. package/cjs/authn/AuthnTransactionImpl.js.map +1 -1
  4. package/cjs/authn/api.js +3 -18
  5. package/cjs/authn/api.js.map +1 -1
  6. package/cjs/authn/factory.js +1 -7
  7. package/cjs/authn/factory.js.map +1 -1
  8. package/cjs/authn/index.js +0 -5
  9. package/cjs/authn/index.js.map +1 -1
  10. package/cjs/authn/mixin.js +14 -22
  11. package/cjs/authn/mixin.js.map +1 -1
  12. package/cjs/authn/util/flattenEmbedded.js +5 -12
  13. package/cjs/authn/util/flattenEmbedded.js.map +1 -1
  14. package/cjs/authn/util/link2fn.js +0 -22
  15. package/cjs/authn/util/link2fn.js.map +1 -1
  16. package/cjs/authn/util/links2fns.js +0 -12
  17. package/cjs/authn/util/links2fns.js.map +1 -1
  18. package/cjs/authn/util/poll.js +9 -27
  19. package/cjs/authn/util/poll.js.map +1 -1
  20. package/cjs/authn/util/stateToken.js +3 -4
  21. package/cjs/authn/util/stateToken.js.map +1 -1
  22. package/cjs/base/factory.js +6 -14
  23. package/cjs/base/factory.js.map +1 -1
  24. package/cjs/base/index.js +0 -5
  25. package/cjs/base/index.js.map +1 -1
  26. package/cjs/base/options.js +1 -2
  27. package/cjs/base/options.js.map +1 -1
  28. package/cjs/browser/browserStorage.js +15 -43
  29. package/cjs/browser/browserStorage.js.map +1 -1
  30. package/cjs/browser/fingerprint.js +3 -15
  31. package/cjs/browser/fingerprint.js.map +1 -1
  32. package/cjs/clock.js +5 -7
  33. package/cjs/clock.js.map +1 -1
  34. package/cjs/constants.js +4 -3
  35. package/cjs/constants.js.map +1 -1
  36. package/cjs/core/AuthStateManager.js +24 -48
  37. package/cjs/core/AuthStateManager.js.map +1 -1
  38. package/cjs/core/ServiceManager/browser.js +13 -33
  39. package/cjs/core/ServiceManager/browser.js.map +1 -1
  40. package/cjs/core/ServiceManager/index.js +0 -1
  41. package/cjs/core/ServiceManager/index.js.map +1 -1
  42. package/cjs/core/ServiceManager/node.js +3 -9
  43. package/cjs/core/ServiceManager/node.js.map +1 -1
  44. package/cjs/core/factory.js +0 -7
  45. package/cjs/core/factory.js.map +1 -1
  46. package/cjs/core/index.js +0 -13
  47. package/cjs/core/index.js.map +1 -1
  48. package/cjs/core/mixin.js +16 -20
  49. package/cjs/core/mixin.js.map +1 -1
  50. package/cjs/core/options.js +1 -3
  51. package/cjs/core/options.js.map +1 -1
  52. package/cjs/core/storage.js +0 -2
  53. package/cjs/core/storage.js.map +1 -1
  54. package/cjs/core/types/index.js +0 -5
  55. package/cjs/core/types/index.js.map +1 -1
  56. package/cjs/crypto/base64.js +9 -22
  57. package/cjs/crypto/base64.js.map +1 -1
  58. package/cjs/crypto/browser.js +0 -4
  59. package/cjs/crypto/browser.js.map +1 -1
  60. package/cjs/crypto/index.js +0 -9
  61. package/cjs/crypto/index.js.map +1 -1
  62. package/cjs/crypto/node.js +0 -13
  63. package/cjs/crypto/node.js.map +1 -1
  64. package/cjs/crypto/oidcHash.js +1 -4
  65. package/cjs/crypto/oidcHash.js.map +1 -1
  66. package/cjs/crypto/verifyToken.js +6 -7
  67. package/cjs/crypto/verifyToken.js.map +1 -1
  68. package/cjs/crypto/webcrypto.js +0 -1
  69. package/cjs/crypto/webcrypto.js.map +1 -1
  70. package/cjs/errors/AuthApiError.js +1 -7
  71. package/cjs/errors/AuthApiError.js.map +1 -1
  72. package/cjs/errors/AuthPollStopError.js +1 -5
  73. package/cjs/errors/AuthPollStopError.js.map +1 -1
  74. package/cjs/errors/AuthSdkError.js +1 -6
  75. package/cjs/errors/AuthSdkError.js.map +1 -1
  76. package/cjs/errors/CustomError.js +1 -4
  77. package/cjs/errors/CustomError.js.map +1 -1
  78. package/cjs/errors/OAuthError.js +4 -7
  79. package/cjs/errors/OAuthError.js.map +1 -1
  80. package/cjs/errors/index.js +1 -9
  81. package/cjs/errors/index.js.map +1 -1
  82. package/cjs/exports/authn.js +0 -9
  83. package/cjs/exports/authn.js.map +1 -1
  84. package/cjs/exports/cdn/authn.js +0 -2
  85. package/cjs/exports/cdn/authn.js.map +1 -1
  86. package/cjs/exports/cdn/core.js +0 -2
  87. package/cjs/exports/cdn/core.js.map +1 -1
  88. package/cjs/exports/cdn/default.js +0 -2
  89. package/cjs/exports/cdn/default.js.map +1 -1
  90. package/cjs/exports/cdn/idx.js +0 -2
  91. package/cjs/exports/cdn/idx.js.map +1 -1
  92. package/cjs/exports/cdn/myaccount.js +0 -2
  93. package/cjs/exports/cdn/myaccount.js.map +1 -1
  94. package/cjs/exports/common.js +0 -22
  95. package/cjs/exports/common.js.map +1 -1
  96. package/cjs/exports/core.js +0 -9
  97. package/cjs/exports/core.js.map +1 -1
  98. package/cjs/exports/default.js +2 -12
  99. package/cjs/exports/default.js.map +1 -1
  100. package/cjs/exports/idx.js +3 -7
  101. package/cjs/exports/idx.js.map +1 -1
  102. package/cjs/exports/myaccount.js +0 -9
  103. package/cjs/exports/myaccount.js.map +1 -1
  104. package/cjs/features.js +1 -18
  105. package/cjs/features.js.map +1 -1
  106. package/cjs/fetch/fetchRequest.js +6 -20
  107. package/cjs/fetch/fetchRequest.js.map +1 -1
  108. package/cjs/http/OktaUserAgent.js +3 -11
  109. package/cjs/http/OktaUserAgent.js.map +1 -1
  110. package/cjs/http/headers.js +1 -1
  111. package/cjs/http/headers.js.map +1 -1
  112. package/cjs/http/index.js +0 -11
  113. package/cjs/http/index.js.map +1 -1
  114. package/cjs/http/mixin.js +2 -10
  115. package/cjs/http/mixin.js.map +1 -1
  116. package/cjs/http/options.js +1 -5
  117. package/cjs/http/options.js.map +1 -1
  118. package/cjs/http/request.js +75 -57
  119. package/cjs/http/request.js.map +1 -1
  120. package/cjs/idx/IdxTransactionManager.js +2 -22
  121. package/cjs/idx/IdxTransactionManager.js.map +1 -1
  122. package/cjs/idx/authenticate.js +3 -5
  123. package/cjs/idx/authenticate.js.map +1 -1
  124. package/cjs/idx/authenticator/Authenticator.js +2 -4
  125. package/cjs/idx/authenticator/Authenticator.js.map +1 -1
  126. package/cjs/idx/authenticator/OktaPassword.js +2 -10
  127. package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
  128. package/cjs/idx/authenticator/OktaVerifyTotp.js +0 -6
  129. package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -1
  130. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +0 -10
  131. package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
  132. package/cjs/idx/authenticator/SecurityQuestionVerification.js +1 -10
  133. package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
  134. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +2 -10
  135. package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
  136. package/cjs/idx/authenticator/WebauthnEnrollment.js +0 -8
  137. package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -1
  138. package/cjs/idx/authenticator/WebauthnVerification.js +0 -8
  139. package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -1
  140. package/cjs/idx/authenticator/getAuthenticator.js +0 -15
  141. package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
  142. package/cjs/idx/authenticator/index.js +0 -15
  143. package/cjs/idx/authenticator/index.js.map +1 -1
  144. package/cjs/idx/authenticator/util.js +8 -18
  145. package/cjs/idx/authenticator/util.js.map +1 -1
  146. package/cjs/idx/cancel.js +3 -4
  147. package/cjs/idx/cancel.js.map +1 -1
  148. package/cjs/idx/emailVerify.js +5 -13
  149. package/cjs/idx/emailVerify.js.map +1 -1
  150. package/cjs/idx/factory/OktaAuthIdx.js +0 -3
  151. package/cjs/idx/factory/OktaAuthIdx.js.map +1 -1
  152. package/cjs/idx/factory/api.js +1 -17
  153. package/cjs/idx/factory/api.js.map +1 -1
  154. package/cjs/idx/factory/index.js +0 -3
  155. package/cjs/idx/factory/index.js.map +1 -1
  156. package/cjs/idx/flow/AccountUnlockFlow.js +1 -2
  157. package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -1
  158. package/cjs/idx/flow/AuthenticationFlow.js +1 -2
  159. package/cjs/idx/flow/AuthenticationFlow.js.map +1 -1
  160. package/cjs/idx/flow/FlowSpecification.js +2 -13
  161. package/cjs/idx/flow/FlowSpecification.js.map +1 -1
  162. package/cjs/idx/flow/PasswordRecoveryFlow.js +1 -2
  163. package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
  164. package/cjs/idx/flow/RegistrationFlow.js +1 -2
  165. package/cjs/idx/flow/RegistrationFlow.js.map +1 -1
  166. package/cjs/idx/flow/index.js +0 -11
  167. package/cjs/idx/flow/index.js.map +1 -1
  168. package/cjs/idx/handleInteractionCodeRedirect.js +7 -12
  169. package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
  170. package/cjs/idx/idxState/index.js +1 -11
  171. package/cjs/idx/idxState/index.js.map +1 -1
  172. package/cjs/idx/idxState/v1/actionParser.js +1 -12
  173. package/cjs/idx/idxState/v1/actionParser.js.map +1 -1
  174. package/cjs/idx/idxState/v1/generateIdxAction.js +10 -15
  175. package/cjs/idx/idxState/v1/generateIdxAction.js.map +1 -1
  176. package/cjs/idx/idxState/v1/idxResponseParser.js +7 -23
  177. package/cjs/idx/idxState/v1/idxResponseParser.js.map +1 -1
  178. package/cjs/idx/idxState/v1/makeIdxState.js +2 -10
  179. package/cjs/idx/idxState/v1/makeIdxState.js.map +1 -1
  180. package/cjs/idx/idxState/v1/parsers.js +0 -2
  181. package/cjs/idx/idxState/v1/parsers.js.map +1 -1
  182. package/cjs/idx/idxState/v1/remediationParser.js +2 -4
  183. package/cjs/idx/idxState/v1/remediationParser.js.map +1 -1
  184. package/cjs/idx/index.js +0 -26
  185. package/cjs/idx/index.js.map +1 -1
  186. package/cjs/idx/interact.js +18 -18
  187. package/cjs/idx/interact.js.map +1 -1
  188. package/cjs/idx/introspect.js +5 -14
  189. package/cjs/idx/introspect.js.map +1 -1
  190. package/cjs/idx/mixin.js +0 -9
  191. package/cjs/idx/mixin.js.map +1 -1
  192. package/cjs/idx/options.js +2 -3
  193. package/cjs/idx/options.js.map +1 -1
  194. package/cjs/idx/poll.js +1 -10
  195. package/cjs/idx/poll.js.map +1 -1
  196. package/cjs/idx/proceed.js +3 -9
  197. package/cjs/idx/proceed.js.map +1 -1
  198. package/cjs/idx/recoverPassword.js +3 -4
  199. package/cjs/idx/recoverPassword.js.map +1 -1
  200. package/cjs/idx/register.js +5 -11
  201. package/cjs/idx/register.js.map +1 -1
  202. package/cjs/idx/remediate.js +24 -45
  203. package/cjs/idx/remediate.js.map +1 -1
  204. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +7 -16
  205. package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
  206. package/cjs/idx/remediators/AuthenticatorVerificationData.js +7 -15
  207. package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
  208. package/cjs/idx/remediators/Base/AuthenticatorData.js +7 -22
  209. package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
  210. package/cjs/idx/remediators/Base/Remediator.js +38 -67
  211. package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
  212. package/cjs/idx/remediators/Base/SelectAuthenticator.js +13 -30
  213. package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
  214. package/cjs/idx/remediators/Base/VerifyAuthenticator.js +5 -13
  215. package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
  216. package/cjs/idx/remediators/ChallengeAuthenticator.js +1 -5
  217. package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
  218. package/cjs/idx/remediators/ChallengePoll.js +1 -6
  219. package/cjs/idx/remediators/ChallengePoll.js.map +1 -1
  220. package/cjs/idx/remediators/EnrollAuthenticator.js +1 -5
  221. package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
  222. package/cjs/idx/remediators/EnrollPoll.js +5 -12
  223. package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
  224. package/cjs/idx/remediators/EnrollProfile.js +8 -30
  225. package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
  226. package/cjs/idx/remediators/EnrollmentChannelData.js +5 -13
  227. package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
  228. package/cjs/idx/remediators/GenericRemediator/GenericRemediator.js +13 -19
  229. package/cjs/idx/remediators/GenericRemediator/GenericRemediator.js.map +1 -1
  230. package/cjs/idx/remediators/GenericRemediator/index.js +0 -1
  231. package/cjs/idx/remediators/GenericRemediator/index.js.map +1 -1
  232. package/cjs/idx/remediators/GenericRemediator/util.js +19 -31
  233. package/cjs/idx/remediators/GenericRemediator/util.js.map +1 -1
  234. package/cjs/idx/remediators/Identify.js +3 -12
  235. package/cjs/idx/remediators/Identify.js.map +1 -1
  236. package/cjs/idx/remediators/ReEnrollAuthenticator.js +3 -10
  237. package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
  238. package/cjs/idx/remediators/RedirectIdp.js +1 -7
  239. package/cjs/idx/remediators/RedirectIdp.js.map +1 -1
  240. package/cjs/idx/remediators/ResetAuthenticator.js +1 -5
  241. package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
  242. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +3 -11
  243. package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
  244. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js +1 -5
  245. package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
  246. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +6 -15
  247. package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -1
  248. package/cjs/idx/remediators/SelectEnrollProfile.js +1 -6
  249. package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
  250. package/cjs/idx/remediators/SelectEnrollmentChannel.js +5 -16
  251. package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
  252. package/cjs/idx/remediators/Skip.js +1 -6
  253. package/cjs/idx/remediators/Skip.js.map +1 -1
  254. package/cjs/idx/remediators/index.js +0 -39
  255. package/cjs/idx/remediators/index.js.map +1 -1
  256. package/cjs/idx/remediators/util.js +1 -7
  257. package/cjs/idx/remediators/util.js.map +1 -1
  258. package/cjs/idx/run.js +37 -52
  259. package/cjs/idx/run.js.map +1 -1
  260. package/cjs/idx/startTransaction.js +1 -2
  261. package/cjs/idx/startTransaction.js.map +1 -1
  262. package/cjs/idx/storage.js +3 -22
  263. package/cjs/idx/storage.js.map +1 -1
  264. package/cjs/idx/transactionMeta.js +24 -42
  265. package/cjs/idx/transactionMeta.js.map +1 -1
  266. package/cjs/idx/types/api.js +1 -9
  267. package/cjs/idx/types/api.js.map +1 -1
  268. package/cjs/idx/types/idx-js.js +3 -3
  269. package/cjs/idx/types/idx-js.js.map +1 -1
  270. package/cjs/idx/types/index.js +0 -7
  271. package/cjs/idx/types/index.js.map +1 -1
  272. package/cjs/idx/types/meta.js.map +1 -1
  273. package/cjs/idx/types/options.js.map +1 -1
  274. package/cjs/idx/unlockAccount.js +7 -11
  275. package/cjs/idx/unlockAccount.js.map +1 -1
  276. package/cjs/idx/util.js +24 -76
  277. package/cjs/idx/util.js.map +1 -1
  278. package/cjs/idx/webauthn.js +13 -18
  279. package/cjs/idx/webauthn.js.map +1 -1
  280. package/cjs/myaccount/api.js +0 -5
  281. package/cjs/myaccount/api.js.map +1 -1
  282. package/cjs/myaccount/emailApi.js +6 -21
  283. package/cjs/myaccount/emailApi.js.map +1 -1
  284. package/cjs/myaccount/factory.js +0 -3
  285. package/cjs/myaccount/factory.js.map +1 -1
  286. package/cjs/myaccount/index.js +0 -7
  287. package/cjs/myaccount/index.js.map +1 -1
  288. package/cjs/myaccount/mixin.js +0 -5
  289. package/cjs/myaccount/mixin.js.map +1 -1
  290. package/cjs/myaccount/phoneApi.js +5 -18
  291. package/cjs/myaccount/phoneApi.js.map +1 -1
  292. package/cjs/myaccount/profileApi.js +2 -9
  293. package/cjs/myaccount/profileApi.js.map +1 -1
  294. package/cjs/myaccount/request.js +12 -78
  295. package/cjs/myaccount/request.js.map +1 -1
  296. package/cjs/myaccount/transactions/Base.js +5 -7
  297. package/cjs/myaccount/transactions/Base.js.map +1 -1
  298. package/cjs/myaccount/transactions/EmailChallengeTransaction.js +5 -10
  299. package/cjs/myaccount/transactions/EmailChallengeTransaction.js.map +1 -1
  300. package/cjs/myaccount/transactions/EmailStatusTransaction.js +2 -7
  301. package/cjs/myaccount/transactions/EmailStatusTransaction.js.map +1 -1
  302. package/cjs/myaccount/transactions/EmailTransaction.js +5 -13
  303. package/cjs/myaccount/transactions/EmailTransaction.js.map +1 -1
  304. package/cjs/myaccount/transactions/PhoneTransaction.js +5 -12
  305. package/cjs/myaccount/transactions/PhoneTransaction.js.map +1 -1
  306. package/cjs/myaccount/transactions/ProfileSchemaTransaction.js +0 -5
  307. package/cjs/myaccount/transactions/ProfileSchemaTransaction.js.map +1 -1
  308. package/cjs/myaccount/transactions/ProfileTransaction.js +0 -5
  309. package/cjs/myaccount/transactions/ProfileTransaction.js.map +1 -1
  310. package/cjs/myaccount/transactions/index.js +0 -8
  311. package/cjs/myaccount/transactions/index.js.map +1 -1
  312. package/cjs/myaccount/types.js +0 -5
  313. package/cjs/myaccount/types.js.map +1 -1
  314. package/cjs/oidc/TokenManager.js +39 -100
  315. package/cjs/oidc/TokenManager.js.map +1 -1
  316. package/cjs/oidc/TransactionManager.js +19 -26
  317. package/cjs/oidc/TransactionManager.js.map +1 -1
  318. package/cjs/oidc/decodeToken.js +1 -5
  319. package/cjs/oidc/decodeToken.js.map +1 -1
  320. package/cjs/oidc/endpoints/authorize.js +9 -13
  321. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  322. package/cjs/oidc/endpoints/index.js +0 -5
  323. package/cjs/oidc/endpoints/index.js.map +1 -1
  324. package/cjs/oidc/endpoints/token.js +5 -17
  325. package/cjs/oidc/endpoints/token.js.map +1 -1
  326. package/cjs/oidc/endpoints/well-known.js +7 -14
  327. package/cjs/oidc/endpoints/well-known.js.map +1 -1
  328. package/cjs/oidc/exchangeCodeForTokens.js +7 -12
  329. package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
  330. package/cjs/oidc/factory/OktaAuthOAuth.js +0 -6
  331. package/cjs/oidc/factory/OktaAuthOAuth.js.map +1 -1
  332. package/cjs/oidc/factory/api.js +6 -20
  333. package/cjs/oidc/factory/api.js.map +1 -1
  334. package/cjs/oidc/factory/index.js +0 -3
  335. package/cjs/oidc/factory/index.js.map +1 -1
  336. package/cjs/oidc/getToken.js +18 -30
  337. package/cjs/oidc/getToken.js.map +1 -1
  338. package/cjs/oidc/getUserInfo.js +1 -15
  339. package/cjs/oidc/getUserInfo.js.map +1 -1
  340. package/cjs/oidc/getWithPopup.js +4 -8
  341. package/cjs/oidc/getWithPopup.js.map +1 -1
  342. package/cjs/oidc/getWithRedirect.js +1 -8
  343. package/cjs/oidc/getWithRedirect.js.map +1 -1
  344. package/cjs/oidc/getWithoutPrompt.js +1 -5
  345. package/cjs/oidc/getWithoutPrompt.js.map +1 -1
  346. package/cjs/oidc/handleOAuthResponse.js +23 -40
  347. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  348. package/cjs/oidc/index.js +0 -32
  349. package/cjs/oidc/index.js.map +1 -1
  350. package/cjs/oidc/mixin/browser.js +6 -18
  351. package/cjs/oidc/mixin/browser.js.map +1 -1
  352. package/cjs/oidc/mixin/index.js +37 -89
  353. package/cjs/oidc/mixin/index.js.map +1 -1
  354. package/cjs/oidc/mixin/node.js +2 -9
  355. package/cjs/oidc/mixin/node.js.map +1 -1
  356. package/cjs/oidc/options/OAuthOptionsConstructor.js +17 -24
  357. package/cjs/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  358. package/cjs/oidc/options/browser.js.map +1 -1
  359. package/cjs/oidc/options/index.js +0 -1
  360. package/cjs/oidc/options/index.js.map +1 -1
  361. package/cjs/oidc/options/node.js.map +1 -1
  362. package/cjs/oidc/parseFromUrl.js +1 -32
  363. package/cjs/oidc/parseFromUrl.js.map +1 -1
  364. package/cjs/oidc/renewToken.js +5 -16
  365. package/cjs/oidc/renewToken.js.map +1 -1
  366. package/cjs/oidc/renewTokens.js +3 -15
  367. package/cjs/oidc/renewTokens.js.map +1 -1
  368. package/cjs/oidc/renewTokensWithRefresh.js +3 -13
  369. package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
  370. package/cjs/oidc/revokeToken.js +3 -14
  371. package/cjs/oidc/revokeToken.js.map +1 -1
  372. package/cjs/oidc/storage.js +0 -8
  373. package/cjs/oidc/storage.js.map +1 -1
  374. package/cjs/oidc/types/Token.js +1 -5
  375. package/cjs/oidc/types/Token.js.map +1 -1
  376. package/cjs/oidc/types/TokenManager.js +1 -1
  377. package/cjs/oidc/types/TokenManager.js.map +1 -1
  378. package/cjs/oidc/types/Transaction.js +1 -12
  379. package/cjs/oidc/types/Transaction.js.map +1 -1
  380. package/cjs/oidc/types/UserClaims.js.map +1 -1
  381. package/cjs/oidc/types/api.js.map +1 -1
  382. package/cjs/oidc/types/index.js +0 -21
  383. package/cjs/oidc/types/index.js.map +1 -1
  384. package/cjs/oidc/types/meta.js.map +1 -1
  385. package/cjs/oidc/types/options.js.map +1 -1
  386. package/cjs/oidc/types/proto.js.map +1 -1
  387. package/cjs/oidc/util/browser.js +4 -13
  388. package/cjs/oidc/util/browser.js.map +1 -1
  389. package/cjs/oidc/util/defaultTokenParams.js +5 -5
  390. package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
  391. package/cjs/oidc/util/errors.js +3 -8
  392. package/cjs/oidc/util/errors.js.map +1 -1
  393. package/cjs/oidc/util/index.js +0 -24
  394. package/cjs/oidc/util/index.js.map +1 -1
  395. package/cjs/oidc/util/loginRedirect.js +11 -25
  396. package/cjs/oidc/util/loginRedirect.js.map +1 -1
  397. package/cjs/oidc/util/oauth.js +3 -12
  398. package/cjs/oidc/util/oauth.js.map +1 -1
  399. package/cjs/oidc/util/oauthMeta.js +5 -6
  400. package/cjs/oidc/util/oauthMeta.js.map +1 -1
  401. package/cjs/oidc/util/pkce.js +1 -12
  402. package/cjs/oidc/util/pkce.js.map +1 -1
  403. package/cjs/oidc/util/prepareTokenParams.js +13 -26
  404. package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
  405. package/cjs/oidc/util/refreshToken.js +0 -7
  406. package/cjs/oidc/util/refreshToken.js.map +1 -1
  407. package/cjs/oidc/util/sharedStorage.js +0 -8
  408. package/cjs/oidc/util/sharedStorage.js.map +1 -1
  409. package/cjs/oidc/util/urlParams.js +9 -12
  410. package/cjs/oidc/util/urlParams.js.map +1 -1
  411. package/cjs/oidc/util/validateClaims.js +9 -17
  412. package/cjs/oidc/util/validateClaims.js.map +1 -1
  413. package/cjs/oidc/util/validateToken.js +1 -6
  414. package/cjs/oidc/util/validateToken.js.map +1 -1
  415. package/cjs/oidc/verifyToken.js +13 -23
  416. package/cjs/oidc/verifyToken.js.map +1 -1
  417. package/cjs/server/serverStorage.js +9 -27
  418. package/cjs/server/serverStorage.js.map +1 -1
  419. package/cjs/services/AutoRenewService.js +1 -17
  420. package/cjs/services/AutoRenewService.js.map +1 -1
  421. package/cjs/services/LeaderElectionService.js +1 -23
  422. package/cjs/services/LeaderElectionService.js.map +1 -1
  423. package/cjs/services/SyncStorageService.js +3 -37
  424. package/cjs/services/SyncStorageService.js.map +1 -1
  425. package/cjs/services/index.js +0 -5
  426. package/cjs/services/index.js.map +1 -1
  427. package/cjs/session/api.js +1 -12
  428. package/cjs/session/api.js.map +1 -1
  429. package/cjs/session/factory.js +0 -2
  430. package/cjs/session/factory.js.map +1 -1
  431. package/cjs/session/index.js +0 -7
  432. package/cjs/session/index.js.map +1 -1
  433. package/cjs/session/mixin.js +2 -6
  434. package/cjs/session/mixin.js.map +1 -1
  435. package/cjs/storage/BaseStorageManager.js +13 -25
  436. package/cjs/storage/BaseStorageManager.js.map +1 -1
  437. package/cjs/storage/SavedObject.js +7 -19
  438. package/cjs/storage/SavedObject.js.map +1 -1
  439. package/cjs/storage/index.js +0 -9
  440. package/cjs/storage/index.js.map +1 -1
  441. package/cjs/storage/mixin.js +2 -4
  442. package/cjs/storage/mixin.js.map +1 -1
  443. package/cjs/storage/options/StorageOptionsConstructor.js +3 -6
  444. package/cjs/storage/options/StorageOptionsConstructor.js.map +1 -1
  445. package/cjs/storage/options/browser.js +7 -15
  446. package/cjs/storage/options/browser.js.map +1 -1
  447. package/cjs/storage/options/node.js +3 -6
  448. package/cjs/storage/options/node.js.map +1 -1
  449. package/cjs/util/PromiseQueue.js +7 -15
  450. package/cjs/util/PromiseQueue.js.map +1 -1
  451. package/cjs/util/console.js +3 -7
  452. package/cjs/util/console.js.map +1 -1
  453. package/cjs/util/index.js +0 -11
  454. package/cjs/util/index.js.map +1 -1
  455. package/cjs/util/misc.js +3 -8
  456. package/cjs/util/misc.js.map +1 -1
  457. package/cjs/util/object.js +9 -23
  458. package/cjs/util/object.js.map +1 -1
  459. package/cjs/util/types.js +1 -5
  460. package/cjs/util/types.js.map +1 -1
  461. package/cjs/util/url.js +5 -14
  462. package/cjs/util/url.js.map +1 -1
  463. package/dist/okta-auth-js.authn.min.analyzer.html +3 -3
  464. package/dist/okta-auth-js.authn.min.js +1 -1
  465. package/dist/okta-auth-js.authn.min.js.LICENSE.txt +2 -0
  466. package/dist/okta-auth-js.authn.min.js.map +1 -1
  467. package/dist/okta-auth-js.core.min.analyzer.html +3 -3
  468. package/dist/okta-auth-js.core.min.js +1 -1
  469. package/dist/okta-auth-js.core.min.js.LICENSE.txt +2 -0
  470. package/dist/okta-auth-js.core.min.js.map +1 -1
  471. package/dist/okta-auth-js.idx.min.analyzer.html +3 -3
  472. package/dist/okta-auth-js.idx.min.js +1 -1
  473. package/dist/okta-auth-js.idx.min.js.LICENSE.txt +2 -0
  474. package/dist/okta-auth-js.idx.min.js.map +1 -1
  475. package/dist/okta-auth-js.min.analyzer.html +3 -3
  476. package/dist/okta-auth-js.min.js +1 -1
  477. package/dist/okta-auth-js.min.js.LICENSE.txt +2 -0
  478. package/dist/okta-auth-js.min.js.map +1 -1
  479. package/dist/okta-auth-js.myaccount.min.analyzer.html +3 -3
  480. package/dist/okta-auth-js.myaccount.min.js +1 -1
  481. package/dist/okta-auth-js.myaccount.min.js.LICENSE.txt +2 -0
  482. package/dist/okta-auth-js.myaccount.min.js.map +1 -1
  483. package/dist/okta-auth-js.polyfill.js +1 -1
  484. package/dist/okta-auth-js.polyfill.js.map +1 -1
  485. package/esm/browser/http/OktaUserAgent.js +2 -2
  486. package/esm/browser/http/request.js +56 -23
  487. package/esm/browser/http/request.js.map +1 -1
  488. package/esm/browser/idx/interact.js +2 -2
  489. package/esm/browser/idx/interact.js.map +1 -1
  490. package/esm/browser/idx/run.js +2 -1
  491. package/esm/browser/idx/run.js.map +1 -1
  492. package/esm/browser/idx/transactionMeta.js +3 -2
  493. package/esm/browser/idx/transactionMeta.js.map +1 -1
  494. package/esm/browser/myaccount/request.js +2 -43
  495. package/esm/browser/myaccount/request.js.map +1 -1
  496. package/esm/browser/oidc/endpoints/authorize.js +1 -0
  497. package/esm/browser/oidc/endpoints/authorize.js.map +1 -1
  498. package/esm/browser/oidc/exchangeCodeForTokens.js +2 -1
  499. package/esm/browser/oidc/exchangeCodeForTokens.js.map +1 -1
  500. package/esm/browser/oidc/handleOAuthResponse.js +17 -16
  501. package/esm/browser/oidc/handleOAuthResponse.js.map +1 -1
  502. package/esm/browser/oidc/options/OAuthOptionsConstructor.js +2 -0
  503. package/esm/browser/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  504. package/esm/browser/oidc/util/defaultTokenParams.js +3 -1
  505. package/esm/browser/oidc/util/defaultTokenParams.js.map +1 -1
  506. package/esm/browser/oidc/util/oauthMeta.js +1 -0
  507. package/esm/browser/oidc/util/oauthMeta.js.map +1 -1
  508. package/esm/browser/oidc/util/validateClaims.js +9 -4
  509. package/esm/browser/oidc/util/validateClaims.js.map +1 -1
  510. package/esm/browser/oidc/verifyToken.js +2 -2
  511. package/esm/browser/oidc/verifyToken.js.map +1 -1
  512. package/esm/browser/package.json +1 -1
  513. package/esm/node/http/OktaUserAgent.js +2 -2
  514. package/esm/node/http/request.js +56 -23
  515. package/esm/node/http/request.js.map +1 -1
  516. package/esm/node/idx/interact.js +2 -2
  517. package/esm/node/idx/interact.js.map +1 -1
  518. package/esm/node/idx/run.js +2 -1
  519. package/esm/node/idx/run.js.map +1 -1
  520. package/esm/node/idx/transactionMeta.js +3 -2
  521. package/esm/node/idx/transactionMeta.js.map +1 -1
  522. package/esm/node/myaccount/request.js +2 -43
  523. package/esm/node/myaccount/request.js.map +1 -1
  524. package/esm/node/oidc/endpoints/authorize.js +1 -0
  525. package/esm/node/oidc/endpoints/authorize.js.map +1 -1
  526. package/esm/node/oidc/exchangeCodeForTokens.js +2 -1
  527. package/esm/node/oidc/exchangeCodeForTokens.js.map +1 -1
  528. package/esm/node/oidc/handleOAuthResponse.js +17 -16
  529. package/esm/node/oidc/handleOAuthResponse.js.map +1 -1
  530. package/esm/node/oidc/options/OAuthOptionsConstructor.js +2 -0
  531. package/esm/node/oidc/options/OAuthOptionsConstructor.js.map +1 -1
  532. package/esm/node/oidc/util/defaultTokenParams.js +3 -1
  533. package/esm/node/oidc/util/defaultTokenParams.js.map +1 -1
  534. package/esm/node/oidc/util/oauthMeta.js +1 -0
  535. package/esm/node/oidc/util/oauthMeta.js.map +1 -1
  536. package/esm/node/oidc/util/validateClaims.js +9 -4
  537. package/esm/node/oidc/util/validateClaims.js.map +1 -1
  538. package/esm/node/oidc/verifyToken.js +2 -2
  539. package/esm/node/oidc/verifyToken.js.map +1 -1
  540. package/esm/node/package.json +1 -1
  541. package/package.json +12 -13
  542. package/polyfill/index.js +8 -5
  543. package/types/lib/core/options.d.ts +2 -0
  544. package/types/lib/idx/interact.d.ts +1 -0
  545. package/types/lib/idx/options.d.ts +2 -0
  546. package/types/lib/idx/types/meta.d.ts +1 -0
  547. package/types/lib/idx/types/options.d.ts +1 -0
  548. package/types/lib/oidc/options/OAuthOptionsConstructor.d.ts +2 -0
  549. package/types/lib/oidc/types/UserClaims.d.ts +1 -0
  550. package/types/lib/oidc/types/api.d.ts +1 -0
  551. package/types/lib/oidc/types/meta.d.ts +1 -1
  552. package/types/lib/oidc/types/options.d.ts +2 -1
  553. package/types/lib/oidc/types/proto.d.ts +1 -0
  554. package/umd/authn.js +1 -1
  555. package/umd/authn.js.LICENSE.txt +2 -0
  556. package/umd/authn.js.map +1 -1
  557. package/umd/core.js +1 -1
  558. package/umd/core.js.LICENSE.txt +2 -0
  559. package/umd/core.js.map +1 -1
  560. package/umd/default.js +1 -1
  561. package/umd/default.js.LICENSE.txt +2 -0
  562. package/umd/default.js.map +1 -1
  563. package/umd/idx.js +1 -1
  564. package/umd/idx.js.LICENSE.txt +2 -0
  565. package/umd/idx.js.map +1 -1
  566. package/umd/myaccount.js +1 -1
  567. package/umd/myaccount.js.LICENSE.txt +2 -0
  568. package/umd/myaccount.js.map +1 -1
@@ -1,15 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  exports.getDefaultTokenParams = getDefaultTokenParams;
4
-
5
4
  var _oauth = require("./oauth");
6
-
7
5
  var _features = require("../../features");
8
-
9
6
  var _util = require("../../util");
10
-
11
7
  /* global window */
12
-
13
8
  /*!
14
9
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
15
10
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -22,6 +17,7 @@ var _util = require("../../util");
22
17
  * See the License for the specific language governing permissions and limitations under the License.
23
18
  *
24
19
  */
20
+
25
21
  function getDefaultTokenParams(sdk) {
26
22
  const {
27
23
  pkce,
@@ -30,6 +26,8 @@ function getDefaultTokenParams(sdk) {
30
26
  responseType,
31
27
  responseMode,
32
28
  scopes,
29
+ acrValues,
30
+ maxAge,
33
31
  state,
34
32
  ignoreSignature
35
33
  } = sdk.options;
@@ -43,6 +41,8 @@ function getDefaultTokenParams(sdk) {
43
41
  state: state || (0, _oauth.generateState)(),
44
42
  nonce: (0, _oauth.generateNonce)(),
45
43
  scopes: scopes || ['openid', 'email'],
44
+ acrValues,
45
+ maxAge,
46
46
  ignoreSignature
47
47
  });
48
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"defaultTokenParams.js","names":["getDefaultTokenParams","sdk","pkce","clientId","redirectUri","responseType","responseMode","scopes","state","ignoreSignature","options","defaultRedirectUri","isBrowser","window","location","href","undefined","removeNils","generateState","nonce","generateNonce"],"sources":["../../../../lib/oidc/util/defaultTokenParams.ts"],"sourcesContent":["\n/* global window */\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 { generateNonce, generateState } from './oauth';\nimport { OktaAuthOAuthInterface, TokenParams } from '../types';\nimport { isBrowser } from '../../features';\nimport { removeNils } from '../../util';\n\nexport function getDefaultTokenParams(sdk: OktaAuthOAuthInterface): TokenParams {\n const {\n pkce,\n clientId,\n redirectUri,\n responseType,\n responseMode,\n scopes,\n state,\n ignoreSignature\n } = sdk.options;\n const defaultRedirectUri = isBrowser() ? window.location.href : undefined;\n return removeNils({\n pkce,\n clientId,\n redirectUri: redirectUri || defaultRedirectUri,\n responseType: responseType || ['token', 'id_token'],\n responseMode,\n state: state || generateState(),\n nonce: generateNonce(),\n scopes: scopes || ['openid', 'email'],\n ignoreSignature\n });\n}"],"mappings":";;;;AAcA;;AAEA;;AACA;;AAhBA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAASA,qBAAT,CAA+BC,GAA/B,EAAyE;EAC9E,MAAM;IACJC,IADI;IAEJC,QAFI;IAGJC,WAHI;IAIJC,YAJI;IAKJC,YALI;IAMJC,MANI;IAOJC,KAPI;IAQJC;EARI,IASFR,GAAG,CAACS,OATR;EAUA,MAAMC,kBAAkB,GAAG,IAAAC,mBAAA,MAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,GAAqCC,SAAhE;EACA,OAAO,IAAAC,gBAAA,EAAW;IAChBf,IADgB;IAEhBC,QAFgB;IAGhBC,WAAW,EAAEA,WAAW,IAAIO,kBAHZ;IAIhBN,YAAY,EAAEA,YAAY,IAAI,CAAC,OAAD,EAAU,UAAV,CAJd;IAKhBC,YALgB;IAMhBE,KAAK,EAAEA,KAAK,IAAI,IAAAU,oBAAA,GANA;IAOhBC,KAAK,EAAE,IAAAC,oBAAA,GAPS;IAQhBb,MAAM,EAAEA,MAAM,IAAI,CAAC,QAAD,EAAW,OAAX,CARF;IAShBE;EATgB,CAAX,CAAP;AAWD"}
1
+ {"version":3,"file":"defaultTokenParams.js","names":["getDefaultTokenParams","sdk","pkce","clientId","redirectUri","responseType","responseMode","scopes","acrValues","maxAge","state","ignoreSignature","options","defaultRedirectUri","isBrowser","window","location","href","undefined","removeNils","generateState","nonce","generateNonce"],"sources":["../../../../lib/oidc/util/defaultTokenParams.ts"],"sourcesContent":["\n/* global window */\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 { generateNonce, generateState } from './oauth';\nimport { OktaAuthOAuthInterface, TokenParams } from '../types';\nimport { isBrowser } from '../../features';\nimport { removeNils } from '../../util';\n\nexport function getDefaultTokenParams(sdk: OktaAuthOAuthInterface): TokenParams {\n const {\n pkce,\n clientId,\n redirectUri,\n responseType,\n responseMode,\n scopes,\n acrValues,\n maxAge,\n state,\n ignoreSignature\n } = sdk.options;\n const defaultRedirectUri = isBrowser() ? window.location.href : undefined;\n return removeNils({\n pkce,\n clientId,\n redirectUri: redirectUri || defaultRedirectUri,\n responseType: responseType || ['token', 'id_token'],\n responseMode,\n state: state || generateState(),\n nonce: generateNonce(),\n scopes: scopes || ['openid', 'email'],\n acrValues,\n maxAge,\n ignoreSignature\n });\n}"],"mappings":";;;AAcA;AAEA;AACA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,SAASA,qBAAqB,CAACC,GAA2B,EAAe;EAC9E,MAAM;IACJC,IAAI;IACJC,QAAQ;IACRC,WAAW;IACXC,YAAY;IACZC,YAAY;IACZC,MAAM;IACNC,SAAS;IACTC,MAAM;IACNC,KAAK;IACLC;EACF,CAAC,GAAGV,GAAG,CAACW,OAAO;EACf,MAAMC,kBAAkB,GAAG,IAAAC,mBAAS,GAAE,GAAGC,MAAM,CAACC,QAAQ,CAACC,IAAI,GAAGC,SAAS;EACzE,OAAO,IAAAC,gBAAU,EAAC;IAChBjB,IAAI;IACJC,QAAQ;IACRC,WAAW,EAAEA,WAAW,IAAIS,kBAAkB;IAC9CR,YAAY,EAAEA,YAAY,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC;IACnDC,YAAY;IACZI,KAAK,EAAEA,KAAK,IAAI,IAAAU,oBAAa,GAAE;IAC/BC,KAAK,EAAE,IAAAC,oBAAa,GAAE;IACtBf,MAAM,EAAEA,MAAM,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC;IACrCC,SAAS;IACTC,MAAM;IACNE;EACF,CAAC,CAAC;AACJ"}
@@ -3,9 +3,7 @@
3
3
  exports.isAuthorizationCodeError = isAuthorizationCodeError;
4
4
  exports.isInteractionRequiredError = isInteractionRequiredError;
5
5
  exports.isRefreshTokenInvalidError = isRefreshTokenInvalidError;
6
-
7
6
  var _errors = require("../../errors");
8
-
9
7
  /*!
10
8
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
11
9
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -17,27 +15,24 @@ var _errors = require("../../errors");
17
15
  *
18
16
  * See the License for the specific language governing permissions and limitations under the License.
19
17
  */
18
+
20
19
  function isInteractionRequiredError(error) {
21
20
  if (error.name !== 'OAuthError') {
22
21
  return false;
23
22
  }
24
-
25
23
  const oauthError = error;
26
24
  return oauthError.errorCode === 'interaction_required';
27
25
  }
28
-
29
26
  function isAuthorizationCodeError(sdk, error) {
30
27
  if (error.name !== 'AuthApiError') {
31
28
  return false;
32
29
  }
33
-
34
- const authApiError = error; // xhr property doesn't seem to match XMLHttpRequest type
35
-
30
+ const authApiError = error;
31
+ // xhr property doesn't seem to match XMLHttpRequest type
36
32
  const errorResponse = authApiError.xhr;
37
33
  const responseJSON = errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.responseJSON;
38
34
  return sdk.options.pkce && (responseJSON === null || responseJSON === void 0 ? void 0 : responseJSON.error) === 'invalid_grant';
39
35
  }
40
-
41
36
  function isRefreshTokenInvalidError(error) {
42
37
  // error: {"error":"invalid_grant","error_description":"The refresh token is invalid or expired."}
43
38
  return (0, _errors.isOAuthError)(error) && error.errorCode === 'invalid_grant' && error.errorSummary === 'The refresh token is invalid or expired.';
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":["isInteractionRequiredError","error","name","oauthError","errorCode","isAuthorizationCodeError","sdk","authApiError","errorResponse","xhr","responseJSON","options","pkce","isRefreshTokenInvalidError","isOAuthError","errorSummary"],"sources":["../../../../lib/oidc/util/errors.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { OktaAuthOAuthInterface } from '../types';\nimport { OAuthError, AuthApiError, isOAuthError } from '../../errors';\n\nexport function isInteractionRequiredError(error: Error) {\n if (error.name !== 'OAuthError') {\n return false;\n }\n const oauthError = error as OAuthError;\n return (oauthError.errorCode === 'interaction_required');\n}\n\nexport function isAuthorizationCodeError(sdk: OktaAuthOAuthInterface, error: Error) {\n if (error.name !== 'AuthApiError') {\n return false;\n }\n const authApiError = error as AuthApiError;\n // xhr property doesn't seem to match XMLHttpRequest type\n const errorResponse = authApiError.xhr as unknown as Record<string, unknown>;\n const responseJSON = errorResponse?.responseJSON as Record<string, unknown>;\n return sdk.options.pkce && (responseJSON?.error as string === 'invalid_grant');\n}\n\nexport function isRefreshTokenInvalidError(error: unknown): boolean {\n // error: {\"error\":\"invalid_grant\",\"error_description\":\"The refresh token is invalid or expired.\"}\n return isOAuthError(error) &&\n error.errorCode === 'invalid_grant' &&\n error.errorSummary === 'The refresh token is invalid or expired.';\n}\n"],"mappings":";;;;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAASA,0BAAT,CAAoCC,KAApC,EAAkD;EACvD,IAAIA,KAAK,CAACC,IAAN,KAAe,YAAnB,EAAiC;IAC/B,OAAO,KAAP;EACD;;EACD,MAAMC,UAAU,GAAGF,KAAnB;EACA,OAAQE,UAAU,CAACC,SAAX,KAAyB,sBAAjC;AACD;;AAEM,SAASC,wBAAT,CAAkCC,GAAlC,EAA+DL,KAA/D,EAA6E;EAClF,IAAIA,KAAK,CAACC,IAAN,KAAe,cAAnB,EAAmC;IACjC,OAAO,KAAP;EACD;;EACD,MAAMK,YAAY,GAAGN,KAArB,CAJkF,CAKlF;;EACA,MAAMO,aAAa,GAAGD,YAAY,CAACE,GAAnC;EACA,MAAMC,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAEE,YAApC;EACA,OAAOJ,GAAG,CAACK,OAAJ,CAAYC,IAAZ,IAAqB,CAAAF,YAAY,SAAZ,IAAAA,YAAY,WAAZ,YAAAA,YAAY,CAAET,KAAd,MAAkC,eAA9D;AACD;;AAEM,SAASY,0BAAT,CAAoCZ,KAApC,EAA6D;EAClE;EACA,OAAO,IAAAa,oBAAA,EAAab,KAAb,KACLA,KAAK,CAACG,SAAN,KAAoB,eADf,IAELH,KAAK,CAACc,YAAN,KAAuB,0CAFzB;AAGD"}
1
+ {"version":3,"file":"errors.js","names":["isInteractionRequiredError","error","name","oauthError","errorCode","isAuthorizationCodeError","sdk","authApiError","errorResponse","xhr","responseJSON","options","pkce","isRefreshTokenInvalidError","isOAuthError","errorSummary"],"sources":["../../../../lib/oidc/util/errors.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { OktaAuthOAuthInterface } from '../types';\nimport { OAuthError, AuthApiError, isOAuthError } from '../../errors';\n\nexport function isInteractionRequiredError(error: Error) {\n if (error.name !== 'OAuthError') {\n return false;\n }\n const oauthError = error as OAuthError;\n return (oauthError.errorCode === 'interaction_required');\n}\n\nexport function isAuthorizationCodeError(sdk: OktaAuthOAuthInterface, error: Error) {\n if (error.name !== 'AuthApiError') {\n return false;\n }\n const authApiError = error as AuthApiError;\n // xhr property doesn't seem to match XMLHttpRequest type\n const errorResponse = authApiError.xhr as unknown as Record<string, unknown>;\n const responseJSON = errorResponse?.responseJSON as Record<string, unknown>;\n return sdk.options.pkce && (responseJSON?.error as string === 'invalid_grant');\n}\n\nexport function isRefreshTokenInvalidError(error: unknown): boolean {\n // error: {\"error\":\"invalid_grant\",\"error_description\":\"The refresh token is invalid or expired.\"}\n return isOAuthError(error) &&\n error.errorCode === 'invalid_grant' &&\n error.errorSummary === 'The refresh token is invalid or expired.';\n}\n"],"mappings":";;;;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,SAASA,0BAA0B,CAACC,KAAY,EAAE;EACvD,IAAIA,KAAK,CAACC,IAAI,KAAK,YAAY,EAAE;IAC/B,OAAO,KAAK;EACd;EACA,MAAMC,UAAU,GAAGF,KAAmB;EACtC,OAAQE,UAAU,CAACC,SAAS,KAAK,sBAAsB;AACzD;AAEO,SAASC,wBAAwB,CAACC,GAA2B,EAAEL,KAAY,EAAE;EAClF,IAAIA,KAAK,CAACC,IAAI,KAAK,cAAc,EAAE;IACjC,OAAO,KAAK;EACd;EACA,MAAMK,YAAY,GAAGN,KAAqB;EAC1C;EACA,MAAMO,aAAa,GAAGD,YAAY,CAACE,GAAyC;EAC5E,MAAMC,YAAY,GAAGF,aAAa,aAAbA,aAAa,uBAAbA,aAAa,CAAEE,YAAuC;EAC3E,OAAOJ,GAAG,CAACK,OAAO,CAACC,IAAI,IAAK,CAAAF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAET,KAAK,MAAe,eAAgB;AAChF;AAEO,SAASY,0BAA0B,CAACZ,KAAc,EAAW;EAClE;EACA,OAAO,IAAAa,oBAAY,EAACb,KAAK,CAAC,IACxBA,KAAK,CAACG,SAAS,KAAK,eAAe,IACnCH,KAAK,CAACc,YAAY,KAAK,0CAA0C;AACrE"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _exportNames = {
6
5
  pkce: true
7
6
  };
@@ -11,9 +10,7 @@ Object.defineProperty(exports, "pkce", {
11
10
  return _pkce.default;
12
11
  }
13
12
  });
14
-
15
13
  var _browser = require("./browser");
16
-
17
14
  Object.keys(_browser).forEach(function (key) {
18
15
  if (key === "default" || key === "__esModule") return;
19
16
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -25,9 +22,7 @@ Object.keys(_browser).forEach(function (key) {
25
22
  }
26
23
  });
27
24
  });
28
-
29
25
  var _defaultTokenParams = require("./defaultTokenParams");
30
-
31
26
  Object.keys(_defaultTokenParams).forEach(function (key) {
32
27
  if (key === "default" || key === "__esModule") return;
33
28
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -39,9 +34,7 @@ Object.keys(_defaultTokenParams).forEach(function (key) {
39
34
  }
40
35
  });
41
36
  });
42
-
43
37
  var _errors = require("./errors");
44
-
45
38
  Object.keys(_errors).forEach(function (key) {
46
39
  if (key === "default" || key === "__esModule") return;
47
40
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -53,9 +46,7 @@ Object.keys(_errors).forEach(function (key) {
53
46
  }
54
47
  });
55
48
  });
56
-
57
49
  var _loginRedirect = require("./loginRedirect");
58
-
59
50
  Object.keys(_loginRedirect).forEach(function (key) {
60
51
  if (key === "default" || key === "__esModule") return;
61
52
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -67,9 +58,7 @@ Object.keys(_loginRedirect).forEach(function (key) {
67
58
  }
68
59
  });
69
60
  });
70
-
71
61
  var _oauth = require("./oauth");
72
-
73
62
  Object.keys(_oauth).forEach(function (key) {
74
63
  if (key === "default" || key === "__esModule") return;
75
64
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -81,9 +70,7 @@ Object.keys(_oauth).forEach(function (key) {
81
70
  }
82
71
  });
83
72
  });
84
-
85
73
  var _oauthMeta = require("./oauthMeta");
86
-
87
74
  Object.keys(_oauthMeta).forEach(function (key) {
88
75
  if (key === "default" || key === "__esModule") return;
89
76
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -95,11 +82,8 @@ Object.keys(_oauthMeta).forEach(function (key) {
95
82
  }
96
83
  });
97
84
  });
98
-
99
85
  var _pkce = _interopRequireDefault(require("./pkce"));
100
-
101
86
  var _prepareTokenParams = require("./prepareTokenParams");
102
-
103
87
  Object.keys(_prepareTokenParams).forEach(function (key) {
104
88
  if (key === "default" || key === "__esModule") return;
105
89
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -111,9 +95,7 @@ Object.keys(_prepareTokenParams).forEach(function (key) {
111
95
  }
112
96
  });
113
97
  });
114
-
115
98
  var _refreshToken = require("./refreshToken");
116
-
117
99
  Object.keys(_refreshToken).forEach(function (key) {
118
100
  if (key === "default" || key === "__esModule") return;
119
101
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -125,9 +107,7 @@ Object.keys(_refreshToken).forEach(function (key) {
125
107
  }
126
108
  });
127
109
  });
128
-
129
110
  var _urlParams = require("./urlParams");
130
-
131
111
  Object.keys(_urlParams).forEach(function (key) {
132
112
  if (key === "default" || key === "__esModule") return;
133
113
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -139,9 +119,7 @@ Object.keys(_urlParams).forEach(function (key) {
139
119
  }
140
120
  });
141
121
  });
142
-
143
122
  var _validateClaims = require("./validateClaims");
144
-
145
123
  Object.keys(_validateClaims).forEach(function (key) {
146
124
  if (key === "default" || key === "__esModule") return;
147
125
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -153,9 +131,7 @@ Object.keys(_validateClaims).forEach(function (key) {
153
131
  }
154
132
  });
155
133
  });
156
-
157
134
  var _validateToken = require("./validateToken");
158
-
159
135
  Object.keys(_validateToken).forEach(function (key) {
160
136
  if (key === "default" || key === "__esModule") return;
161
137
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../lib/oidc/util/index.ts"],"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\nexport * from './browser';\nexport * from './defaultTokenParams';\nexport * from './errors';\nexport * from './loginRedirect';\nexport * from './oauth';\nexport * from './oauthMeta';\nimport pkce from './pkce';\nexport { pkce };\nexport * from './prepareTokenParams';\nexport * from './refreshToken';\nexport * from './urlParams';\nexport * from './validateClaims';\nexport * from './validateToken';\n"],"mappings":";;;;;;;;;;;;;;AAcA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAEA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../lib/oidc/util/index.ts"],"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\nexport * from './browser';\nexport * from './defaultTokenParams';\nexport * from './errors';\nexport * from './loginRedirect';\nexport * from './oauth';\nexport * from './oauthMeta';\nimport pkce from './pkce';\nexport { pkce };\nexport * from './prepareTokenParams';\nexport * from './refreshToken';\nexport * from './urlParams';\nexport * from './validateClaims';\nexport * from './validateToken';\n"],"mappings":";;;;;;;;;;;;AAcA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -9,7 +9,6 @@ exports.isCodeFlow = isCodeFlow;
9
9
  exports.isInteractionRequired = isInteractionRequired;
10
10
  exports.isLoginRedirect = isLoginRedirect;
11
11
  exports.isRedirectUri = isRedirectUri;
12
-
13
12
  /*!
14
13
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
15
14
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -22,81 +21,70 @@ exports.isRedirectUri = isRedirectUri;
22
21
  * See the License for the specific language governing permissions and limitations under the License.
23
22
  *
24
23
  */
25
-
26
24
  /* global window */
27
-
28
25
  /* eslint-disable complexity, max-statements */
26
+
29
27
  function hasTokensInHash(hash) {
30
28
  return /((id|access)_token=)/i.test(hash);
31
- } // authorization_code
32
-
29
+ }
33
30
 
31
+ // authorization_code
34
32
  function hasAuthorizationCode(hashOrSearch) {
35
33
  return /(code=)/i.test(hashOrSearch);
36
- } // interaction_code
37
-
34
+ }
38
35
 
36
+ // interaction_code
39
37
  function hasInteractionCode(hashOrSearch) {
40
38
  return /(interaction_code=)/i.test(hashOrSearch);
41
39
  }
42
-
43
40
  function hasErrorInUrl(hashOrSearch) {
44
41
  return /(error=)/i.test(hashOrSearch) || /(error_description)/i.test(hashOrSearch);
45
42
  }
46
-
47
43
  function isRedirectUri(uri, sdk) {
48
44
  var authParams = sdk.options;
49
-
50
45
  if (!uri || !authParams.redirectUri) {
51
46
  return false;
52
47
  }
53
-
54
48
  return uri.indexOf(authParams.redirectUri) === 0;
55
49
  }
56
-
57
50
  function isCodeFlow(options) {
58
51
  return options.pkce || options.responseType === 'code' || options.responseMode === 'query';
59
52
  }
60
-
61
53
  function getHashOrSearch(options) {
62
54
  var codeFlow = isCodeFlow(options);
63
55
  var useQuery = codeFlow && options.responseMode !== 'fragment';
64
56
  return useQuery ? window.location.search : window.location.hash;
65
57
  }
58
+
66
59
  /**
67
60
  * Check if tokens or a code have been passed back into the url, which happens in
68
61
  * the OIDC (including social auth IDP) redirect flow.
69
62
  */
70
-
71
-
72
63
  function isLoginRedirect(sdk) {
73
64
  // First check, is this a redirect URI?
74
65
  if (!isRedirectUri(window.location.href, sdk)) {
75
66
  return false;
76
- } // The location contains either a code, token, or an error + error_description
77
-
67
+ }
78
68
 
69
+ // The location contains either a code, token, or an error + error_description
79
70
  var codeFlow = isCodeFlow(sdk.options);
80
71
  var hashOrSearch = getHashOrSearch(sdk.options);
81
-
82
72
  if (hasErrorInUrl(hashOrSearch)) {
83
73
  return true;
84
74
  }
85
-
86
75
  if (codeFlow) {
87
76
  var hasCode = hasAuthorizationCode(hashOrSearch) || hasInteractionCode(hashOrSearch);
88
77
  return hasCode;
89
- } // implicit flow, will always be hash fragment
90
-
78
+ }
91
79
 
80
+ // implicit flow, will always be hash fragment
92
81
  return hasTokensInHash(window.location.hash);
93
82
  }
83
+
94
84
  /**
95
85
  * Check if error=interaction_required has been passed back in the url, which happens in
96
86
  * the social auth IDP redirect flow.
97
87
  */
98
-
99
-
100
88
  function isInteractionRequired(sdk, hashOrSearch) {
101
89
  if (!hashOrSearch) {
102
90
  // web only
@@ -104,10 +92,8 @@ function isInteractionRequired(sdk, hashOrSearch) {
104
92
  if (!isLoginRedirect(sdk)) {
105
93
  return false;
106
94
  }
107
-
108
95
  hashOrSearch = getHashOrSearch(sdk.options);
109
96
  }
110
-
111
97
  return /(error=interaction_required)/i.test(hashOrSearch);
112
98
  }
113
99
  //# sourceMappingURL=loginRedirect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loginRedirect.js","names":["hasTokensInHash","hash","test","hasAuthorizationCode","hashOrSearch","hasInteractionCode","hasErrorInUrl","isRedirectUri","uri","sdk","authParams","options","redirectUri","indexOf","isCodeFlow","pkce","responseType","responseMode","getHashOrSearch","codeFlow","useQuery","window","location","search","isLoginRedirect","href","hasCode","isInteractionRequired"],"sources":["../../../../lib/oidc/util/loginRedirect.ts"],"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 { OktaAuthOAuthOptions, OktaAuthOAuthInterface } 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: OktaAuthOAuthInterface): boolean {\n var authParams = sdk.options;\n if (!uri || !authParams.redirectUri) {\n return false;\n }\n return uri.indexOf(authParams.redirectUri) === 0;\n}\n\nexport function isCodeFlow(options: OktaAuthOAuthOptions) {\n return options.pkce || options.responseType === 'code' || options.responseMode === 'query';\n}\n\nexport function getHashOrSearch(options: OktaAuthOAuthOptions) {\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: OktaAuthOAuthInterface) {\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: OktaAuthOAuthInterface, 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}"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;;AACA;AAGO,SAASA,eAAT,CAAyBC,IAAzB,EAAgD;EACrD,OAAO,wBAAwBC,IAAxB,CAA6BD,IAA7B,CAAP;AACD,C,CAED;;;AACO,SAASE,oBAAT,CAA8BC,YAA9B,EAA6D;EAClE,OAAO,WAAWF,IAAX,CAAgBE,YAAhB,CAAP;AACD,C,CAED;;;AACO,SAASC,kBAAT,CAA4BD,YAA5B,EAA2D;EAChE,OAAO,uBAAuBF,IAAvB,CAA4BE,YAA5B,CAAP;AACD;;AAEM,SAASE,aAAT,CAAuBF,YAAvB,EAAsD;EAC3D,OAAO,YAAYF,IAAZ,CAAiBE,YAAjB,KAAkC,uBAAuBF,IAAvB,CAA4BE,YAA5B,CAAzC;AACD;;AAEM,SAASG,aAAT,CAAuBC,GAAvB,EAAoCC,GAApC,EAA0E;EAC/E,IAAIC,UAAU,GAAGD,GAAG,CAACE,OAArB;;EACA,IAAI,CAACH,GAAD,IAAQ,CAACE,UAAU,CAACE,WAAxB,EAAqC;IACnC,OAAO,KAAP;EACD;;EACD,OAAOJ,GAAG,CAACK,OAAJ,CAAYH,UAAU,CAACE,WAAvB,MAAwC,CAA/C;AACD;;AAEM,SAASE,UAAT,CAAoBH,OAApB,EAAmD;EACxD,OAAOA,OAAO,CAACI,IAAR,IAAgBJ,OAAO,CAACK,YAAR,KAAyB,MAAzC,IAAmDL,OAAO,CAACM,YAAR,KAAyB,OAAnF;AACD;;AAEM,SAASC,eAAT,CAAyBP,OAAzB,EAAwD;EAC7D,IAAIQ,QAAQ,GAAGL,UAAU,CAACH,OAAD,CAAzB;EACA,IAAIS,QAAQ,GAAGD,QAAQ,IAAIR,OAAO,CAACM,YAAR,KAAyB,UAApD;EACA,OAAOG,QAAQ,GAAGC,MAAM,CAACC,QAAP,CAAgBC,MAAnB,GAA4BF,MAAM,CAACC,QAAP,CAAgBrB,IAA3D;AACD;AAED;AACA;AACA;AACA;;;AACO,SAASuB,eAAT,CAA0Bf,GAA1B,EAAuD;EAC5D;EACA,IAAI,CAACF,aAAa,CAACc,MAAM,CAACC,QAAP,CAAgBG,IAAjB,EAAuBhB,GAAvB,CAAlB,EAA8C;IAC5C,OAAO,KAAP;EACD,CAJ2D,CAM5D;;;EACA,IAAIU,QAAQ,GAAGL,UAAU,CAACL,GAAG,CAACE,OAAL,CAAzB;EACA,IAAIP,YAAY,GAAGc,eAAe,CAACT,GAAG,CAACE,OAAL,CAAlC;;EAEA,IAAIL,aAAa,CAACF,YAAD,CAAjB,EAAiC;IAC/B,OAAO,IAAP;EACD;;EAED,IAAIe,QAAJ,EAAc;IACZ,IAAIO,OAAO,GAAIvB,oBAAoB,CAACC,YAAD,CAApB,IAAsCC,kBAAkB,CAACD,YAAD,CAAvE;IACA,OAAOsB,OAAP;EACD,CAjB2D,CAmB5D;;;EACA,OAAO1B,eAAe,CAACqB,MAAM,CAACC,QAAP,CAAgBrB,IAAjB,CAAtB;AACD;AAED;AACA;AACA;AACA;;;AACO,SAAS0B,qBAAT,CAAgClB,GAAhC,EAA6DL,YAA7D,EAAoF;EACzF,IAAI,CAACA,YAAL,EAAmB;IAAE;IACnB;IACA,IAAI,CAACoB,eAAe,CAACf,GAAD,CAApB,EAA0B;MACxB,OAAO,KAAP;IACD;;IAEDL,YAAY,GAAGc,eAAe,CAACT,GAAG,CAACE,OAAL,CAA9B;EACD;;EACD,OAAO,gCAAgCT,IAAhC,CAAqCE,YAArC,CAAP;AACD"}
1
+ {"version":3,"file":"loginRedirect.js","names":["hasTokensInHash","hash","test","hasAuthorizationCode","hashOrSearch","hasInteractionCode","hasErrorInUrl","isRedirectUri","uri","sdk","authParams","options","redirectUri","indexOf","isCodeFlow","pkce","responseType","responseMode","getHashOrSearch","codeFlow","useQuery","window","location","search","isLoginRedirect","href","hasCode","isInteractionRequired"],"sources":["../../../../lib/oidc/util/loginRedirect.ts"],"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 { OktaAuthOAuthOptions, OktaAuthOAuthInterface } 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: OktaAuthOAuthInterface): boolean {\n var authParams = sdk.options;\n if (!uri || !authParams.redirectUri) {\n return false;\n }\n return uri.indexOf(authParams.redirectUri) === 0;\n}\n\nexport function isCodeFlow(options: OktaAuthOAuthOptions) {\n return options.pkce || options.responseType === 'code' || options.responseMode === 'query';\n}\n\nexport function getHashOrSearch(options: OktaAuthOAuthOptions) {\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: OktaAuthOAuthInterface) {\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: OktaAuthOAuthInterface, 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}"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGO,SAASA,eAAe,CAACC,IAAY,EAAW;EACrD,OAAO,uBAAuB,CAACC,IAAI,CAACD,IAAI,CAAC;AAC3C;;AAEA;AACO,SAASE,oBAAoB,CAACC,YAAoB,EAAW;EAClE,OAAO,UAAU,CAACF,IAAI,CAACE,YAAY,CAAC;AACtC;;AAEA;AACO,SAASC,kBAAkB,CAACD,YAAoB,EAAW;EAChE,OAAO,sBAAsB,CAACF,IAAI,CAACE,YAAY,CAAC;AAClD;AAEO,SAASE,aAAa,CAACF,YAAoB,EAAW;EAC3D,OAAO,WAAW,CAACF,IAAI,CAACE,YAAY,CAAC,IAAI,sBAAsB,CAACF,IAAI,CAACE,YAAY,CAAC;AACpF;AAEO,SAASG,aAAa,CAACC,GAAW,EAAEC,GAA2B,EAAW;EAC/E,IAAIC,UAAU,GAAGD,GAAG,CAACE,OAAO;EAC5B,IAAI,CAACH,GAAG,IAAI,CAACE,UAAU,CAACE,WAAW,EAAE;IACnC,OAAO,KAAK;EACd;EACA,OAAOJ,GAAG,CAACK,OAAO,CAACH,UAAU,CAACE,WAAW,CAAC,KAAK,CAAC;AAClD;AAEO,SAASE,UAAU,CAACH,OAA6B,EAAE;EACxD,OAAOA,OAAO,CAACI,IAAI,IAAIJ,OAAO,CAACK,YAAY,KAAK,MAAM,IAAIL,OAAO,CAACM,YAAY,KAAK,OAAO;AAC5F;AAEO,SAASC,eAAe,CAACP,OAA6B,EAAE;EAC7D,IAAIQ,QAAQ,GAAGL,UAAU,CAACH,OAAO,CAAC;EAClC,IAAIS,QAAQ,GAAGD,QAAQ,IAAIR,OAAO,CAACM,YAAY,KAAK,UAAU;EAC9D,OAAOG,QAAQ,GAAGC,MAAM,CAACC,QAAQ,CAACC,MAAM,GAAGF,MAAM,CAACC,QAAQ,CAACrB,IAAI;AACjE;;AAEA;AACA;AACA;AACA;AACO,SAASuB,eAAe,CAAEf,GAA2B,EAAE;EAC5D;EACA,IAAI,CAACF,aAAa,CAACc,MAAM,CAACC,QAAQ,CAACG,IAAI,EAAEhB,GAAG,CAAC,EAAC;IAC5C,OAAO,KAAK;EACd;;EAEA;EACA,IAAIU,QAAQ,GAAGL,UAAU,CAACL,GAAG,CAACE,OAAO,CAAC;EACtC,IAAIP,YAAY,GAAGc,eAAe,CAACT,GAAG,CAACE,OAAO,CAAC;EAE/C,IAAIL,aAAa,CAACF,YAAY,CAAC,EAAE;IAC/B,OAAO,IAAI;EACb;EAEA,IAAIe,QAAQ,EAAE;IACZ,IAAIO,OAAO,GAAIvB,oBAAoB,CAACC,YAAY,CAAC,IAAIC,kBAAkB,CAACD,YAAY,CAAC;IACrF,OAAOsB,OAAO;EAChB;;EAEA;EACA,OAAO1B,eAAe,CAACqB,MAAM,CAACC,QAAQ,CAACrB,IAAI,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACO,SAAS0B,qBAAqB,CAAElB,GAA2B,EAAEL,YAAqB,EAAE;EACzF,IAAI,CAACA,YAAY,EAAE;IAAE;IACnB;IACA,IAAI,CAACoB,eAAe,CAACf,GAAG,CAAC,EAAC;MACxB,OAAO,KAAK;IACd;IAEAL,YAAY,GAAGc,eAAe,CAACT,GAAG,CAACE,OAAO,CAAC;EAC7C;EACA,OAAO,+BAA+B,CAACT,IAAI,CAACE,YAAY,CAAC;AAC3D"}
@@ -1,17 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  exports.generateNonce = generateNonce;
6
5
  exports.generateState = generateState;
7
6
  exports.getOAuthBaseUrl = getOAuthBaseUrl;
8
7
  exports.getOAuthDomain = getOAuthDomain;
9
8
  exports.getOAuthUrls = getOAuthUrls;
10
-
11
9
  var _util = require("../../util");
12
-
13
10
  var _AuthSdkError = _interopRequireDefault(require("../../errors/AuthSdkError"));
14
-
15
11
  /*!
16
12
  * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
17
13
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -24,40 +20,35 @@ var _AuthSdkError = _interopRequireDefault(require("../../errors/AuthSdkError"))
24
20
  * See the License for the specific language governing permissions and limitations under the License.
25
21
  *
26
22
  */
27
-
28
23
  /* eslint-disable complexity, max-statements */
24
+
29
25
  function generateState() {
30
26
  return (0, _util.genRandomString)(64);
31
27
  }
32
-
33
28
  function generateNonce() {
34
29
  return (0, _util.genRandomString)(64);
35
30
  }
36
-
37
31
  function getIssuer(sdk, options = {}) {
38
32
  const issuer = (0, _util.removeTrailingSlash)(options.issuer) || sdk.options.issuer;
39
33
  return issuer;
40
34
  }
41
-
42
35
  function getOAuthBaseUrl(sdk, options = {}) {
43
36
  const issuer = getIssuer(sdk, options);
44
37
  const baseUrl = issuer.indexOf('/oauth2') > 0 ? issuer : issuer + '/oauth2';
45
38
  return baseUrl;
46
39
  }
47
-
48
40
  function getOAuthDomain(sdk, options = {}) {
49
41
  const issuer = getIssuer(sdk, options);
50
42
  const domain = issuer.split('/oauth2')[0];
51
43
  return domain;
52
44
  }
53
-
54
45
  function getOAuthUrls(sdk, options) {
55
46
  if (arguments.length > 2) {
56
47
  throw new _AuthSdkError.default('As of version 3.0, "getOAuthUrls" takes only a single set of options');
57
48
  }
49
+ options = options || {};
58
50
 
59
- options = options || {}; // Get user-supplied arguments
60
-
51
+ // Get user-supplied arguments
61
52
  var authorizeUrl = (0, _util.removeTrailingSlash)(options.authorizeUrl) || sdk.options.authorizeUrl;
62
53
  var issuer = getIssuer(sdk, options);
63
54
  var userinfoUrl = (0, _util.removeTrailingSlash)(options.userinfoUrl) || sdk.options.userinfoUrl;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.js","names":["generateState","genRandomString","generateNonce","getIssuer","sdk","options","issuer","removeTrailingSlash","getOAuthBaseUrl","baseUrl","indexOf","getOAuthDomain","domain","split","getOAuthUrls","arguments","length","AuthSdkError","authorizeUrl","userinfoUrl","tokenUrl","logoutUrl","revokeUrl"],"sources":["../../../../lib/oidc/util/oauth.ts"],"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 */\nimport { genRandomString, removeTrailingSlash } from '../../util';\nimport AuthSdkError from '../../errors/AuthSdkError';\nimport { OktaAuthOAuthInterface, CustomUrls } from '../types';\n\nexport function generateState() {\n return genRandomString(64);\n}\n\nexport function generateNonce() {\n return genRandomString(64);\n}\n\nfunction getIssuer(sdk: OktaAuthOAuthInterface, options: CustomUrls = {}) {\n const issuer = removeTrailingSlash(options.issuer) || sdk.options.issuer;\n return issuer;\n}\n\nexport function getOAuthBaseUrl(sdk: OktaAuthOAuthInterface, options: CustomUrls = {}) {\n const issuer = getIssuer(sdk, options);\n const baseUrl = issuer.indexOf('/oauth2') > 0 ? issuer : issuer + '/oauth2';\n return baseUrl;\n}\n\nexport function getOAuthDomain(sdk: OktaAuthOAuthInterface, options: CustomUrls = {}) {\n const issuer = getIssuer(sdk, options);\n const domain = issuer.split('/oauth2')[0];\n return domain;\n}\n\nexport function getOAuthUrls(sdk: OktaAuthOAuthInterface, options?: CustomUrls): CustomUrls {\n if (arguments.length > 2) {\n throw new AuthSdkError('As of version 3.0, \"getOAuthUrls\" takes only a single set of options');\n }\n options = options || {};\n\n // Get user-supplied arguments\n var authorizeUrl = removeTrailingSlash(options.authorizeUrl) || sdk.options.authorizeUrl;\n var issuer = getIssuer(sdk, options);\n var userinfoUrl = removeTrailingSlash(options.userinfoUrl) || sdk.options.userinfoUrl;\n var tokenUrl = removeTrailingSlash(options.tokenUrl) || sdk.options.tokenUrl;\n var logoutUrl = removeTrailingSlash(options.logoutUrl) || sdk.options.logoutUrl;\n var revokeUrl = removeTrailingSlash(options.revokeUrl) || sdk.options.revokeUrl;\n\n var baseUrl = getOAuthBaseUrl(sdk, options);\n\n authorizeUrl = authorizeUrl || baseUrl + '/v1/authorize';\n userinfoUrl = userinfoUrl || baseUrl + '/v1/userinfo';\n tokenUrl = tokenUrl || baseUrl + '/v1/token';\n revokeUrl = revokeUrl || baseUrl + '/v1/revoke';\n logoutUrl = logoutUrl || baseUrl + '/v1/logout';\n\n return {\n issuer: issuer,\n authorizeUrl: authorizeUrl,\n userinfoUrl: userinfoUrl,\n tokenUrl: tokenUrl,\n revokeUrl: revokeUrl,\n logoutUrl: logoutUrl\n };\n}\n"],"mappings":";;;;;;;;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAKO,SAASA,aAAT,GAAyB;EAC9B,OAAO,IAAAC,qBAAA,EAAgB,EAAhB,CAAP;AACD;;AAEM,SAASC,aAAT,GAAyB;EAC9B,OAAO,IAAAD,qBAAA,EAAgB,EAAhB,CAAP;AACD;;AAED,SAASE,SAAT,CAAmBC,GAAnB,EAAgDC,OAAmB,GAAG,EAAtE,EAA0E;EACxE,MAAMC,MAAM,GAAG,IAAAC,yBAAA,EAAoBF,OAAO,CAACC,MAA5B,KAAuCF,GAAG,CAACC,OAAJ,CAAYC,MAAlE;EACA,OAAOA,MAAP;AACD;;AAEM,SAASE,eAAT,CAAyBJ,GAAzB,EAAsDC,OAAmB,GAAG,EAA5E,EAAgF;EACrF,MAAMC,MAAM,GAAGH,SAAS,CAACC,GAAD,EAAMC,OAAN,CAAxB;EACA,MAAMI,OAAO,GAAGH,MAAM,CAACI,OAAP,CAAe,SAAf,IAA4B,CAA5B,GAAgCJ,MAAhC,GAAyCA,MAAM,GAAG,SAAlE;EACA,OAAOG,OAAP;AACD;;AAEM,SAASE,cAAT,CAAwBP,GAAxB,EAAqDC,OAAmB,GAAG,EAA3E,EAA+E;EACpF,MAAMC,MAAM,GAAGH,SAAS,CAACC,GAAD,EAAMC,OAAN,CAAxB;EACA,MAAMO,MAAM,GAAGN,MAAM,CAACO,KAAP,CAAa,SAAb,EAAwB,CAAxB,CAAf;EACA,OAAOD,MAAP;AACD;;AAEM,SAASE,YAAT,CAAsBV,GAAtB,EAAmDC,OAAnD,EAAqF;EAC1F,IAAIU,SAAS,CAACC,MAAV,GAAmB,CAAvB,EAA0B;IACxB,MAAM,IAAIC,qBAAJ,CAAiB,sEAAjB,CAAN;EACD;;EACDZ,OAAO,GAAGA,OAAO,IAAI,EAArB,CAJ0F,CAM1F;;EACA,IAAIa,YAAY,GAAG,IAAAX,yBAAA,EAAoBF,OAAO,CAACa,YAA5B,KAA6Cd,GAAG,CAACC,OAAJ,CAAYa,YAA5E;EACA,IAAIZ,MAAM,GAAGH,SAAS,CAACC,GAAD,EAAMC,OAAN,CAAtB;EACA,IAAIc,WAAW,GAAG,IAAAZ,yBAAA,EAAoBF,OAAO,CAACc,WAA5B,KAA4Cf,GAAG,CAACC,OAAJ,CAAYc,WAA1E;EACA,IAAIC,QAAQ,GAAG,IAAAb,yBAAA,EAAoBF,OAAO,CAACe,QAA5B,KAAyChB,GAAG,CAACC,OAAJ,CAAYe,QAApE;EACA,IAAIC,SAAS,GAAG,IAAAd,yBAAA,EAAoBF,OAAO,CAACgB,SAA5B,KAA0CjB,GAAG,CAACC,OAAJ,CAAYgB,SAAtE;EACA,IAAIC,SAAS,GAAG,IAAAf,yBAAA,EAAoBF,OAAO,CAACiB,SAA5B,KAA0ClB,GAAG,CAACC,OAAJ,CAAYiB,SAAtE;EAEA,IAAIb,OAAO,GAAGD,eAAe,CAACJ,GAAD,EAAMC,OAAN,CAA7B;EAEAa,YAAY,GAAGA,YAAY,IAAIT,OAAO,GAAG,eAAzC;EACAU,WAAW,GAAGA,WAAW,IAAIV,OAAO,GAAG,cAAvC;EACAW,QAAQ,GAAGA,QAAQ,IAAIX,OAAO,GAAG,WAAjC;EACAa,SAAS,GAAGA,SAAS,IAAIb,OAAO,GAAG,YAAnC;EACAY,SAAS,GAAGA,SAAS,IAAIZ,OAAO,GAAG,YAAnC;EAEA,OAAO;IACLH,MAAM,EAAEA,MADH;IAELY,YAAY,EAAEA,YAFT;IAGLC,WAAW,EAAEA,WAHR;IAILC,QAAQ,EAAEA,QAJL;IAKLE,SAAS,EAAEA,SALN;IAMLD,SAAS,EAAEA;EANN,CAAP;AAQD"}
1
+ {"version":3,"file":"oauth.js","names":["generateState","genRandomString","generateNonce","getIssuer","sdk","options","issuer","removeTrailingSlash","getOAuthBaseUrl","baseUrl","indexOf","getOAuthDomain","domain","split","getOAuthUrls","arguments","length","AuthSdkError","authorizeUrl","userinfoUrl","tokenUrl","logoutUrl","revokeUrl"],"sources":["../../../../lib/oidc/util/oauth.ts"],"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 */\nimport { genRandomString, removeTrailingSlash } from '../../util';\nimport AuthSdkError from '../../errors/AuthSdkError';\nimport { OktaAuthOAuthInterface, CustomUrls } from '../types';\n\nexport function generateState() {\n return genRandomString(64);\n}\n\nexport function generateNonce() {\n return genRandomString(64);\n}\n\nfunction getIssuer(sdk: OktaAuthOAuthInterface, options: CustomUrls = {}) {\n const issuer = removeTrailingSlash(options.issuer) || sdk.options.issuer;\n return issuer;\n}\n\nexport function getOAuthBaseUrl(sdk: OktaAuthOAuthInterface, options: CustomUrls = {}) {\n const issuer = getIssuer(sdk, options);\n const baseUrl = issuer.indexOf('/oauth2') > 0 ? issuer : issuer + '/oauth2';\n return baseUrl;\n}\n\nexport function getOAuthDomain(sdk: OktaAuthOAuthInterface, options: CustomUrls = {}) {\n const issuer = getIssuer(sdk, options);\n const domain = issuer.split('/oauth2')[0];\n return domain;\n}\n\nexport function getOAuthUrls(sdk: OktaAuthOAuthInterface, options?: CustomUrls): CustomUrls {\n if (arguments.length > 2) {\n throw new AuthSdkError('As of version 3.0, \"getOAuthUrls\" takes only a single set of options');\n }\n options = options || {};\n\n // Get user-supplied arguments\n var authorizeUrl = removeTrailingSlash(options.authorizeUrl) || sdk.options.authorizeUrl;\n var issuer = getIssuer(sdk, options);\n var userinfoUrl = removeTrailingSlash(options.userinfoUrl) || sdk.options.userinfoUrl;\n var tokenUrl = removeTrailingSlash(options.tokenUrl) || sdk.options.tokenUrl;\n var logoutUrl = removeTrailingSlash(options.logoutUrl) || sdk.options.logoutUrl;\n var revokeUrl = removeTrailingSlash(options.revokeUrl) || sdk.options.revokeUrl;\n\n var baseUrl = getOAuthBaseUrl(sdk, options);\n\n authorizeUrl = authorizeUrl || baseUrl + '/v1/authorize';\n userinfoUrl = userinfoUrl || baseUrl + '/v1/userinfo';\n tokenUrl = tokenUrl || baseUrl + '/v1/token';\n revokeUrl = revokeUrl || baseUrl + '/v1/revoke';\n logoutUrl = logoutUrl || baseUrl + '/v1/logout';\n\n return {\n issuer: issuer,\n authorizeUrl: authorizeUrl,\n userinfoUrl: userinfoUrl,\n tokenUrl: tokenUrl,\n revokeUrl: revokeUrl,\n logoutUrl: logoutUrl\n };\n}\n"],"mappings":";;;;;;;;AAaA;AACA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,SAASA,aAAa,GAAG;EAC9B,OAAO,IAAAC,qBAAe,EAAC,EAAE,CAAC;AAC5B;AAEO,SAASC,aAAa,GAAG;EAC9B,OAAO,IAAAD,qBAAe,EAAC,EAAE,CAAC;AAC5B;AAEA,SAASE,SAAS,CAACC,GAA2B,EAAEC,OAAmB,GAAG,CAAC,CAAC,EAAE;EACxE,MAAMC,MAAM,GAAG,IAAAC,yBAAmB,EAACF,OAAO,CAACC,MAAM,CAAC,IAAIF,GAAG,CAACC,OAAO,CAACC,MAAM;EACxE,OAAOA,MAAM;AACf;AAEO,SAASE,eAAe,CAACJ,GAA2B,EAAEC,OAAmB,GAAG,CAAC,CAAC,EAAE;EACrF,MAAMC,MAAM,GAAGH,SAAS,CAACC,GAAG,EAAEC,OAAO,CAAC;EACtC,MAAMI,OAAO,GAAGH,MAAM,CAACI,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAGJ,MAAM,GAAGA,MAAM,GAAG,SAAS;EAC3E,OAAOG,OAAO;AAChB;AAEO,SAASE,cAAc,CAACP,GAA2B,EAAEC,OAAmB,GAAG,CAAC,CAAC,EAAE;EACpF,MAAMC,MAAM,GAAGH,SAAS,CAACC,GAAG,EAAEC,OAAO,CAAC;EACtC,MAAMO,MAAM,GAAGN,MAAM,CAACO,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;EACzC,OAAOD,MAAM;AACf;AAEO,SAASE,YAAY,CAACV,GAA2B,EAAEC,OAAoB,EAAc;EAC1F,IAAIU,SAAS,CAACC,MAAM,GAAG,CAAC,EAAE;IACxB,MAAM,IAAIC,qBAAY,CAAC,sEAAsE,CAAC;EAChG;EACAZ,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;;EAEvB;EACA,IAAIa,YAAY,GAAG,IAAAX,yBAAmB,EAACF,OAAO,CAACa,YAAY,CAAC,IAAId,GAAG,CAACC,OAAO,CAACa,YAAY;EACxF,IAAIZ,MAAM,GAAGH,SAAS,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpC,IAAIc,WAAW,GAAG,IAAAZ,yBAAmB,EAACF,OAAO,CAACc,WAAW,CAAC,IAAIf,GAAG,CAACC,OAAO,CAACc,WAAW;EACrF,IAAIC,QAAQ,GAAG,IAAAb,yBAAmB,EAACF,OAAO,CAACe,QAAQ,CAAC,IAAIhB,GAAG,CAACC,OAAO,CAACe,QAAQ;EAC5E,IAAIC,SAAS,GAAG,IAAAd,yBAAmB,EAACF,OAAO,CAACgB,SAAS,CAAC,IAAIjB,GAAG,CAACC,OAAO,CAACgB,SAAS;EAC/E,IAAIC,SAAS,GAAG,IAAAf,yBAAmB,EAACF,OAAO,CAACiB,SAAS,CAAC,IAAIlB,GAAG,CAACC,OAAO,CAACiB,SAAS;EAE/E,IAAIb,OAAO,GAAGD,eAAe,CAACJ,GAAG,EAAEC,OAAO,CAAC;EAE3Ca,YAAY,GAAGA,YAAY,IAAIT,OAAO,GAAG,eAAe;EACxDU,WAAW,GAAGA,WAAW,IAAIV,OAAO,GAAG,cAAc;EACrDW,QAAQ,GAAGA,QAAQ,IAAIX,OAAO,GAAG,WAAW;EAC5Ca,SAAS,GAAGA,SAAS,IAAIb,OAAO,GAAG,YAAY;EAC/CY,SAAS,GAAGA,SAAS,IAAIZ,OAAO,GAAG,YAAY;EAE/C,OAAO;IACLH,MAAM,EAAEA,MAAM;IACdY,YAAY,EAAEA,YAAY;IAC1BC,WAAW,EAAEA,WAAW;IACxBC,QAAQ,EAAEA,QAAQ;IAClBE,SAAS,EAAEA,SAAS;IACpBD,SAAS,EAAEA;EACb,CAAC;AACH"}
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  exports.createOAuthMeta = createOAuthMeta;
4
-
5
4
  var _oauth = require("./oauth");
6
-
7
5
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
6
+
8
7
  function createOAuthMeta(sdk, tokenParams) {
9
8
  const issuer = sdk.options.issuer;
10
9
  const urls = (0, _oauth.getOAuthUrls)(sdk, tokenParams);
@@ -18,15 +17,15 @@ function createOAuthMeta(sdk, tokenParams) {
18
17
  scopes: tokenParams.scopes,
19
18
  state: tokenParams.state,
20
19
  nonce: tokenParams.nonce,
21
- ignoreSignature: tokenParams.ignoreSignature
20
+ ignoreSignature: tokenParams.ignoreSignature,
21
+ acrValues: tokenParams.acrValues
22
22
  };
23
-
24
23
  if (tokenParams.pkce === false) {
25
24
  // Implicit flow or authorization_code without PKCE
26
25
  return oauthMeta;
27
26
  }
28
-
29
- const pkceMeta = { ...oauthMeta,
27
+ const pkceMeta = {
28
+ ...oauthMeta,
30
29
  codeVerifier: tokenParams.codeVerifier,
31
30
  codeChallengeMethod: tokenParams.codeChallengeMethod,
32
31
  codeChallenge: tokenParams.codeChallenge
@@ -1 +1 @@
1
- {"version":3,"file":"oauthMeta.js","names":["createOAuthMeta","sdk","tokenParams","issuer","options","urls","getOAuthUrls","oauthMeta","clientId","redirectUri","responseType","responseMode","scopes","state","nonce","ignoreSignature","pkce","pkceMeta","codeVerifier","codeChallengeMethod","codeChallenge"],"sources":["../../../../lib/oidc/util/oauthMeta.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { OAuthTransactionMeta, OktaAuthOAuthInterface, PKCETransactionMeta, TokenParams } from '../types';\nimport { getOAuthUrls } from './oauth';\n\nexport function createOAuthMeta(\n sdk: OktaAuthOAuthInterface, \n tokenParams: TokenParams\n): OAuthTransactionMeta | PKCETransactionMeta {\n const issuer = sdk.options.issuer!;\n const urls = getOAuthUrls(sdk, tokenParams);\n const oauthMeta: OAuthTransactionMeta = {\n issuer,\n urls,\n clientId: tokenParams.clientId!,\n redirectUri: tokenParams.redirectUri!,\n responseType: tokenParams.responseType!,\n responseMode: tokenParams.responseMode!,\n scopes: tokenParams.scopes!,\n state: tokenParams.state!,\n nonce: tokenParams.nonce!,\n ignoreSignature: tokenParams.ignoreSignature!,\n };\n\n if (tokenParams.pkce === false) {\n // Implicit flow or authorization_code without PKCE\n return oauthMeta;\n }\n\n const pkceMeta: PKCETransactionMeta = {\n ...oauthMeta,\n codeVerifier: tokenParams.codeVerifier!,\n codeChallengeMethod: tokenParams.codeChallengeMethod!,\n codeChallenge: tokenParams.codeChallenge!,\n };\n\n return pkceMeta;\n}\n"],"mappings":";;;;AAEA;;AAFA;AAIO,SAASA,eAAT,CACLC,GADK,EAELC,WAFK,EAGuC;EAC5C,MAAMC,MAAM,GAAGF,GAAG,CAACG,OAAJ,CAAYD,MAA3B;EACA,MAAME,IAAI,GAAG,IAAAC,mBAAA,EAAaL,GAAb,EAAkBC,WAAlB,CAAb;EACA,MAAMK,SAA+B,GAAG;IACtCJ,MADsC;IAEtCE,IAFsC;IAGtCG,QAAQ,EAAEN,WAAW,CAACM,QAHgB;IAItCC,WAAW,EAAEP,WAAW,CAACO,WAJa;IAKtCC,YAAY,EAAER,WAAW,CAACQ,YALY;IAMtCC,YAAY,EAAET,WAAW,CAACS,YANY;IAOtCC,MAAM,EAAEV,WAAW,CAACU,MAPkB;IAQtCC,KAAK,EAAEX,WAAW,CAACW,KARmB;IAStCC,KAAK,EAAEZ,WAAW,CAACY,KATmB;IAUtCC,eAAe,EAAEb,WAAW,CAACa;EAVS,CAAxC;;EAaA,IAAIb,WAAW,CAACc,IAAZ,KAAqB,KAAzB,EAAgC;IAC9B;IACA,OAAOT,SAAP;EACD;;EAED,MAAMU,QAA6B,GAAG,EACpC,GAAGV,SADiC;IAEpCW,YAAY,EAAEhB,WAAW,CAACgB,YAFU;IAGpCC,mBAAmB,EAAEjB,WAAW,CAACiB,mBAHG;IAIpCC,aAAa,EAAElB,WAAW,CAACkB;EAJS,CAAtC;EAOA,OAAOH,QAAP;AACD"}
1
+ {"version":3,"file":"oauthMeta.js","names":["createOAuthMeta","sdk","tokenParams","issuer","options","urls","getOAuthUrls","oauthMeta","clientId","redirectUri","responseType","responseMode","scopes","state","nonce","ignoreSignature","acrValues","pkce","pkceMeta","codeVerifier","codeChallengeMethod","codeChallenge"],"sources":["../../../../lib/oidc/util/oauthMeta.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { OAuthTransactionMeta, OktaAuthOAuthInterface, PKCETransactionMeta, TokenParams } from '../types';\nimport { getOAuthUrls } from './oauth';\n\nexport function createOAuthMeta(\n sdk: OktaAuthOAuthInterface, \n tokenParams: TokenParams\n): OAuthTransactionMeta | PKCETransactionMeta {\n const issuer = sdk.options.issuer!;\n const urls = getOAuthUrls(sdk, tokenParams);\n const oauthMeta: OAuthTransactionMeta = {\n issuer,\n urls,\n clientId: tokenParams.clientId!,\n redirectUri: tokenParams.redirectUri!,\n responseType: tokenParams.responseType!,\n responseMode: tokenParams.responseMode!,\n scopes: tokenParams.scopes!,\n state: tokenParams.state!,\n nonce: tokenParams.nonce!,\n ignoreSignature: tokenParams.ignoreSignature!,\n acrValues: tokenParams.acrValues,\n };\n\n if (tokenParams.pkce === false) {\n // Implicit flow or authorization_code without PKCE\n return oauthMeta;\n }\n\n const pkceMeta: PKCETransactionMeta = {\n ...oauthMeta,\n codeVerifier: tokenParams.codeVerifier!,\n codeChallengeMethod: tokenParams.codeChallengeMethod!,\n codeChallenge: tokenParams.codeChallenge!,\n };\n\n return pkceMeta;\n}\n"],"mappings":";;;AAEA;AAFA;;AAIO,SAASA,eAAe,CAC7BC,GAA2B,EAC3BC,WAAwB,EACoB;EAC5C,MAAMC,MAAM,GAAGF,GAAG,CAACG,OAAO,CAACD,MAAO;EAClC,MAAME,IAAI,GAAG,IAAAC,mBAAY,EAACL,GAAG,EAAEC,WAAW,CAAC;EAC3C,MAAMK,SAA+B,GAAG;IACtCJ,MAAM;IACNE,IAAI;IACJG,QAAQ,EAAEN,WAAW,CAACM,QAAS;IAC/BC,WAAW,EAAEP,WAAW,CAACO,WAAY;IACrCC,YAAY,EAAER,WAAW,CAACQ,YAAa;IACvCC,YAAY,EAAET,WAAW,CAACS,YAAa;IACvCC,MAAM,EAAEV,WAAW,CAACU,MAAO;IAC3BC,KAAK,EAAEX,WAAW,CAACW,KAAM;IACzBC,KAAK,EAAEZ,WAAW,CAACY,KAAM;IACzBC,eAAe,EAAEb,WAAW,CAACa,eAAgB;IAC7CC,SAAS,EAAEd,WAAW,CAACc;EACzB,CAAC;EAED,IAAId,WAAW,CAACe,IAAI,KAAK,KAAK,EAAE;IAC9B;IACA,OAAOV,SAAS;EAClB;EAEA,MAAMW,QAA6B,GAAG;IACpC,GAAGX,SAAS;IACZY,YAAY,EAAEjB,WAAW,CAACiB,YAAa;IACvCC,mBAAmB,EAAElB,WAAW,CAACkB,mBAAoB;IACrDC,aAAa,EAAEnB,WAAW,CAACmB;EAC7B,CAAC;EAED,OAAOH,QAAQ;AACjB"}
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  exports.default = void 0;
4
-
5
4
  var _crypto = require("../../crypto");
6
-
7
5
  var _constants = require("../../constants");
8
-
9
6
  /*!
10
7
  * Copyright (c) 2019-present, Okta, Inc. and/or its affiliates. All rights reserved.
11
8
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -20,39 +17,31 @@ var _constants = require("../../constants");
20
17
  */
21
18
 
22
19
  /* eslint-disable complexity, max-statements */
20
+
23
21
  function dec2hex(dec) {
24
22
  return ('0' + dec.toString(16)).substr(-2);
25
23
  }
26
-
27
24
  function getRandomString(length) {
28
25
  var a = new Uint8Array(Math.ceil(length / 2));
29
-
30
26
  _crypto.webcrypto.getRandomValues(a);
31
-
32
27
  var str = Array.from(a, dec2hex).join('');
33
28
  return str.slice(0, length);
34
29
  }
35
-
36
30
  function generateVerifier(prefix) {
37
31
  var verifier = prefix || '';
38
-
39
32
  if (verifier.length < _constants.MIN_VERIFIER_LENGTH) {
40
33
  verifier = verifier + getRandomString(_constants.MIN_VERIFIER_LENGTH - verifier.length);
41
34
  }
42
-
43
35
  return encodeURIComponent(verifier).slice(0, _constants.MAX_VERIFIER_LENGTH);
44
36
  }
45
-
46
37
  function computeChallenge(str) {
47
38
  var buffer = new TextEncoder().encode(str);
48
39
  return _crypto.webcrypto.subtle.digest('SHA-256', buffer).then(function (arrayBuffer) {
49
40
  var hash = String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));
50
41
  var b64u = (0, _crypto.stringToBase64Url)(hash); // url-safe base64 variant
51
-
52
42
  return b64u;
53
43
  });
54
44
  }
55
-
56
45
  var _default = {
57
46
  DEFAULT_CODE_CHALLENGE_METHOD: _constants.DEFAULT_CODE_CHALLENGE_METHOD,
58
47
  generateVerifier,
@@ -1 +1 @@
1
- {"version":3,"file":"pkce.js","names":["dec2hex","dec","toString","substr","getRandomString","length","a","Uint8Array","Math","ceil","webcrypto","getRandomValues","str","Array","from","join","slice","generateVerifier","prefix","verifier","MIN_VERIFIER_LENGTH","encodeURIComponent","MAX_VERIFIER_LENGTH","computeChallenge","buffer","TextEncoder","encode","subtle","digest","then","arrayBuffer","hash","String","fromCharCode","apply","b64u","stringToBase64Url","DEFAULT_CODE_CHALLENGE_METHOD"],"sources":["../../../../lib/oidc/util/pkce.ts"],"sourcesContent":["/*!\n * Copyright (c) 2019-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, max-statements */\nimport { stringToBase64Url, webcrypto } from '../../crypto';\nimport { MIN_VERIFIER_LENGTH, MAX_VERIFIER_LENGTH, DEFAULT_CODE_CHALLENGE_METHOD } from '../../constants';\n\nfunction dec2hex (dec) {\n return ('0' + dec.toString(16)).substr(-2);\n}\n\nfunction getRandomString(length) {\n var a = new Uint8Array(Math.ceil(length / 2));\n webcrypto.getRandomValues(a);\n var str = Array.from(a, dec2hex).join('');\n return str.slice(0, length);\n}\n\nfunction generateVerifier(prefix?: string): string {\n var verifier = prefix || '';\n if (verifier.length < MIN_VERIFIER_LENGTH) {\n verifier = verifier + getRandomString(MIN_VERIFIER_LENGTH - verifier.length);\n }\n return encodeURIComponent(verifier).slice(0, MAX_VERIFIER_LENGTH);\n}\n\nfunction computeChallenge(str: string): PromiseLike<any> { \n var buffer = new TextEncoder().encode(str);\n return webcrypto.subtle.digest('SHA-256', buffer).then(function(arrayBuffer) {\n var hash = String.fromCharCode.apply(null, new Uint8Array(arrayBuffer) as unknown as number[]);\n var b64u = stringToBase64Url(hash); // url-safe base64 variant\n return b64u;\n });\n}\n\nexport default {\n DEFAULT_CODE_CHALLENGE_METHOD,\n generateVerifier,\n computeChallenge\n};\n"],"mappings":";;;;AAcA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEC;AAID,SAASA,OAAT,CAAkBC,GAAlB,EAAuB;EACrB,OAAO,CAAC,MAAMA,GAAG,CAACC,QAAJ,CAAa,EAAb,CAAP,EAAyBC,MAAzB,CAAgC,CAAC,CAAjC,CAAP;AACD;;AAED,SAASC,eAAT,CAAyBC,MAAzB,EAAiC;EAC/B,IAAIC,CAAC,GAAG,IAAIC,UAAJ,CAAeC,IAAI,CAACC,IAAL,CAAUJ,MAAM,GAAG,CAAnB,CAAf,CAAR;;EACAK,iBAAA,CAAUC,eAAV,CAA0BL,CAA1B;;EACA,IAAIM,GAAG,GAAGC,KAAK,CAACC,IAAN,CAAWR,CAAX,EAAcN,OAAd,EAAuBe,IAAvB,CAA4B,EAA5B,CAAV;EACA,OAAOH,GAAG,CAACI,KAAJ,CAAU,CAAV,EAAaX,MAAb,CAAP;AACD;;AAED,SAASY,gBAAT,CAA0BC,MAA1B,EAAmD;EACjD,IAAIC,QAAQ,GAAGD,MAAM,IAAI,EAAzB;;EACA,IAAIC,QAAQ,CAACd,MAAT,GAAkBe,8BAAtB,EAA2C;IACzCD,QAAQ,GAAGA,QAAQ,GAAGf,eAAe,CAACgB,8BAAA,GAAsBD,QAAQ,CAACd,MAAhC,CAArC;EACD;;EACD,OAAOgB,kBAAkB,CAACF,QAAD,CAAlB,CAA6BH,KAA7B,CAAmC,CAAnC,EAAsCM,8BAAtC,CAAP;AACD;;AAED,SAASC,gBAAT,CAA0BX,GAA1B,EAAyD;EACvD,IAAIY,MAAM,GAAG,IAAIC,WAAJ,GAAkBC,MAAlB,CAAyBd,GAAzB,CAAb;EACA,OAAOF,iBAAA,CAAUiB,MAAV,CAAiBC,MAAjB,CAAwB,SAAxB,EAAmCJ,MAAnC,EAA2CK,IAA3C,CAAgD,UAASC,WAAT,EAAsB;IAC3E,IAAIC,IAAI,GAAGC,MAAM,CAACC,YAAP,CAAoBC,KAApB,CAA0B,IAA1B,EAAgC,IAAI3B,UAAJ,CAAeuB,WAAf,CAAhC,CAAX;IACA,IAAIK,IAAI,GAAG,IAAAC,yBAAA,EAAkBL,IAAlB,CAAX,CAF2E,CAEvC;;IACpC,OAAOI,IAAP;EACD,CAJM,CAAP;AAKD;;eAEc;EACbE,6BAA6B,EAA7BA,wCADa;EAEbpB,gBAFa;EAGbM;AAHa,C"}
1
+ {"version":3,"file":"pkce.js","names":["dec2hex","dec","toString","substr","getRandomString","length","a","Uint8Array","Math","ceil","webcrypto","getRandomValues","str","Array","from","join","slice","generateVerifier","prefix","verifier","MIN_VERIFIER_LENGTH","encodeURIComponent","MAX_VERIFIER_LENGTH","computeChallenge","buffer","TextEncoder","encode","subtle","digest","then","arrayBuffer","hash","String","fromCharCode","apply","b64u","stringToBase64Url","DEFAULT_CODE_CHALLENGE_METHOD"],"sources":["../../../../lib/oidc/util/pkce.ts"],"sourcesContent":["/*!\n * Copyright (c) 2019-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, max-statements */\nimport { stringToBase64Url, webcrypto } from '../../crypto';\nimport { MIN_VERIFIER_LENGTH, MAX_VERIFIER_LENGTH, DEFAULT_CODE_CHALLENGE_METHOD } from '../../constants';\n\nfunction dec2hex (dec) {\n return ('0' + dec.toString(16)).substr(-2);\n}\n\nfunction getRandomString(length) {\n var a = new Uint8Array(Math.ceil(length / 2));\n webcrypto.getRandomValues(a);\n var str = Array.from(a, dec2hex).join('');\n return str.slice(0, length);\n}\n\nfunction generateVerifier(prefix?: string): string {\n var verifier = prefix || '';\n if (verifier.length < MIN_VERIFIER_LENGTH) {\n verifier = verifier + getRandomString(MIN_VERIFIER_LENGTH - verifier.length);\n }\n return encodeURIComponent(verifier).slice(0, MAX_VERIFIER_LENGTH);\n}\n\nfunction computeChallenge(str: string): PromiseLike<any> { \n var buffer = new TextEncoder().encode(str);\n return webcrypto.subtle.digest('SHA-256', buffer).then(function(arrayBuffer) {\n var hash = String.fromCharCode.apply(null, new Uint8Array(arrayBuffer) as unknown as number[]);\n var b64u = stringToBase64Url(hash); // url-safe base64 variant\n return b64u;\n });\n}\n\nexport default {\n DEFAULT_CODE_CHALLENGE_METHOD,\n generateVerifier,\n computeChallenge\n};\n"],"mappings":";;;AAcA;AACA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEC;;AAID,SAASA,OAAO,CAAEC,GAAG,EAAE;EACrB,OAAO,CAAC,GAAG,GAAGA,GAAG,CAACC,QAAQ,CAAC,EAAE,CAAC,EAAEC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC5C;AAEA,SAASC,eAAe,CAACC,MAAM,EAAE;EAC/B,IAAIC,CAAC,GAAG,IAAIC,UAAU,CAACC,IAAI,CAACC,IAAI,CAACJ,MAAM,GAAG,CAAC,CAAC,CAAC;EAC7CK,iBAAS,CAACC,eAAe,CAACL,CAAC,CAAC;EAC5B,IAAIM,GAAG,GAAGC,KAAK,CAACC,IAAI,CAACR,CAAC,EAAEN,OAAO,CAAC,CAACe,IAAI,CAAC,EAAE,CAAC;EACzC,OAAOH,GAAG,CAACI,KAAK,CAAC,CAAC,EAAEX,MAAM,CAAC;AAC7B;AAEA,SAASY,gBAAgB,CAACC,MAAe,EAAU;EACjD,IAAIC,QAAQ,GAAGD,MAAM,IAAI,EAAE;EAC3B,IAAIC,QAAQ,CAACd,MAAM,GAAGe,8BAAmB,EAAE;IACzCD,QAAQ,GAAGA,QAAQ,GAAGf,eAAe,CAACgB,8BAAmB,GAAGD,QAAQ,CAACd,MAAM,CAAC;EAC9E;EACA,OAAOgB,kBAAkB,CAACF,QAAQ,CAAC,CAACH,KAAK,CAAC,CAAC,EAAEM,8BAAmB,CAAC;AACnE;AAEA,SAASC,gBAAgB,CAACX,GAAW,EAAoB;EACvD,IAAIY,MAAM,GAAG,IAAIC,WAAW,EAAE,CAACC,MAAM,CAACd,GAAG,CAAC;EAC1C,OAAOF,iBAAS,CAACiB,MAAM,CAACC,MAAM,CAAC,SAAS,EAAEJ,MAAM,CAAC,CAACK,IAAI,CAAC,UAASC,WAAW,EAAE;IAC3E,IAAIC,IAAI,GAAGC,MAAM,CAACC,YAAY,CAACC,KAAK,CAAC,IAAI,EAAE,IAAI3B,UAAU,CAACuB,WAAW,CAAC,CAAwB;IAC9F,IAAIK,IAAI,GAAG,IAAAC,yBAAiB,EAACL,IAAI,CAAC,CAAC,CAAC;IACpC,OAAOI,IAAI;EACb,CAAC,CAAC;AACJ;AAAC,eAEc;EACbE,6BAA6B,EAA7BA,wCAA6B;EAC7BpB,gBAAgB;EAChBM;AACF,CAAC;AAAA;AAAA"}