@okta/okta-auth-js 7.1.1 → 7.3.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 (264) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +101 -39
  3. package/cjs/core/mixin.js +3 -0
  4. package/cjs/core/mixin.js.map +1 -1
  5. package/cjs/core/types/api.js.map +1 -1
  6. package/cjs/http/OktaUserAgent.js +2 -2
  7. package/cjs/idx/IdxTransactionManager.js +0 -4
  8. package/cjs/idx/IdxTransactionManager.js.map +1 -1
  9. package/cjs/idx/factory/OktaAuthIdx.js.map +1 -1
  10. package/cjs/idx/idxState/v1/idxResponseParser.js +2 -3
  11. package/cjs/idx/idxState/v1/idxResponseParser.js.map +1 -1
  12. package/cjs/idx/mixin.js.map +1 -1
  13. package/cjs/idx/types/api.js.map +1 -1
  14. package/cjs/idx/webauthn.js.map +1 -1
  15. package/cjs/myaccount/api.js +11 -0
  16. package/cjs/myaccount/api.js.map +1 -1
  17. package/cjs/myaccount/emailApi.js +7 -7
  18. package/cjs/myaccount/emailApi.js.map +1 -1
  19. package/cjs/myaccount/passwordApi.js +69 -0
  20. package/cjs/myaccount/passwordApi.js.map +1 -0
  21. package/cjs/myaccount/phoneApi.js +6 -6
  22. package/cjs/myaccount/phoneApi.js.map +1 -1
  23. package/cjs/myaccount/profileApi.js +3 -3
  24. package/cjs/myaccount/profileApi.js.map +1 -1
  25. package/cjs/myaccount/request.js +3 -4
  26. package/cjs/myaccount/request.js.map +1 -1
  27. package/cjs/myaccount/transactions/PasswordTransaction.js +81 -0
  28. package/cjs/myaccount/transactions/PasswordTransaction.js.map +1 -0
  29. package/cjs/myaccount/transactions/index.js +7 -0
  30. package/cjs/myaccount/transactions/index.js.map +1 -1
  31. package/cjs/myaccount/types.js +13 -0
  32. package/cjs/myaccount/types.js.map +1 -1
  33. package/cjs/oidc/TokenManager.js +5 -0
  34. package/cjs/oidc/TokenManager.js.map +1 -1
  35. package/cjs/oidc/endpoints/authorize.js +4 -3
  36. package/cjs/oidc/endpoints/authorize.js.map +1 -1
  37. package/cjs/oidc/enrollAuthenticator.js +33 -0
  38. package/cjs/oidc/enrollAuthenticator.js.map +1 -0
  39. package/cjs/oidc/factory/api.js +11 -11
  40. package/cjs/oidc/factory/api.js.map +1 -1
  41. package/cjs/oidc/getWithRedirect.js +5 -1
  42. package/cjs/oidc/getWithRedirect.js.map +1 -1
  43. package/cjs/oidc/handleOAuthResponse.js +3 -2
  44. package/cjs/oidc/handleOAuthResponse.js.map +1 -1
  45. package/cjs/oidc/mixin/index.js +10 -4
  46. package/cjs/oidc/mixin/index.js.map +1 -1
  47. package/cjs/oidc/types/TokenManager.js.map +1 -1
  48. package/cjs/oidc/types/api.js.map +1 -1
  49. package/cjs/oidc/types/endpoints.js +2 -0
  50. package/cjs/oidc/types/endpoints.js.map +1 -0
  51. package/cjs/oidc/types/index.js +11 -0
  52. package/cjs/oidc/types/index.js.map +1 -1
  53. package/cjs/oidc/types/meta.js.map +1 -1
  54. package/cjs/oidc/types/options.js.map +1 -1
  55. package/cjs/oidc/types/proto.js.map +1 -1
  56. package/cjs/oidc/util/defaultEnrollAuthenticatorParams.js +38 -0
  57. package/cjs/oidc/util/defaultEnrollAuthenticatorParams.js.map +1 -0
  58. package/cjs/oidc/util/enrollAuthenticatorMeta.js +23 -0
  59. package/cjs/oidc/util/enrollAuthenticatorMeta.js.map +1 -0
  60. package/cjs/oidc/util/index.js +36 -0
  61. package/cjs/oidc/util/index.js.map +1 -1
  62. package/cjs/oidc/util/prepareEnrollAuthenticatorParams.js +50 -0
  63. package/cjs/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -0
  64. package/cjs/services/AutoRenewService.js +16 -2
  65. package/cjs/services/AutoRenewService.js.map +1 -1
  66. package/cjs/services/LeaderElectionService.js +1 -2
  67. package/cjs/services/LeaderElectionService.js.map +1 -1
  68. package/cjs/services/SyncStorageService.js +1 -2
  69. package/cjs/services/SyncStorageService.js.map +1 -1
  70. package/cjs/session/mixin.js +2 -1
  71. package/cjs/session/mixin.js.map +1 -1
  72. package/cjs/session/types.js.map +1 -1
  73. package/cjs/storage/BaseStorageManager.js +1 -1
  74. package/cjs/storage/BaseStorageManager.js.map +1 -1
  75. package/cjs/util/jsonpath.js +13 -0
  76. package/cjs/util/jsonpath.js.map +1 -0
  77. package/dist/okta-auth-js.authn.min.analyzer.html +2 -2
  78. package/dist/okta-auth-js.authn.min.js +1 -1
  79. package/dist/okta-auth-js.authn.min.js.map +1 -1
  80. package/dist/okta-auth-js.core.min.analyzer.html +2 -2
  81. package/dist/okta-auth-js.core.min.js +1 -1
  82. package/dist/okta-auth-js.core.min.js.map +1 -1
  83. package/dist/okta-auth-js.idx.min.analyzer.html +2 -2
  84. package/dist/okta-auth-js.idx.min.js +1 -1
  85. package/dist/okta-auth-js.idx.min.js.map +1 -1
  86. package/dist/okta-auth-js.min.analyzer.html +2 -2
  87. package/dist/okta-auth-js.min.js +1 -1
  88. package/dist/okta-auth-js.min.js.map +1 -1
  89. package/dist/okta-auth-js.myaccount.min.analyzer.html +2 -2
  90. package/dist/okta-auth-js.myaccount.min.js +1 -1
  91. package/dist/okta-auth-js.myaccount.min.js.map +1 -1
  92. package/esm/browser/core/mixin.js +3 -0
  93. package/esm/browser/core/mixin.js.map +1 -1
  94. package/esm/browser/exports/exports/authn.js +4 -1
  95. package/esm/browser/exports/exports/authn.js.map +1 -1
  96. package/esm/browser/exports/exports/core.js +4 -1
  97. package/esm/browser/exports/exports/core.js.map +1 -1
  98. package/esm/browser/exports/exports/default.js +7 -2
  99. package/esm/browser/exports/exports/default.js.map +1 -1
  100. package/esm/browser/exports/exports/idx.js +4 -1
  101. package/esm/browser/exports/exports/idx.js.map +1 -1
  102. package/esm/browser/exports/exports/myaccount.js +7 -2
  103. package/esm/browser/exports/exports/myaccount.js.map +1 -1
  104. package/esm/browser/http/OktaUserAgent.js +2 -2
  105. package/esm/browser/idx/IdxTransactionManager.js +1 -4
  106. package/esm/browser/idx/IdxTransactionManager.js.map +1 -1
  107. package/esm/browser/idx/factory/OktaAuthIdx.js.map +1 -1
  108. package/esm/browser/idx/idxState/v1/idxResponseParser.js +2 -2
  109. package/esm/browser/idx/idxState/v1/idxResponseParser.js.map +1 -1
  110. package/esm/browser/idx/mixin.js.map +1 -1
  111. package/esm/browser/idx/types/api.js.map +1 -1
  112. package/esm/browser/idx/webauthn.js.map +1 -1
  113. package/esm/browser/myaccount/api.js +1 -0
  114. package/esm/browser/myaccount/api.js.map +1 -1
  115. package/esm/browser/myaccount/emailApi.js.map +1 -1
  116. package/esm/browser/myaccount/passwordApi.js +56 -0
  117. package/esm/browser/myaccount/passwordApi.js.map +1 -0
  118. package/esm/browser/myaccount/phoneApi.js.map +1 -1
  119. package/esm/browser/myaccount/profileApi.js.map +1 -1
  120. package/esm/browser/myaccount/request.js +4 -2
  121. package/esm/browser/myaccount/request.js.map +1 -1
  122. package/esm/browser/myaccount/transactions/PasswordTransaction.js +73 -0
  123. package/esm/browser/myaccount/transactions/PasswordTransaction.js.map +1 -0
  124. package/esm/browser/myaccount/types.js +6 -1
  125. package/esm/browser/myaccount/types.js.map +1 -1
  126. package/esm/browser/oidc/TokenManager.js +5 -0
  127. package/esm/browser/oidc/TokenManager.js.map +1 -1
  128. package/esm/browser/oidc/endpoints/authorize.js +3 -2
  129. package/esm/browser/oidc/endpoints/authorize.js.map +1 -1
  130. package/esm/browser/oidc/enrollAuthenticator.js +36 -0
  131. package/esm/browser/oidc/enrollAuthenticator.js.map +1 -0
  132. package/esm/browser/oidc/factory/api.js +10 -12
  133. package/esm/browser/oidc/factory/api.js.map +1 -1
  134. package/esm/browser/oidc/getWithRedirect.js +6 -1
  135. package/esm/browser/oidc/getWithRedirect.js.map +1 -1
  136. package/esm/browser/oidc/handleOAuthResponse.js +3 -2
  137. package/esm/browser/oidc/handleOAuthResponse.js.map +1 -1
  138. package/esm/browser/oidc/mixin/index.js +9 -4
  139. package/esm/browser/oidc/mixin/index.js.map +1 -1
  140. package/esm/browser/oidc/types/TokenManager.js.map +1 -1
  141. package/esm/browser/oidc/util/defaultEnrollAuthenticatorParams.js +31 -0
  142. package/esm/browser/oidc/util/defaultEnrollAuthenticatorParams.js.map +1 -0
  143. package/esm/browser/oidc/util/enrollAuthenticatorMeta.js +33 -0
  144. package/esm/browser/oidc/util/enrollAuthenticatorMeta.js.map +1 -0
  145. package/esm/browser/oidc/util/prepareEnrollAuthenticatorParams.js +34 -0
  146. package/esm/browser/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -0
  147. package/esm/browser/package.json +1 -1
  148. package/esm/browser/services/AutoRenewService.js +15 -2
  149. package/esm/browser/services/AutoRenewService.js.map +1 -1
  150. package/esm/browser/services/LeaderElectionService.js +1 -2
  151. package/esm/browser/services/LeaderElectionService.js.map +1 -1
  152. package/esm/browser/services/SyncStorageService.js +1 -2
  153. package/esm/browser/services/SyncStorageService.js.map +1 -1
  154. package/esm/browser/session/mixin.js +2 -1
  155. package/esm/browser/session/mixin.js.map +1 -1
  156. package/esm/browser/storage/BaseStorageManager.js +1 -1
  157. package/esm/browser/storage/BaseStorageManager.js.map +1 -1
  158. package/esm/browser/util/jsonpath.js +21 -0
  159. package/esm/browser/util/jsonpath.js.map +1 -0
  160. package/esm/node/core/mixin.js +3 -0
  161. package/esm/node/core/mixin.js.map +1 -1
  162. package/esm/node/exports/exports/authn.js +4 -1
  163. package/esm/node/exports/exports/authn.js.map +1 -1
  164. package/esm/node/exports/exports/core.js +4 -1
  165. package/esm/node/exports/exports/core.js.map +1 -1
  166. package/esm/node/exports/exports/default.js +7 -2
  167. package/esm/node/exports/exports/default.js.map +1 -1
  168. package/esm/node/exports/exports/idx.js +4 -1
  169. package/esm/node/exports/exports/idx.js.map +1 -1
  170. package/esm/node/exports/exports/myaccount.js +7 -2
  171. package/esm/node/exports/exports/myaccount.js.map +1 -1
  172. package/esm/node/http/OktaUserAgent.js +2 -2
  173. package/esm/node/idx/IdxTransactionManager.js +1 -4
  174. package/esm/node/idx/IdxTransactionManager.js.map +1 -1
  175. package/esm/node/idx/factory/OktaAuthIdx.js.map +1 -1
  176. package/esm/node/idx/idxState/v1/idxResponseParser.js +2 -2
  177. package/esm/node/idx/idxState/v1/idxResponseParser.js.map +1 -1
  178. package/esm/node/idx/mixin.js.map +1 -1
  179. package/esm/node/idx/types/api.js.map +1 -1
  180. package/esm/node/idx/webauthn.js.map +1 -1
  181. package/esm/node/myaccount/api.js +1 -0
  182. package/esm/node/myaccount/api.js.map +1 -1
  183. package/esm/node/myaccount/emailApi.js.map +1 -1
  184. package/esm/node/myaccount/passwordApi.js +56 -0
  185. package/esm/node/myaccount/passwordApi.js.map +1 -0
  186. package/esm/node/myaccount/phoneApi.js.map +1 -1
  187. package/esm/node/myaccount/profileApi.js.map +1 -1
  188. package/esm/node/myaccount/request.js +4 -2
  189. package/esm/node/myaccount/request.js.map +1 -1
  190. package/esm/node/myaccount/transactions/PasswordTransaction.js +73 -0
  191. package/esm/node/myaccount/transactions/PasswordTransaction.js.map +1 -0
  192. package/esm/node/myaccount/types.js +6 -1
  193. package/esm/node/myaccount/types.js.map +1 -1
  194. package/esm/node/oidc/TokenManager.js +5 -0
  195. package/esm/node/oidc/TokenManager.js.map +1 -1
  196. package/esm/node/oidc/endpoints/authorize.js +3 -2
  197. package/esm/node/oidc/endpoints/authorize.js.map +1 -1
  198. package/esm/node/oidc/enrollAuthenticator.js +37 -0
  199. package/esm/node/oidc/enrollAuthenticator.js.map +1 -0
  200. package/esm/node/oidc/factory/api.js +10 -12
  201. package/esm/node/oidc/factory/api.js.map +1 -1
  202. package/esm/node/oidc/getWithRedirect.js +6 -1
  203. package/esm/node/oidc/getWithRedirect.js.map +1 -1
  204. package/esm/node/oidc/handleOAuthResponse.js +3 -2
  205. package/esm/node/oidc/handleOAuthResponse.js.map +1 -1
  206. package/esm/node/oidc/mixin/index.js +9 -4
  207. package/esm/node/oidc/mixin/index.js.map +1 -1
  208. package/esm/node/oidc/types/TokenManager.js.map +1 -1
  209. package/esm/node/oidc/util/defaultEnrollAuthenticatorParams.js +31 -0
  210. package/esm/node/oidc/util/defaultEnrollAuthenticatorParams.js.map +1 -0
  211. package/esm/node/oidc/util/enrollAuthenticatorMeta.js +33 -0
  212. package/esm/node/oidc/util/enrollAuthenticatorMeta.js.map +1 -0
  213. package/esm/node/oidc/util/prepareEnrollAuthenticatorParams.js +34 -0
  214. package/esm/node/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -0
  215. package/esm/node/package.json +1 -1
  216. package/esm/node/session/mixin.js +2 -1
  217. package/esm/node/session/mixin.js.map +1 -1
  218. package/esm/node/storage/BaseStorageManager.js +1 -1
  219. package/esm/node/storage/BaseStorageManager.js.map +1 -1
  220. package/esm/node/util/jsonpath.js +21 -0
  221. package/esm/node/util/jsonpath.js.map +1 -0
  222. package/package.json +9 -7
  223. package/types/lib/core/types/api.d.ts +1 -0
  224. package/types/lib/exports/default.d.ts +1 -1
  225. package/types/lib/exports/idx.d.ts +1 -1
  226. package/types/lib/idx/factory/OktaAuthIdx.d.ts +3 -3
  227. package/types/lib/idx/mixin.d.ts +2 -2
  228. package/types/lib/idx/types/api.d.ts +13 -1
  229. package/types/lib/idx/webauthn.d.ts +1 -7
  230. package/types/lib/myaccount/api.d.ts +1 -0
  231. package/types/lib/myaccount/emailApi.d.ts +7 -7
  232. package/types/lib/myaccount/passwordApi.d.ts +17 -0
  233. package/types/lib/myaccount/phoneApi.d.ts +6 -6
  234. package/types/lib/myaccount/profileApi.d.ts +3 -3
  235. package/types/lib/myaccount/transactions/PasswordTransaction.d.ts +13 -0
  236. package/types/lib/myaccount/transactions/index.d.ts +1 -0
  237. package/types/lib/myaccount/types.d.ts +17 -2
  238. package/types/lib/oidc/TokenManager.d.ts +1 -0
  239. package/types/lib/oidc/enrollAuthenticator.d.ts +14 -0
  240. package/types/lib/oidc/factory/api.d.ts +2 -1
  241. package/types/lib/oidc/types/TokenManager.d.ts +1 -0
  242. package/types/lib/oidc/types/api.d.ts +6 -5
  243. package/types/lib/oidc/types/endpoints.d.ts +18 -0
  244. package/types/lib/oidc/types/index.d.ts +1 -0
  245. package/types/lib/oidc/types/meta.d.ts +1 -1
  246. package/types/lib/oidc/types/options.d.ts +6 -1
  247. package/types/lib/oidc/types/proto.d.ts +1 -0
  248. package/types/lib/oidc/util/defaultEnrollAuthenticatorParams.d.ts +2 -0
  249. package/types/lib/oidc/util/enrollAuthenticatorMeta.d.ts +2 -0
  250. package/types/lib/oidc/util/index.d.ts +3 -0
  251. package/types/lib/oidc/util/prepareEnrollAuthenticatorParams.d.ts +2 -0
  252. package/types/lib/services/AutoRenewService.d.ts +1 -0
  253. package/types/lib/session/types.d.ts +1 -1
  254. package/types/lib/util/jsonpath.d.ts +2 -0
  255. package/umd/authn.js +1 -1
  256. package/umd/authn.js.map +1 -1
  257. package/umd/core.js +1 -1
  258. package/umd/core.js.map +1 -1
  259. package/umd/default.js +1 -1
  260. package/umd/default.js.map +1 -1
  261. package/umd/idx.js +1 -1
  262. package/umd/idx.js.map +1 -1
  263. package/umd/myaccount.js +1 -1
  264. package/umd/myaccount.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,11 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.3.0
4
+
5
+ ### Features
6
+
7
+ - [#1404](https://github.com/okta/okta-auth-js/pull/1404) Adds `react-native` to `package.json`
8
+ - [#1395](https://github.com/okta/okta-auth-js/pull/1395) Changes resolve value of `closeSession()` and `signOut()` to boolean
9
+
10
+ ### Fixes
11
+
12
+ - [#1398](https://github.com/okta/okta-auth-js/pull/1398) Fixes race condition in `LeaderElectionService` start
13
+
14
+ ## 7.2.0
15
+
16
+ ### Features
17
+
18
+ - [#1333](https://github.com/okta/okta-auth-js/pull/1333) Adds support for MyAccount API password methods
19
+ - [#1324](https://github.com/okta/okta-auth-js/pull/1324) Adds `endpoints.authorize.enrollAuthenticator`. Adds `handleRedirect` and deprecates `handleLoginRedirect`.
20
+
21
+ ### Fixes
22
+
23
+ - [#1354](https://github.com/okta/okta-auth-js/pull/1354) Fixes token auto renew if token has expired before `AutoRenewService` start
24
+ - [#1359](https://github.com/okta/okta-auth-js/pull/1359) IDX: removes statehandle check when load saved idxResponse
25
+
3
26
  ## 7.1.1
4
27
 
5
28
  ### Fixes
6
29
 
7
30
  - [#1355](https://github.com/okta/okta-auth-js/pull/1355) Adds missing type `currentAuthenticatorEnrollment` to `IdxContext`
8
31
 
32
+ ## 7.1.0
33
+
34
+ ### Features
35
+
36
+ - [#1343](https://github.com/okta/okta-auth-js/pull/1343) Supports Step Up MFA against `/authorize` and `/interact` endpoints
37
+
38
+ # Other
39
+
40
+ - [#1342](https://github.com/okta/okta-auth-js/pull/1342) - fixes possible RCE in jsonpath-plus
41
+
9
42
  ## 7.0.2
10
43
 
11
44
  ### Fixes
package/README.md CHANGED
@@ -225,7 +225,7 @@ var authClient = new OktaAuth(config);
225
225
 
226
226
  ### Running as a service
227
227
 
228
- By default, creating a new instance of `OktaAuth` will not create any asynchronous side-effects. However, certain features such as [token auto renew](#autorenew), [token auto remove](#autoremove) and [cross-tab synchronization](#syncstorage) require `OktaAuth` to be running as a service. This means timeouts are set in the background which will continue working until the service is stopped. To start the `OktaAuth` service, simply call the `start` method right after creation and before calling other methods like [handleLoginRedirect](#handleloginredirecttokens). To terminate all background processes, call `stop`. See [Service Configuration](#services) for more info.
228
+ By default, creating a new instance of `OktaAuth` will not create any asynchronous side-effects. However, certain features such as [token auto renew](#autorenew), [token auto remove](#autoremove) and [cross-tab synchronization](#syncstorage) require `OktaAuth` to be running as a service. This means timeouts are set in the background which will continue working until the service is stopped. To start the `OktaAuth` service, simply call the `start` method right after creation and before calling other methods like [handleRedirect](#handleredirectoriginaluri). To terminate all background processes, call `stop`. See [Service Configuration](#services) for more info.
229
229
 
230
230
  ```javascript
231
231
  var authClient = new OktaAuth(config);
@@ -536,7 +536,7 @@ oktaAuth.authStateManager.updateAuthState();
536
536
 
537
537
  > :link: web browser only <br>
538
538
 
539
- Callback function. When [sdk.handleLoginRedirect](#handleloginredirecttokens) is called, by default it uses `window.location.replace` to redirect back to the [originalUri](#setoriginaluriuri). This option overrides the default behavior.
539
+ Callback function. When [sdk.handleRedirect](#handleredirectoriginaluri) is called, by default it uses `window.location.replace` to redirect back to the [originalUri](#setoriginaluriuri). This option overrides the default behavior.
540
540
 
541
541
  ```javascript
542
542
  const config = {
@@ -552,7 +552,7 @@ const config = {
552
552
  const oktaAuth = new OktaAuth(config);
553
553
  if (oktaAuth.isLoginRedirect()) {
554
554
  try {
555
- await oktaAuth.handleLoginRedirect();
555
+ await oktaAuth.handleRedirect();
556
556
  } catch (e) {
557
557
  // log or display error details
558
558
  }
@@ -891,7 +891,8 @@ This is accomplished by selecting a single tab to handle the network requests to
891
891
  * [getOriginalUri](#getoriginaluristate)
892
892
  * [removeOriginalUri](#removeoriginaluri)
893
893
  * [isLoginRedirect](#isloginredirect)
894
- * [handleLoginRedirect](#handleloginredirecttokens)
894
+ * [handleLoginRedirect](#handleloginredirecttokens-originaluri)
895
+ * [handleRedirect](#handleredirectoriginaluri)
895
896
  * [setHeaders](#setheaders)
896
897
  * [tx.resume](#txresume)
897
898
  * [tx.exists](#txexists)
@@ -903,6 +904,8 @@ This is accomplished by selecting a single tab to handle the network requests to
903
904
  * [session.refresh](#sessionrefresh)
904
905
  * [idx](#idx)
905
906
  * [myaccount](#myaccount)
907
+ * [endpoints](#endpoints)
908
+ * [endpoints.autorize.enrollAuthenticator](#endpointsauthorizeenrollauthenticatoroptions)
906
909
  * [token](#token)
907
910
  * [token.getWithoutPrompt](#tokengetwithoutpromptoptions)
908
911
  * [token.getWithPopup](#tokengetwithpopupoptions)
@@ -966,7 +969,7 @@ You can use [storeTokensFromRedirect](#storetokensfromredirect) to store tokens
966
969
  ```javascript
967
970
  if (authClient.isLoginRedirect()) {
968
971
  try {
969
- await authClient.handleLoginRedirect();
972
+ await authClient.handleRedirect();
970
973
  } catch (e) {
971
974
  // log or display error details
972
975
  }
@@ -988,6 +991,7 @@ Signs the user out of their current [Okta session](https://developer.okta.com/do
988
991
  * Will redirect to an Okta-hosted page before returning to your app.
989
992
  * If a `postLogoutRedirectUri` has not been specified or configured, `window.location.origin` will be used as the return URI. This URI must be listed in the Okta application's [Login redirect URIs](#login-redirect-uris). If the URI is unknown or invalid the redirect will end on a 400 error page from Okta. This error will be visible to the user and cannot be handled by the app.
990
993
  * Requires a valid ID token. If an ID token is not available, `signOut` will fallback to using the XHR-based [closeSession](#closesession) method. This method may fail to sign the user out if 3rd-party cookies have been blocked by the browser.
994
+ * If a fallback to [closeSession](#closesession) is used, `signOut()` returns a promise that resolves with the result of [closeSession](#closesession) (`true` if an existing Okta session have been closed or `false` if a session does not exist or has already been closed). Otherwise a promise resolves with `true`.
991
995
  * For more information, see [Logout](https://developer.okta.com/docs/reference/api/oidc/#logout) in the OIDC API documentation.
992
996
 
993
997
  `signOut` takes the following options:
@@ -1033,7 +1037,7 @@ authClient.signOut({
1033
1037
  > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1034
1038
  > :hourglass: async
1035
1039
 
1036
- Signs the user out of their current [Okta session](https://developer.okta.com/docs/api/resources/sessions) and clears all tokens stored locally in the `TokenManager`. This method is an XHR-based alternative to [signOut](#signout), which will redirect to Okta before returning to your application. Here are some points to consider when using this method:
1040
+ Signs the user out of their current [Okta session](https://developer.okta.com/docs/api/resources/sessions) and clears all tokens stored locally in the `TokenManager`. Returns a promise that resolves with `true` if an existing Okta session have been closed, or `false` if a session does not exist or has already been closed. This method is an XHR-based alternative to [signOut](#signout), which will redirect to Okta before returning to your application. Here are some points to consider when using this method:
1037
1041
 
1038
1042
  * Executes in the background. The user will see not any change to `window.location`.
1039
1043
  * The method will fail to sign the user out if 3rd-party cookies are blocked by the browser.
@@ -1044,8 +1048,12 @@ Signs the user out of their current [Okta session](https://developer.okta.com/do
1044
1048
  ```javascript
1045
1049
  await authClient.revokeAccessToken(); // strongly recommended
1046
1050
  authClient.closeSession()
1047
- .then(() => {
1048
- window.location.reload(); // optional
1051
+ .then((sessionClosed) => {
1052
+ if (sessionClosed) {
1053
+ window.location.reload(); // optional
1054
+ } else {
1055
+ // Session does not exist or has already been closed
1056
+ }
1049
1057
  })
1050
1058
  .catch(e => {
1051
1059
  if (e.xhr && e.xhr.status === 429) {
@@ -1174,7 +1182,7 @@ Check `window.location` to verify if the app is in OAuth callback state or not.
1174
1182
  if (authClient.isLoginRedirect()) {
1175
1183
  // callback flow
1176
1184
  try {
1177
- await authClient.handleLoginRedirect();
1185
+ await authClient.handleRedirect();
1178
1186
  } catch (e) {
1179
1187
  // log or display error details
1180
1188
  }
@@ -1186,12 +1194,23 @@ if (authClient.isLoginRedirect()) {
1186
1194
  ### `handleLoginRedirect(tokens?, originalUri?)`
1187
1195
 
1188
1196
  > :link: web browser only <br>
1189
- > :hourglass: async
1197
+ > :hourglass: async <br>
1198
+ > :warning: Deprecated, this method could be removed in next major release, use [sdk.handleRedirect](#handleredirectoriginaluri) instead.
1190
1199
 
1191
1200
  Stores passed in tokens or tokens from redirect url into storage, then redirect users back to the [originalUri](#setoriginaluriuri). When using `PKCE` authorization code flow, this method also exchanges authorization code for tokens. By default it calls `window.location.replace` for the redirection. The default behavior can be overrided by providing [options.restoreOriginalUri](#configuration-options). By default, [originalUri](#getoriginaluristate) will be retrieved from storage, but this can be overridden by passing a value fro `originalUri` to this function in the 2nd parameter.
1192
1201
 
1193
1202
  > **Note:** `handleLoginRedirect` throws `OAuthError` or `AuthSdkError` in case there are errors during token retrieval.
1194
1203
 
1204
+ ### `handleRedirect(originalUri?)`
1205
+
1206
+ > :link: web browser only <br>
1207
+ > :hourglass: async
1208
+
1209
+ Handle a redirect to the configured [redirectUri](#configuration-options) that happens on the end of [login](#signInWithRedirectoptions) flow, [enroll authenticator](#endpointsauthorizeenrollauthenticatoroptions) flow or on an error.
1210
+ Stores tokens from redirect url into storage (for login flow), then redirect users back to the [originalUri](#setoriginaluriuri). When using `PKCE` authorization code flow, this method also exchanges authorization code for tokens. By default it calls `window.location.replace` for the redirection. The default behavior can be overrided by providing [options.restoreOriginalUri](#configuration-options). By default, [originalUri](#getoriginaluristate) will be retrieved from storage, but this can be overridden by specifying `originalUri` in the first parameter to this function.
1211
+
1212
+ > **Note:** `handleRedirect` throws `OAuthError` or `AuthSdkError` in case there are errors during token retrieval or authenticator enrollment.
1213
+
1195
1214
  ### `setHeaders()`
1196
1215
 
1197
1216
  Can set (or unset) request headers after construction.
@@ -1238,7 +1257,7 @@ See [authn API](docs/authn.md#sessionsetcookieandredirectsessiontoken-redirectur
1238
1257
  #### `session.exists()`
1239
1258
 
1240
1259
  > :link: web browser only <br>
1241
- > :warning: This method requires access to [third party cookies] <br>(#third-party-cookies)
1260
+ > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1242
1261
  > :hourglass: async
1243
1262
 
1244
1263
  Returns a promise that resolves with `true` if there is an existing Okta [session](https://developer.okta.com/docs/api/resources/sessions#example), or `false` if not.
@@ -1257,7 +1276,7 @@ authClient.session.exists()
1257
1276
  #### `session.get()`
1258
1277
 
1259
1278
  > :link: web browser only <br>
1260
- > :warning: This method requires access to [third party cookies] <br>(#third-party-cookies)
1279
+ > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1261
1280
  > :hourglass: async
1262
1281
 
1263
1282
  Gets the active [session](https://developer.okta.com/docs/api/resources/sessions#example).
@@ -1275,7 +1294,7 @@ authClient.session.get()
1275
1294
  #### `session.refresh()`
1276
1295
 
1277
1296
  > :link: web browser only <br>
1278
- > :warning: This method requires access to [third party cookies] <br>(#third-party-cookies)
1297
+ > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1279
1298
  > :hourglass: async
1280
1299
 
1281
1300
  Refresh the current session by extending its lifetime. This can be used as a keep-alive operation.
@@ -1298,8 +1317,7 @@ See detail in [IDX README](docs/idx.md)
1298
1317
 
1299
1318
  See detail in [MyAccount API README](docs/myaccount/README.md)
1300
1319
 
1301
-
1302
- ### `token`
1320
+ ### `endpoints`
1303
1321
 
1304
1322
  #### Authorize options
1305
1323
 
@@ -1315,39 +1333,71 @@ The following configuration options can be included in `token.getWithoutPrompt`,
1315
1333
  | `idp` | Identity provider to use if there is no Okta Session. |
1316
1334
  | `idpScope` | A space delimited list of scopes to be provided to the Social Identity Provider when performing [Social Login][social-login] These scopes are used in addition to the scopes already configured on the Identity Provider. |
1317
1335
  | `display` | The display parameter to be passed to the Social Identity Provider when performing [Social Login][social-login]. |
1318
- | `prompt` | Determines whether the Okta login will be displayed on failure. Use `none` to prevent this behavior. Valid values: `none`, `consent`, `login`, or `consent login`. See [Parameter details](https://developer.okta.com/docs/reference/api/oidc/#parameter-details) for more information. |
1336
+ | `prompt` | Determines whether the Okta login will be displayed on failure. Use `none` to prevent this behavior. Valid values: `none`, `consent`, `login`, or `consent login`. See [Parameter details](https://developer.okta.com/docs/reference/api/oidc/#parameter-details) for more information. Special value `enroll_authenticator` is used for [enrollAuthenticator](#endpointsauthorizeenrollauthenticatoroptions). |
1319
1337
  | `maxAge` | Allowable elapsed time, in seconds, since the last time the end user was actively authenticated by Okta. |
1320
1338
  | `acrValues` | [[EA][early-access]] Optional parameter to increase the level of user assurance. See [Predefined ACR values](https://developer.okta.com/docs/guides/step-up-authentication/main/#predefined-parameter-values) for more information. |
1339
+ | `enrollAmrValues` | [[EA][early-access]] List of [authentication methods](https://self-issued.info/docs/draft-jones-oauth-amr-values-00.html) used to enroll authenticators with [enrollAuthenticator](#endpointsauthorizeenrollauthenticatoroptions). See [Parameter details](https://developer.okta.com/docs/reference/api/oidc/#parameter-details) for more information. |
1321
1340
  | `loginHint` | A username to prepopulate if prompting for authentication. |
1322
1341
 
1323
1342
  For more details, see Okta's [Authorize Request API](https://developer.okta.com/docs/api/resources/oidc#request-parameters).
1324
1343
 
1344
+ #### `endpoints.authorize.enrollAuthenticator(options)`
1345
+
1346
+ > :link: web browser only <br>
1347
+ > [Early Access][early-access]
1348
+
1349
+ Enroll authenticators using a redirect to [authorizeUrl](#authorizeurl) with special parameters. After a successful enrollment, the browser will be redirected to the configured [redirectUri](#configuration-options). You can use [sdk.handleRedirect](#handleredirectoriginaluri) to handle the redirect on successful enrollment or an error.
1350
+
1351
+ * `options` - See [Authorize options](#authorize-options)
1352
+
1353
+ Options that will be omitted: `scopes`, `nonce`.
1354
+
1355
+ Options that will be overridden: `responseType: 'none', prompt: 'enroll_authenticator'`.
1356
+
1357
+ Required options:
1358
+
1359
+ * `enrollAmrValues` - list of [authentication methods](https://self-issued.info/docs/draft-jones-oauth-amr-values-00.html) to allow the user to enroll in.
1360
+
1361
+ List of AMR values:
1362
+ | AMR Value | Authenticator |
1363
+ | ------------- | -------------------- |
1364
+ | `pwd` | Okta Password |
1365
+ | `kba` | Security question |
1366
+ | `email` | Okta Email |
1367
+ | `sms` | SMS |
1368
+ | `tel` | Voice call |
1369
+ | `duo` | DUO |
1370
+ | `symantec` | Symantec VIP |
1371
+ | `google_otp` | Google Authenticator |
1372
+ | `okta_verify` | Okta Verify |
1373
+ | `swk` | Custom App |
1374
+ | `pop` | WebAuthn |
1375
+ | `oath_otp` | On-Prem MFA |
1376
+ | `rsa` | RSA SecurID |
1377
+ | `yubikey` | Yubikey |
1378
+ | `otp` | Custom HOTP |
1379
+ | `fed` | External IdP |
1380
+ | `sc` + `swk` | SmartCard/PIV |
1381
+
1382
+ See [enroll_amr_values parameter details](https://developer.okta.com/docs/reference/api/oidc/#request-parameters) for more information.
1383
+
1384
+ * `acrValues` - must be `urn:okta:2fa:any:ifpossible`, which means the user is prompted for at least one factor before enrollment.
1385
+
1325
1386
  ##### Example
1326
1387
 
1327
1388
  ```javascript
1328
- authClient.token.getWithoutPrompt({
1329
- sessionToken: '00p8RhRDCh_8NxIin-wtF5M6ofFtRhfKWGBAbd2WmE',
1330
- scopes: [
1331
- 'openid',
1332
- 'email',
1333
- 'profile'
1334
- ],
1335
- state: '8rFzn3MH5q',
1336
- nonce: '51GePTswrm',
1337
- // Use a custom IdP for social authentication
1338
- idp: '0oa62b57p7c8PaGpU0h7'
1339
- })
1340
- .then(function(res) {
1341
- var tokens = res.tokens;
1342
-
1343
- // Do something with tokens, such as
1344
- authClient.tokenManager.setTokens(tokens);
1345
- })
1346
- .catch(function(err) {
1347
- // handle OAuthError or AuthSdkError
1348
- });
1389
+ try {
1390
+ authClient.endpoints.authorize.enrollAuthenticator({
1391
+ enrollAmrValues: ['okta_verify'],
1392
+ acrValues: 'urn:okta:2fa:any:ifpossible'
1393
+ })
1394
+ } catch(err) {
1395
+ // handle AuthSdkError
1396
+ }
1349
1397
  ```
1350
1398
 
1399
+ ### `token`
1400
+
1351
1401
  #### `token.getWithoutPrompt(options)`
1352
1402
 
1353
1403
  > :link: web browser only <br>
@@ -1358,11 +1408,22 @@ When you've obtained a sessionToken from the authorization flows, or a session a
1358
1408
 
1359
1409
  * `options` - See [Authorize options](#authorize-options)
1360
1410
 
1411
+ ##### Example
1412
+
1361
1413
  ```javascript
1362
1414
  authClient.token.getWithoutPrompt({
1363
1415
  responseType: 'id_token', // or array of types
1364
1416
  sessionToken: 'testSessionToken' // optional if the user has an existing Okta session
1365
- })
1417
+ scopes: [
1418
+ 'openid',
1419
+ 'email',
1420
+ 'profile'
1421
+ ],
1422
+ state: '8rFzn3MH5q',
1423
+ nonce: '51GePTswrm',
1424
+ // Use a custom IdP for social authentication
1425
+ idp: '0oa62b57p7c8PaGpU0h7'
1426
+ })
1366
1427
  .then(function(res) {
1367
1428
  var tokens = res.tokens;
1368
1429
 
@@ -1492,7 +1553,7 @@ console.log(decodedToken.header, decodedToken.payload, decodedToken.signature);
1492
1553
 
1493
1554
  #### `token.renew(tokenToRenew)`
1494
1555
 
1495
- > :warning: This method requires access to [third party cookies](#third-party-cookies)
1556
+ > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1496
1557
  > :hourglass: async
1497
1558
 
1498
1559
  Returns a new token if the Okta [session](https://developer.okta.com/docs/api/resources/sessions#example) is still valid.
@@ -1597,6 +1658,7 @@ Returns a `TokenParams` object. If `PKCE` is enabled, this object will contain v
1597
1658
 
1598
1659
  Used internally to perform the final step of the `PKCE` authorization code flow. Accepts a `TokenParams` object which should contain a `codeVerifier` and an `authorizationCode`.
1599
1660
 
1661
+
1600
1662
  ### `tokenManager` API
1601
1663
 
1602
1664
  #### `tokenManager.add(key, token)`
package/cjs/core/mixin.js CHANGED
@@ -28,6 +28,9 @@ function mixinCore(Base) {
28
28
  this.tokenManager.stop();
29
29
  await this.serviceManager.stop();
30
30
  }
31
+ async handleRedirect(originalUri) {
32
+ await this.handleLoginRedirect(undefined, originalUri);
33
+ }
31
34
 
32
35
  // eslint-disable-next-line complexity
33
36
  async handleLoginRedirect(tokens, originalUri) {
@@ -1 +1 @@
1
- {"version":3,"file":"mixin.js","names":["mixinCore","Base","OktaAuthCore","constructor","args","authStateManager","AuthStateManager","serviceManager","ServiceManager","options","services","start","tokenManager","token","isLoginRedirect","updateAuthState","stop","handleLoginRedirect","tokens","originalUri","state","setTokens","getOriginalUri","oAuthResponse","parseOAuthResponseFromUrl","storeTokensFromRedirect","e","removeOriginalUri","restoreOriginalUri","window","location","replace"],"sources":["../../../lib/core/mixin.ts"],"sourcesContent":["import { parseOAuthResponseFromUrl } from '../oidc/parseFromUrl';\nimport { OktaAuthConstructor } from '../base/types';\nimport {\n OAuthStorageManagerInterface,\n OAuthTransactionMeta,\n OktaAuthOAuthInterface,\n PKCETransactionMeta,\n Tokens,\n TransactionManagerInterface,\n} from '../oidc/types';\nimport { AuthStateManager } from './AuthStateManager';\nimport { ServiceManager } from './ServiceManager';\nimport { OktaAuthCoreInterface, OktaAuthCoreOptions } from './types';\n\nexport function mixinCore\n<\n M extends OAuthTransactionMeta = PKCETransactionMeta,\n S extends OAuthStorageManagerInterface<M> = OAuthStorageManagerInterface<M>,\n O extends OktaAuthCoreOptions = OktaAuthCoreOptions,\n TM extends TransactionManagerInterface = TransactionManagerInterface,\n TBase extends OktaAuthConstructor<OktaAuthOAuthInterface<M, S, O, TM>>\n = OktaAuthConstructor<OktaAuthOAuthInterface<M, S, O, TM>>\n>\n(Base: TBase): TBase & OktaAuthConstructor<OktaAuthCoreInterface<M, S, O, TM>>\n{\n return class OktaAuthCore extends Base implements OktaAuthCoreInterface<M, S, O, TM>\n {\n authStateManager: AuthStateManager<M, S, O>;\n serviceManager: ServiceManager<M, S, O>;\n \n constructor(...args: any[]) {\n super(...args);\n\n // AuthStateManager\n this.authStateManager = new AuthStateManager<M, S, O>(this);\n\n // ServiceManager\n this.serviceManager = new ServiceManager<M, S, O>(this, this.options.services);\n }\n\n async start() {\n await this.serviceManager.start();\n // TODO: review tokenManager.start\n this.tokenManager.start();\n if (!this.token.isLoginRedirect()) {\n await this.authStateManager.updateAuthState();\n }\n }\n \n async stop() {\n // TODO: review tokenManager.stop\n this.tokenManager.stop();\n await this.serviceManager.stop();\n }\n\n // eslint-disable-next-line complexity\n async handleLoginRedirect(tokens?: Tokens, originalUri?: string): Promise<void> {\n let state = this.options.state;\n \n // Store tokens and update AuthState by the emitted events\n if (tokens) {\n this.tokenManager.setTokens(tokens);\n originalUri = originalUri || this.getOriginalUri(this.options.state);\n } else if (this.isLoginRedirect()) {\n try {\n // For redirect flow, get state from the URL and use it to retrieve the originalUri\n const oAuthResponse = await parseOAuthResponseFromUrl(this, {});\n state = oAuthResponse.state;\n originalUri = originalUri || this.getOriginalUri(state);\n await this.storeTokensFromRedirect();\n } catch(e) {\n // auth state should be updated\n await this.authStateManager.updateAuthState();\n throw e;\n }\n } else {\n return; // nothing to do\n }\n \n // ensure auth state has been updated\n await this.authStateManager.updateAuthState();\n \n // clear originalUri from storage\n this.removeOriginalUri(state);\n \n // Redirect to originalUri\n const { restoreOriginalUri } = this.options;\n if (restoreOriginalUri) {\n await restoreOriginalUri(this, originalUri);\n } else if (originalUri) {\n window.location.replace(originalUri);\n }\n }\n };\n}\n"],"mappings":";;;AAAA;AAUA;AACA;AAGO,SAASA,SAAS,CASxBC,IAAW,EACZ;EACE,OAAO,MAAMC,YAAY,SA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uBAAuB,EAAE;QACtC,CAAC,CAAC,OAAMC,CAAC,EAAE;UACT;UACA,MAAM,IAAI,CAACrB,gBAAgB,CAACU,eAAe,EAAE;UAC7C,MAAMW,CAAC;QACT;MACF,CAAC,MAAM;QACL,OAAO,CAAC;MACV;;MAEA;MACA,MAAM,IAAI,CAACrB,gBAAgB,CAACU,eAAe,EAAE;;MAE7C;MACA,IAAI,CAACY,iBAAiB,CAACP,KAAK,CAAC;;MAE7B;MACA,MAAM;QAAEQ;MAAmB,CAAC,GAAG,IAAI,CAACnB,OAAO;MAC3C,IAAImB,kBAAkB,EAAE;QACtB,MAAMA,kBAAkB,CAAC,IAAI,EAAET,WAAW,CAAC;MAC7C,CAAC,MAAM,IAAIA,WAAW,EAAE;QACtBU,MAAM,CAACC,QAAQ,CAACC,OAAO,CAACZ,WAAW,CAAC;MACtC;IACF;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"mixin.js","names":["mixinCore","Base","OktaAuthCore","constructor","args","authStateManager","AuthStateManager","serviceManager","ServiceManager","options","services","start","tokenManager","token","isLoginRedirect","updateAuthState","stop","handleRedirect","originalUri","handleLoginRedirect","undefined","tokens","state","setTokens","getOriginalUri","oAuthResponse","parseOAuthResponseFromUrl","storeTokensFromRedirect","e","removeOriginalUri","restoreOriginalUri","window","location","replace"],"sources":["../../../lib/core/mixin.ts"],"sourcesContent":["import { parseOAuthResponseFromUrl } from '../oidc/parseFromUrl';\nimport { OktaAuthConstructor } from '../base/types';\nimport {\n OAuthStorageManagerInterface,\n OAuthTransactionMeta,\n OktaAuthOAuthInterface,\n PKCETransactionMeta,\n Tokens,\n TransactionManagerInterface,\n} from '../oidc/types';\nimport { AuthStateManager } from './AuthStateManager';\nimport { ServiceManager } from './ServiceManager';\nimport { OktaAuthCoreInterface, OktaAuthCoreOptions } from './types';\n\nexport function mixinCore\n<\n M extends OAuthTransactionMeta = PKCETransactionMeta,\n S extends OAuthStorageManagerInterface<M> = OAuthStorageManagerInterface<M>,\n O extends OktaAuthCoreOptions = OktaAuthCoreOptions,\n TM extends TransactionManagerInterface = TransactionManagerInterface,\n TBase extends OktaAuthConstructor<OktaAuthOAuthInterface<M, S, O, TM>>\n = OktaAuthConstructor<OktaAuthOAuthInterface<M, S, O, TM>>\n>\n(Base: TBase): TBase & OktaAuthConstructor<OktaAuthCoreInterface<M, S, O, TM>>\n{\n return class OktaAuthCore extends Base implements OktaAuthCoreInterface<M, S, O, TM>\n {\n authStateManager: AuthStateManager<M, S, O>;\n serviceManager: ServiceManager<M, S, O>;\n \n constructor(...args: any[]) {\n super(...args);\n\n // AuthStateManager\n this.authStateManager = new AuthStateManager<M, S, O>(this);\n\n // ServiceManager\n this.serviceManager = new ServiceManager<M, S, O>(this, this.options.services);\n }\n\n async start() {\n await this.serviceManager.start();\n // TODO: review tokenManager.start\n this.tokenManager.start();\n if (!this.token.isLoginRedirect()) {\n await this.authStateManager.updateAuthState();\n }\n }\n \n async stop() {\n // TODO: review tokenManager.stop\n this.tokenManager.stop();\n await this.serviceManager.stop();\n }\n\n async handleRedirect(originalUri?: string): Promise<void> {\n await this.handleLoginRedirect(undefined, originalUri);\n }\n\n // eslint-disable-next-line complexity\n async handleLoginRedirect(tokens?: Tokens, originalUri?: string): Promise<void> {\n let state = this.options.state;\n \n // Store tokens and update AuthState by the emitted events\n if (tokens) {\n this.tokenManager.setTokens(tokens);\n originalUri = originalUri || this.getOriginalUri(this.options.state);\n } else if (this.isLoginRedirect()) {\n try {\n // For redirect flow, get state from the URL and use it to retrieve the originalUri\n const oAuthResponse = await parseOAuthResponseFromUrl(this, {});\n state = oAuthResponse.state;\n originalUri = originalUri || this.getOriginalUri(state);\n await this.storeTokensFromRedirect();\n } catch(e) {\n // auth state should be updated\n await this.authStateManager.updateAuthState();\n throw e;\n }\n } else {\n return; // nothing to do\n }\n \n // ensure auth state has been updated\n await this.authStateManager.updateAuthState();\n \n // clear originalUri from storage\n this.removeOriginalUri(state);\n \n // Redirect to originalUri\n const { restoreOriginalUri } = this.options;\n if (restoreOriginalUri) {\n await restoreOriginalUri(this, originalUri);\n } else if (originalUri) {\n window.location.replace(originalUri);\n }\n }\n };\n}\n"],"mappings":";;;AAAA;AAUA;AACA;AAGO,SAASA,SAAS,CASxBC,IAAW,EACZ;EACE,OAAO,MAAMC,YAAY,SAASD,IAAI,CACtC;IAIEE,WAAW,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAGA,IAAI,CAAC;;MAEd;MACA,IAAI,CAACC,gBAAgB,GAAG,IAAIC,kCAAgB,CAAU,IAAI,CAAC;;MAE3D;MACA,IAAI,CAACC,cAAc,GAAG,IAAIC,8BAAc,CAAU,IAAI,EAAE,IAAI,CAACC,OAAO,CAACC,QAAQ,CAAC;IAChF;IAEA,MAAMC,KAAK,GAAG;MACZ,MAAM,IAAI,CAACJ,cAAc,CAACI,KAAK,EAAE;MACjC;MACA,IAAI,CAACC,YAAY,CAACD,KAAK,EAAE;MACzB,IAAI,CAAC,IAAI,CAACE,KAAK,CAACC,eAAe,EAAE,EAAE;QACjC,MAAM,IAAI,CAACT,gBAAgB,CAACU,eAAe,EAAE;MAC/C;IACF;IAEA,MAAMC,IAAI,GAAG;MACX;MACA,IAAI,CAACJ,YAAY,CAACI,IAAI,EAAE;MACxB,MAAM,IAAI,CAACT,cAAc,CAACS,IAAI,EAAE;IAClC;IAEA,MAAMC,cAAc,CAACC,WAAoB,EAAiB;MACxD,MAAM,IAAI,CAACC,mBAAmB,CAACC,SAAS,EAAEF,WAAW,CAAC;IACxD;;IAEA;IACA,MAAMC,mBAAmB,CAACE,MAAe,EAAEH,WAAoB,EAAiB;MAC9E,IAAII,KAAK,GAAG,IAAI,CAACb,OAAO,CAACa,KAAK;;MAE9B;MACA,IAAID,MAAM,EAAE;QACV,IAAI,CAACT,YAAY,CAACW,SAAS,CAACF,MAAM,CAAC;QACnCH,WAAW,GAAGA,WAAW,IAAI,IAAI,CAACM,cAAc,CAAC,IAAI,CAACf,OAAO,CAACa,KAAK,CAAC;MACtE,CAAC,MAAM,IAAI,IAAI,CAACR,eAAe,EAAE,EAAE;QACjC,IAAI;UACF;UACA,MAAMW,aAAa,GAAG,MAAM,IAAAC,uCAAyB,EAAC,IAAI,EAAE,CAAC,CAAC,CAAC;UAC/DJ,KAAK,GAAGG,aAAa,CAACH,KAAK;UAC3BJ,WAAW,GAAGA,WAAW,IAAI,IAAI,CAACM,cAAc,CAACF,KAAK,CAAC;UACvD,MAAM,IAAI,CAACK,uBAAuB,EAAE;QACtC,CAAC,CAAC,OAAMC,CAAC,EAAE;UACT;UACA,MAAM,IAAI,CAACvB,gBAAgB,CAACU,eAAe,EAAE;UAC7C,MAAMa,CAAC;QACT;MACF,CAAC,MAAM;QACL,OAAO,CAAC;MACV;;MAEA;MACA,MAAM,IAAI,CAACvB,gBAAgB,CAACU,eAAe,EAAE;;MAE7C;MACA,IAAI,CAACc,iBAAiB,CAACP,KAAK,CAAC;;MAE7B;MACA,MAAM;QAAEQ;MAAmB,CAAC,GAAG,IAAI,CAACrB,OAAO;MAC3C,IAAIqB,kBAAkB,EAAE;QACtB,MAAMA,kBAAkB,CAAC,IAAI,EAAEZ,WAAW,CAAC;MAC7C,CAAC,MAAM,IAAIA,WAAW,EAAE;QACtBa,MAAM,CAACC,QAAQ,CAACC,OAAO,CAACf,WAAW,CAAC;MACtC;IACF;EACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","names":[],"sources":["../../../../lib/core/types/api.ts"],"sourcesContent":["import {\n OAuthStorageManagerInterface,\n OktaAuthOAuthInterface,\n OktaAuthOAuthOptions,\n PKCETransactionMeta,\n Tokens,\n TransactionManagerInterface\n} from '../../oidc/types';\n\nimport { ServiceManagerInterface, ServiceManagerOptions } from './Service';\nimport { AuthState, AuthStateManagerInterface } from './AuthState';\n\n\n// options passed to AuthJS constructor\nexport interface OktaAuthCoreOptions extends OktaAuthOAuthOptions\n{\n services?: ServiceManagerOptions;\n // eslint-disable-next-line no-use-before-define\n transformAuthState?: (oktaAuth: OktaAuthCoreInterface, authState: AuthState) => Promise<AuthState>;\n}\n\nexport type CoreStorageManagerInterface<\n M extends PKCETransactionMeta = PKCETransactionMeta\n> = OAuthStorageManagerInterface<M>;\n\n// an instance of AuthJS with OAuth and Services\nexport interface OktaAuthCoreInterface<\n M extends PKCETransactionMeta = PKCETransactionMeta,\n S extends CoreStorageManagerInterface<M> = CoreStorageManagerInterface<M>,\n O extends OktaAuthCoreOptions = OktaAuthCoreOptions,\n TM extends TransactionManagerInterface = TransactionManagerInterface\n> \nextends OktaAuthOAuthInterface<M, S, O, TM>\n{\n serviceManager: ServiceManagerInterface;\n authStateManager: AuthStateManagerInterface;\n start(): Promise<void>;\n stop(): Promise<void>;\n handleLoginRedirect(tokens?: Tokens, originalUri?: string): Promise<void>;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"api.js","names":[],"sources":["../../../../lib/core/types/api.ts"],"sourcesContent":["import {\n OAuthStorageManagerInterface,\n OktaAuthOAuthInterface,\n OktaAuthOAuthOptions,\n PKCETransactionMeta,\n Tokens,\n TransactionManagerInterface\n} from '../../oidc/types';\n\nimport { ServiceManagerInterface, ServiceManagerOptions } from './Service';\nimport { AuthState, AuthStateManagerInterface } from './AuthState';\n\n\n// options passed to AuthJS constructor\nexport interface OktaAuthCoreOptions extends OktaAuthOAuthOptions\n{\n services?: ServiceManagerOptions;\n // eslint-disable-next-line no-use-before-define\n transformAuthState?: (oktaAuth: OktaAuthCoreInterface, authState: AuthState) => Promise<AuthState>;\n}\n\nexport type CoreStorageManagerInterface<\n M extends PKCETransactionMeta = PKCETransactionMeta\n> = OAuthStorageManagerInterface<M>;\n\n// an instance of AuthJS with OAuth and Services\nexport interface OktaAuthCoreInterface<\n M extends PKCETransactionMeta = PKCETransactionMeta,\n S extends CoreStorageManagerInterface<M> = CoreStorageManagerInterface<M>,\n O extends OktaAuthCoreOptions = OktaAuthCoreOptions,\n TM extends TransactionManagerInterface = TransactionManagerInterface\n> \nextends OktaAuthOAuthInterface<M, S, O, TM>\n{\n serviceManager: ServiceManagerInterface;\n authStateManager: AuthStateManagerInterface;\n start(): Promise<void>;\n stop(): Promise<void>;\n handleLoginRedirect(tokens?: Tokens, originalUri?: string): Promise<void>;\n handleRedirect(originalUri?: string): Promise<void>;\n}\n"],"mappings":""}
@@ -20,7 +20,7 @@ var _features = require("../features");
20
20
  class OktaUserAgent {
21
21
  constructor() {
22
22
  // add base sdk env
23
- this.environments = [`okta-auth-js/${"7.1.1"}`];
23
+ this.environments = [`okta-auth-js/${"7.3.0"}`];
24
24
  }
25
25
  addEnvironment(env) {
26
26
  this.environments.push(env);
@@ -32,7 +32,7 @@ class OktaUserAgent {
32
32
  };
33
33
  }
34
34
  getVersion() {
35
- return "7.1.1";
35
+ return "7.3.0";
36
36
  }
37
37
  maybeAddNodeEnvironment() {
38
38
  if ((0, _features.isBrowser)() || !process || !process.versions) {
@@ -41,12 +41,8 @@ function createIdxTransactionManager() {
41
41
  }
42
42
  if (options) {
43
43
  const {
44
- stateHandle,
45
44
  interactionHandle
46
45
  } = options;
47
- if (stateHandle && storedValue.stateHandle !== stateHandle) {
48
- return null;
49
- }
50
46
  if (interactionHandle && storedValue.interactionHandle !== interactionHandle) {
51
47
  return null;
52
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IdxTransactionManager.js","names":["createIdxTransactionManager","TransactionManager","createTransactionManager","IdxTransactionManager","constructor","options","clear","clearIdxResponse","saveIdxResponse","data","saveLastResponse","storage","storageManager","getIdxResponseStorage","setStorage","loadIdxResponse","storedValue","getStorage","isRawIdxResponse","rawIdxResponse","stateHandle","interactionHandle","clearStorage"],"sources":["../../../lib/idx/IdxTransactionManager.ts"],"sourcesContent":["import { ClearTransactionMetaOptions, TransactionManagerOptions } from '../oidc/types';\nimport { createTransactionManager } from '../oidc/TransactionManager';\nimport { IdxTransactionMeta, IntrospectOptions } from './types';\nimport { isRawIdxResponse } from './types/idx-js';\nimport { IdxStorageManagerInterface, SavedIdxResponse } from './types/storage';\n\nexport function createIdxTransactionManager\n<\n M extends IdxTransactionMeta = IdxTransactionMeta,\n S extends IdxStorageManagerInterface<M> = IdxStorageManagerInterface<M>\n>\n()\n{\n const TransactionManager = createTransactionManager<M, S>();\n return class IdxTransactionManager extends TransactionManager\n {\n constructor(options: TransactionManagerOptions) {\n super(options);\n }\n\n clear(options: ClearTransactionMetaOptions = {}) {\n super.clear(options);\n\n if (options.clearIdxResponse !== false) {\n this.clearIdxResponse();\n }\n }\n \n saveIdxResponse(data: SavedIdxResponse): void {\n if (!this.saveLastResponse) {\n return;\n }\n const storage = this.storageManager.getIdxResponseStorage();\n if (!storage) {\n return;\n }\n storage.setStorage(data);\n }\n\n // eslint-disable-next-line complexity\n loadIdxResponse(options?: IntrospectOptions): SavedIdxResponse | null {\n if (!this.saveLastResponse) {\n return null;\n }\n const storage = this.storageManager.getIdxResponseStorage();\n if (!storage) {\n return null;\n }\n const storedValue = storage.getStorage();\n if (!storedValue || !isRawIdxResponse(storedValue.rawIdxResponse)) {\n return null;\n }\n\n if (options) {\n const { stateHandle, interactionHandle } = options;\n if (stateHandle && storedValue.stateHandle !== stateHandle) {\n return null;\n }\n if (interactionHandle && storedValue.interactionHandle !== interactionHandle) {\n return null;\n }\n }\n\n return storedValue;\n }\n\n clearIdxResponse(): void {\n if (!this.saveLastResponse) {\n return;\n }\n const storage = this.storageManager.getIdxResponseStorage();\n storage?.clearStorage();\n }\n };\n}\n"],"mappings":";;;AACA;AAEA;AAGO,SAASA,2BAA2B,GAM3C;EACE,MAAMC,kBAAkB,GAAG,IAAAC,4CAAwB,GAAQ;EAC3D,OAAO,MAAMC,qBAAqB,SAASF,kBAAkB,CAC7D;IACEG,WAAW,CAACC,OAAkC,EAAE;MAC9C,KAAK,CAACA,OAAO,CAAC;IAChB;IAEAC,KAAK,CAACD,OAAoC,GAAG,CAAC,CAAC,EAAE;MAC/C,KAAK,CAACC,KAAK,CAACD,OAAO,CAAC;MAEpB,IAAIA,OAAO,CAACE,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3,"file":"IdxTransactionManager.js","names":["createIdxTransactionManager","TransactionManager","createTransactionManager","IdxTransactionManager","constructor","options","clear","clearIdxResponse","saveIdxResponse","data","saveLastResponse","storage","storageManager","getIdxResponseStorage","setStorage","loadIdxResponse","storedValue","getStorage","isRawIdxResponse","rawIdxResponse","interactionHandle","clearStorage"],"sources":["../../../lib/idx/IdxTransactionManager.ts"],"sourcesContent":["import { ClearTransactionMetaOptions, TransactionManagerOptions } from '../oidc/types';\nimport { createTransactionManager } from '../oidc/TransactionManager';\nimport { IdxTransactionMeta, IntrospectOptions } from './types';\nimport { isRawIdxResponse } from './types/idx-js';\nimport { IdxStorageManagerInterface, SavedIdxResponse } from './types/storage';\n\nexport function createIdxTransactionManager\n<\n M extends IdxTransactionMeta = IdxTransactionMeta,\n S extends IdxStorageManagerInterface<M> = IdxStorageManagerInterface<M>\n>\n()\n{\n const TransactionManager = createTransactionManager<M, S>();\n return class IdxTransactionManager extends TransactionManager\n {\n constructor(options: TransactionManagerOptions) {\n super(options);\n }\n\n clear(options: ClearTransactionMetaOptions = {}) {\n super.clear(options);\n\n if (options.clearIdxResponse !== false) {\n this.clearIdxResponse();\n }\n }\n \n saveIdxResponse(data: SavedIdxResponse): void {\n if (!this.saveLastResponse) {\n return;\n }\n const storage = this.storageManager.getIdxResponseStorage();\n if (!storage) {\n return;\n }\n storage.setStorage(data);\n }\n\n // eslint-disable-next-line complexity\n loadIdxResponse(options?: IntrospectOptions): SavedIdxResponse | null {\n if (!this.saveLastResponse) {\n return null;\n }\n const storage = this.storageManager.getIdxResponseStorage();\n if (!storage) {\n return null;\n }\n const storedValue = storage.getStorage();\n if (!storedValue || !isRawIdxResponse(storedValue.rawIdxResponse)) {\n return null;\n }\n\n if (options) {\n const { interactionHandle } = options;\n if (interactionHandle && storedValue.interactionHandle !== interactionHandle) {\n return null;\n }\n }\n\n return storedValue;\n }\n\n clearIdxResponse(): void {\n if (!this.saveLastResponse) {\n return;\n }\n const storage = this.storageManager.getIdxResponse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QACb;MACF;MAEA,OAAOJ,WAAW;IACpB;IAEAT,gBAAgB,GAAS;MACvB,IAAI,CAAC,IAAI,CAACG,gBAAgB,EAAE;QAC1B;MACF;MACA,MAAMC,OAAO,GAAG,IAAI,CAACC,cAAc,CAACC,qBAAqB,EAAE;MAC3DF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEU,YAAY,EAAE;IACzB;EACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"OktaAuthIdx.js","names":["createOktaAuthIdx","StorageManagerConstructor","OptionsConstructor","TransactionManagerConstructor","Core","createOktaAuthCore","WithIdx","mixinIdx"],"sources":["../../../../lib/idx/factory/OktaAuthIdx.ts"],"sourcesContent":["import { createOktaAuthCore } from '../../core/factory';\nimport { OktaAuthConstructor, OktaAuthOptionsConstructor } from '../../base/types';\nimport { StorageManagerConstructor } from '../../storage/types';\nimport { IdxTransactionManagerInterface, OktaAuthIdxInterface } from '../types/api';\nimport { IdxTransactionMeta } from '../types/meta';\nimport { IdxStorageManagerInterface } from '../types/storage';\nimport { OktaAuthIdxOptions } from '../types/options';\nimport { mixinIdx } from '../mixin';\nimport { TransactionManagerConstructor } from '../../oidc/types';\nimport { OktaAuthCoreInterface } from '../../core/types';\n\nexport function createOktaAuthIdx<\n M extends IdxTransactionMeta = IdxTransactionMeta,\n S extends IdxStorageManagerInterface<M> = IdxStorageManagerInterface<M>,\n O extends OktaAuthIdxOptions = OktaAuthIdxOptions,\n TM extends IdxTransactionManagerInterface = IdxTransactionManagerInterface\n>(\n StorageManagerConstructor: StorageManagerConstructor<S>,\n OptionsConstructor: OktaAuthOptionsConstructor<O>,\n TransactionManagerConstructor: TransactionManagerConstructor<TM>\n)\n: OktaAuthConstructor<OktaAuthIdxInterface<M, S, O, TM> & OktaAuthCoreInterface<M, S, O, TM>>\n{\n const Core = createOktaAuthCore<M, S, O, TM>(\n StorageManagerConstructor,\n OptionsConstructor,\n TransactionManagerConstructor\n );\n const WithIdx = mixinIdx(Core);\n return WithIdx;\n}\n"],"mappings":";;;AAAA;AAOA;AAIO,SAASA,iBAAiB,CAM/BC,yBAAuD,EACvDC,kBAAiD,EACjDC,6BAAgE,EAGlE;EACE,MAAMC,IAAI,GAAG,IAAAC,2BAAkB,EAC7BJ,yBAAyB,EACzBC,kBAAkB,EAClBC,6BAA6B,CAC9B;EACD,MAAMG,OAAO,GAAG,IAAAC,eAAQ,EAACH,IAAI,CAAC;EAC9B,OAAOE,OAAO;AAChB"}
1
+ {"version":3,"file":"OktaAuthIdx.js","names":["createOktaAuthIdx","StorageManagerConstructor","OptionsConstructor","TransactionManagerConstructor","Core","createOktaAuthCore","WithIdx","mixinIdx"],"sources":["../../../../lib/idx/factory/OktaAuthIdx.ts"],"sourcesContent":["import { createOktaAuthCore } from '../../core/factory';\nimport { OktaAuthOptionsConstructor } from '../../base/types';\nimport { StorageManagerConstructor } from '../../storage/types';\nimport { IdxTransactionManagerInterface, OktaAuthIdxInterface, OktaAuthIdxConstructor } from '../types/api';\nimport { IdxTransactionMeta } from '../types/meta';\nimport { IdxStorageManagerInterface } from '../types/storage';\nimport { OktaAuthIdxOptions } from '../types/options';\nimport { mixinIdx } from '../mixin';\nimport { TransactionManagerConstructor } from '../../oidc/types';\nimport { OktaAuthCoreInterface } from '../../core/types';\n\nexport function createOktaAuthIdx<\n M extends IdxTransactionMeta = IdxTransactionMeta,\n S extends IdxStorageManagerInterface<M> = IdxStorageManagerInterface<M>,\n O extends OktaAuthIdxOptions = OktaAuthIdxOptions,\n TM extends IdxTransactionManagerInterface = IdxTransactionManagerInterface\n>(\n StorageManagerConstructor: StorageManagerConstructor<S>,\n OptionsConstructor: OktaAuthOptionsConstructor<O>,\n TransactionManagerConstructor: TransactionManagerConstructor<TM>\n)\n: OktaAuthIdxConstructor<OktaAuthIdxInterface<M, S, O, TM> & OktaAuthCoreInterface<M, S, O, TM>>\n{\n const Core = createOktaAuthCore<M, S, O, TM>(\n StorageManagerConstructor,\n OptionsConstructor,\n TransactionManagerConstructor\n );\n const WithIdx = mixinIdx(Core);\n return WithIdx;\n}\n"],"mappings":";;;AAAA;AAOA;AAIO,SAASA,iBAAiB,CAM/BC,yBAAuD,EACvDC,kBAAiD,EACjDC,6BAAgE,EAGlE;EACE,MAAMC,IAAI,GAAG,IAAAC,2BAAkB,EAC7BJ,yBAAyB,EACzBC,kBAAkB,EAClBC,6BAA6B,CAC9B;EACD,MAAMG,OAAO,GAAG,IAAAC,eAAQ,EAACH,IAAI,CAAC;EAC9B,OAAOE,OAAO;AAChB"}
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  exports.parseNonRemediations = exports.parseIdxResponse = void 0;
5
5
  var _remediationParser = require("./remediationParser");
6
6
  var _generateIdxAction = _interopRequireDefault(require("./generateIdxAction"));
7
- var _jsonpathPlus = require("jsonpath-plus");
7
+ var _jsonpath = require("../../../util/jsonpath");
8
8
  /*!
9
9
  * Copyright (c) 2021-Present, Okta, Inc. and/or its affiliates. All rights reserved.
10
10
  * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
@@ -81,8 +81,7 @@ const expandRelatesTo = (idxResponse, value) => {
81
81
  if (k === 'relatesTo') {
82
82
  const query = Array.isArray(value[k]) ? value[k][0] : value[k];
83
83
  if (typeof query === 'string') {
84
- // eslint-disable-next-line new-cap
85
- const result = (0, _jsonpathPlus.JSONPath)({
84
+ const result = (0, _jsonpath.jsonpath)({
86
85
  path: query,
87
86
  json: idxResponse
88
87
  })[0];
@@ -1 +1 @@
1
- {"version":3,"file":"idxResponseParser.js","names":["SKIP_FIELDS","Object","fromEntries","map","field","parseNonRemediations","authClient","idxResponse","toPersist","actions","context","keys","filter","forEach","fieldIsObject","rel","name","generateIdxAction","value","fieldValue","type","info","entries","subField","expandRelatesTo","k","query","Array","isArray","result","JSONPath","path","json","innerValue","convertRemediationAction","remediation","remediationActions","generateRemediationFunctions","actionFn","action","parseIdxResponse","remediationData","remediations"],"sources":["../../../../../lib/idx/idxState/v1/idxResponseParser.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-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 max-len */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { OktaAuthIdxInterface } from '../../types'; // auth-js/types\nimport { generateRemediationFunctions } from './remediationParser';\nimport generateIdxAction from './generateIdxAction';\nimport { JSONPath } from 'jsonpath-plus';\n\nconst SKIP_FIELDS = Object.fromEntries([\n 'remediation', // remediations are put into proceed/neededToProceed\n 'context', // the API response of 'context' isn't externally useful. We ignore it and put all non-action (contextual) info into idxState.context\n].map( (field) => [ field, !!'skip this field' ] ));\n\nexport const parseNonRemediations = function parseNonRemediations( authClient: OktaAuthIdxInterface, idxResponse, toPersist = {} ) {\n const actions = {};\n const context = {};\n\n Object.keys(idxResponse)\n .filter( field => !SKIP_FIELDS[field])\n .forEach( field => {\n const fieldIsObject = typeof idxResponse[field] === 'object' && !!idxResponse[field];\n\n if ( !fieldIsObject ) {\n // simple fields are contextual info\n context[field] = idxResponse[field];\n return;\n }\n\n if ( idxResponse[field].rel ) {\n // top level actions\n actions[idxResponse[field].name] = generateIdxAction(authClient, idxResponse[field], toPersist);\n return;\n }\n\n const { value: fieldValue, type, ...info} = idxResponse[field];\n context[field] = { type, ...info}; // add the non-action parts as context\n\n if ( type !== 'object' ) {\n // only object values hold actions\n context[field].value = fieldValue;\n return;\n }\n\n // We are an object field containing an object value\n context[field].value = {};\n Object.entries(fieldValue)\n .forEach( ([subField, value]) => {\n if (value.rel) { // is [field].value[subField] an action?\n // add any \"action\" value subfields to actions\n actions[`${field}-${subField.name || subField}`] = generateIdxAction(authClient, value, toPersist);\n } else {\n // add non-action value subfields to context\n context[field].value[subField] = value;\n }\n });\n });\n\n return { context, actions };\n};\n\nconst expandRelatesTo = (idxResponse, value) => {\n Object.keys(value).forEach(k => {\n if (k === 'relatesTo') {\n const query = Array.isArray(value[k]) ? value[k][0] : value[k];\n if (typeof query === 'string') {\n // eslint-disable-next-line new-cap\n const result = JSONPath({ path: query, json: idxResponse })[0];\n if (result) {\n value[k] = result;\n return;\n }\n }\n }\n if (Array.isArray(value[k])) {\n value[k].forEach(innerValue => expandRelatesTo(idxResponse, innerValue));\n }\n });\n};\n\nconst convertRemediationAction = (authClient: OktaAuthIdxInterface, remediation, toPersist) => {\n // Only remediation that has `rel` field (indicator for form submission) can have http action\n if (remediation.rel) {\n const remediationActions = generateRemediationFunctions( authClient, [remediation], toPersist );\n const actionFn = remediationActions[remediation.name];\n return {\n ...remediation,\n action: actionFn,\n };\n }\n \n return remediation;\n};\n\nexport const parseIdxResponse = function parseIdxResponse( authClient: OktaAuthIdxInterface, idxResponse, toPersist = {} ): {\n remediations: IdxRemediation[];\n context: IdxContext;\n actions: IdxActions;\n} {\n const remediationData = idxResponse.remediation?.value || [];\n\n remediationData.forEach(\n remediation => expandRelatesTo(idxResponse, remediation)\n );\n\n const remediations = remediationData.map(remediation => convertRemediationAction( authClient, remediation, toPersist ));\n\n const { context, actions } = parseNonRemediations( authClient, idxResponse, toPersist );\n\n return {\n remediations,\n context,\n actions,\n };\n};\n"],"mappings":";;;;AAgBA;AACA;AACA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACuD;;AAKvD,MAAMA,WAAW,GAAGC,MAAM,CAACC,WAAW,CAAC,CACrC,aAAa;AAAE;AACf,SAAS,CAAE;AAAA,CACZ,CAACC,GAAG,CAAGC,KAAK,IAAK,CAAEA,KAAK,EAA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EAAE0B,UAAU,CAAC,CAAC;IAC1E;EACF,CAAC,CAAC;AACJ,CAAC;AAED,MAAMC,wBAAwB,GAAG,CAAC5B,UAAgC,EAAE6B,WAAW,EAAE3B,SAAS,KAAK;EAC7F;EACA,IAAI2B,WAAW,CAACpB,GAAG,EAAE;IACnB,MAAMqB,kBAAkB,GAAG,IAAAC,+CAA4B,EAAE/B,UAAU,EAAE,CAAC6B,WAAW,CAAC,EAAE3B,SAAS,CAAE;IAC/F,MAAM8B,QAAQ,GAAGF,kBAAkB,CAACD,WAAW,CAACnB,IAAI,CAAC;IACrD,OAAO;MACL,GAAGmB,WAAW;MACdI,MAAM,EAAED;IACV,CAAC;EACH;EAEA,OAAOH,WAAW;AACpB,CAAC;AAEM,MAAMK,gBAAgB,GAAG,SAASA,gBAAgB,CAAElC,UAAgC,EAAEC,WAAW,EAAEC,SAAS,GAAG,CAAC,CAAC,EAItH;EAAA;EACA,MAAMiC,eAAe,GAAG,0BAAAlC,WAAW,CAAC4B,WAAW,0DAAvB,sBAAyBjB,KAAK,KAAI,EAAE;EAE5DuB,eAAe,CAAC5B,OAAO,CACrBsB,WAAW,IAAIX,eAAe,CAACjB,WAAW,EAAE4B,WAAW,CAAC,CACzD;EAED,MAAMO,YAAY,GAAGD,eAAe,CAACtC,GAAG,CAACgC,WAAW,IAAID,wBAAwB,CAAE5B,UAAU,EAAE6B,WAAW,EAAE3B,SAAS,CAAE,CAAC;EAEvH,MAAM;IAAEE,OAAO;IAAED;EAAQ,CAAC,GAAGJ,oBAAoB,CAAEC,UAAU,EAAEC,WAAW,EAAEC,SAAS,CAAE;EAEvF,OAAO;IACLkC,YAAY;IACZhC,OAAO;IACPD;EACF,CAAC;AACH,CAAC;AAAC"}
1
+ {"version":3,"file":"idxResponseParser.js","names":["SKIP_FIELDS","Object","fromEntries","map","field","parseNonRemediations","authClient","idxResponse","toPersist","actions","context","keys","filter","forEach","fieldIsObject","rel","name","generateIdxAction","value","fieldValue","type","info","entries","subField","expandRelatesTo","k","query","Array","isArray","result","jsonpath","path","json","innerValue","convertRemediationAction","remediation","remediationActions","generateRemediationFunctions","actionFn","action","parseIdxResponse","remediationData","remediations"],"sources":["../../../../../lib/idx/idxState/v1/idxResponseParser.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-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 max-len */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\nimport { OktaAuthIdxInterface } from '../../types'; // auth-js/types\nimport { generateRemediationFunctions } from './remediationParser';\nimport generateIdxAction from './generateIdxAction';\nimport { jsonpath } from '../../../util/jsonpath';\n\nconst SKIP_FIELDS = Object.fromEntries([\n 'remediation', // remediations are put into proceed/neededToProceed\n 'context', // the API response of 'context' isn't externally useful. We ignore it and put all non-action (contextual) info into idxState.context\n].map( (field) => [ field, !!'skip this field' ] ));\n\nexport const parseNonRemediations = function parseNonRemediations( authClient: OktaAuthIdxInterface, idxResponse, toPersist = {} ) {\n const actions = {};\n const context = {};\n\n Object.keys(idxResponse)\n .filter( field => !SKIP_FIELDS[field])\n .forEach( field => {\n const fieldIsObject = typeof idxResponse[field] === 'object' && !!idxResponse[field];\n\n if ( !fieldIsObject ) {\n // simple fields are contextual info\n context[field] = idxResponse[field];\n return;\n }\n\n if ( idxResponse[field].rel ) {\n // top level actions\n actions[idxResponse[field].name] = generateIdxAction(authClient, idxResponse[field], toPersist);\n return;\n }\n\n const { value: fieldValue, type, ...info} = idxResponse[field];\n context[field] = { type, ...info}; // add the non-action parts as context\n\n if ( type !== 'object' ) {\n // only object values hold actions\n context[field].value = fieldValue;\n return;\n }\n\n // We are an object field containing an object value\n context[field].value = {};\n Object.entries(fieldValue)\n .forEach( ([subField, value]) => {\n if (value.rel) { // is [field].value[subField] an action?\n // add any \"action\" value subfields to actions\n actions[`${field}-${subField.name || subField}`] = generateIdxAction(authClient, value, toPersist);\n } else {\n // add non-action value subfields to context\n context[field].value[subField] = value;\n }\n });\n });\n\n return { context, actions };\n};\n\nconst expandRelatesTo = (idxResponse, value) => {\n Object.keys(value).forEach(k => {\n if (k === 'relatesTo') {\n const query = Array.isArray(value[k]) ? value[k][0] : value[k];\n if (typeof query === 'string') {\n const result = jsonpath({ path: query, json: idxResponse })[0];\n if (result) {\n value[k] = result;\n return;\n }\n }\n }\n if (Array.isArray(value[k])) {\n value[k].forEach(innerValue => expandRelatesTo(idxResponse, innerValue));\n }\n });\n};\n\nconst convertRemediationAction = (authClient: OktaAuthIdxInterface, remediation, toPersist) => {\n // Only remediation that has `rel` field (indicator for form submission) can have http action\n if (remediation.rel) {\n const remediationActions = generateRemediationFunctions( authClient, [remediation], toPersist );\n const actionFn = remediationActions[remediation.name];\n return {\n ...remediation,\n action: actionFn,\n };\n }\n\n return remediation;\n};\n\nexport const parseIdxResponse = function parseIdxResponse( authClient: OktaAuthIdxInterface, idxResponse, toPersist = {} ): {\n remediations: IdxRemediation[];\n context: IdxContext;\n actions: IdxActions;\n} {\n const remediationData = idxResponse.remediation?.value || [];\n\n remediationData.forEach(\n remediation => expandRelatesTo(idxResponse, remediation)\n );\n\n const remediations = remediationData.map(remediation => convertRemediationAction( authClient, remediation, toPersist ));\n\n const { context, actions } = parseNonRemediations( authClient, idxResponse, toPersist );\n\n return {\n remediations,\n context,\n actions,\n };\n};\n"],"mappings":";;;;AAgBA;AACA;AACA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACuD;;AAKvD,MAAMA,WAAW,GAAGC,MAAM,CAACC,WAAW,CAAC,CACr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x","createIdxAPI","webauthn"],"sources":["../../../lib/idx/mixin.ts"],"sourcesContent":["import { OktaAuthConstructor } from '../base/types';\nimport { OktaAuthOAuthInterface } from '../oidc/types';\nimport { IdxAPI, IdxTransactionManagerInterface, OktaAuthIdxInterface, OktaAuthIdxOptions } from './types';\nimport { IdxTransactionMeta } from './types/meta';\nimport { IdxStorageManagerInterface } from './types/storage';\nimport { createIdxAPI } from './factory/api';\nimport { WebauthnAPI } from './webauthn';\nimport * as webauthn from './webauthn';\n\nexport function mixinIdx\n<\n M extends IdxTransactionMeta = IdxTransactionMeta,\n S extends IdxStorageManagerInterface<M> = IdxStorageManagerInterface<M>,\n O extends OktaAuthIdxOptions = OktaAuthIdxOptions,\n TM extends IdxTransactionManagerInterface = IdxTransactionManagerInterface,\n TBase extends OktaAuthConstructor<OktaAuthOAuthInterface<M, S, O, TM>>\n = OktaAuthConstructor<OktaAuthOAuthInterface<M, S, O, TM>>\n>\n(Base: TBase): TBase & OktaAuthConstructor<OktaAuthIdxInterface<M, S, O, TM>>\n{\n return class OktaAuthIdx extends Base implements OktaAuthIdxInterface<M, S, O, TM>\n {\n idx: IdxAPI;\n static webauthn: WebauthnAPI = webauthn;\n \n constructor(...args: any[]) {\n super(...args);\n this.idx = createIdxAPI(this);\n }\n };\n}\n"],"mappings":";;;;;AAKA;AAEA;AAAuC;AAAA;AAEhC,SAASA,QAAQ,CASvBC,IAAW,EACZ;EAAA;EACE,gBAAO,MAAMC,WAAW,SAASD,IAAI,CACrC;IAIEE,WAAW,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAGA,IAAI,CAAC;MACd,IAAI,CAACC,GAAG,GAAG,IAAAC,iBAAY,EAAC,IAAI,CAAC;IAC/B;EACF,CAAC,oDANgCC,QAAQ;AAO3C"}
1
+ {"version":3,"file":"mixin.js","names":["mixinIdx","Base","OktaAuthIdx","constructor","args","idx","createIdxAPI","webauthn"],"sources":["../../../lib/idx/mixin.ts"],"sourcesContent":["import { OktaAuthConstructor } from '../base/types';\nimport { OktaAuthOAuthInterface } from '../oidc/types';\nimport {\n IdxAPI, \n IdxTransactionManagerInterface, \n OktaAuthIdxInterface, \n OktaAuthIdxConstructor, \n OktaAuthIdxOptions, \n WebauthnAPI\n} from './types';\nimport { IdxTransactionMeta } from './types/meta';\nimport { IdxStorageManagerInterface } from './types/storage';\nimport { createIdxAPI } from './factory/api';\nimport * as webauthn from './webauthn';\n\nexport function mixinIdx\n<\n M extends IdxTransactionMeta = IdxTransactionMeta,\n S extends IdxStorageManagerInterface<M> = IdxStorageManagerInterface<M>,\n O extends OktaAuthIdxOptions = OktaAuthIdxOptions,\n TM extends IdxTransactionManagerInterface = IdxTransactionManagerInterface,\n TBase extends OktaAuthConstructor<OktaAuthOAuthInterface<M, S, O, TM>>\n = OktaAuthConstructor<OktaAuthOAuthInterface<M, S, O, TM>>\n>\n(Base: TBase): TBase & OktaAuthIdxConstructor<OktaAuthIdxInterface<M, S, O, TM>>\n{\n return class OktaAuthIdx extends Base implements OktaAuthIdxInterface<M, S, O, TM>\n {\n idx: IdxAPI;\n static webauthn: WebauthnAPI = webauthn;\n \n constructor(...args: any[]) {\n super(...args);\n this.idx = createIdxAPI(this);\n }\n };\n}\n"],"mappings":";;;;;AAYA;AACA;AAAuC;AAAA;AAEhC,SAASA,QAAQ,CASvBC,IAAW,EACZ;EAAA;EACE,gBAAO,MAAMC,WAAW,SAASD,IAAI,CACrC;IAIEE,WAAW,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAGA,IAAI,CAAC;MACd,IAAI,CAACC,GAAG,GAAG,IAAAC,iBAAY,EAAC,IAAI,CAAC;IAC/B;EACF,CAAC,oDANgCC,QAAQ;AAO3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","names":["IdxStatus","AuthenticatorKey","IdxFeature","isAuthenticator","obj","key","id"],"sources":["../../../../lib/idx/types/api.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-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 { APIError } from '../../errors/types';\nimport {\n OktaAuthOAuthInterface,\n Tokens,\n TransactionManagerConstructor,\n TransactionManagerInterface\n} from '../../oidc/types';\nimport { FlowIdentifier } from './FlowIdentifier';\nimport {\n IdxActions,\n IdxAuthenticator,\n IdxContext,\n IdxForm,\n IdxMessage,\n IdxOption,\n IdxRemediation,\n IdxResponse,\n RawIdxResponse,\n IdxActionParams,\n IdpConfig,\n IdxToPersist,\n} from './idx-js';\nimport {\n AccountUnlockOptions,\n AuthenticationOptions,\n CancelOptions,\n InteractOptions,\n IntrospectOptions,\n OktaAuthIdxOptions,\n PasswordRecoveryOptions,\n ProceedOptions,\n RegistrationOptions,\n StartOptions,\n IdxTransactionMetaOptions\n} from './options';\nimport { IdxTransactionMeta } from './meta';\nimport { IdxStorageManagerInterface, SavedIdxResponse } from './storage';\n\nexport enum IdxStatus {\n SUCCESS = 'SUCCESS',\n PENDING = 'PENDING',\n FAILURE = 'FAILURE',\n TERMINAL = 'TERMINAL',\n CANCELED = 'CANCELED',\n}\n\nexport enum AuthenticatorKey {\n OKTA_PASSWORD = 'okta_password',\n OKTA_EMAIL = 'okta_email',\n PHONE_NUMBER = 'phone_number',\n GOOGLE_AUTHENTICATOR = 'google_otp',\n SECURITY_QUESTION = 'security_question',\n OKTA_VERIFY = 'okta_verify',\n WEBAUTHN = 'webauthn',\n}\n\nexport type Input = {\n name: string;\n key?: string;\n type?: string;\n label?: string;\n value?: string | {form: IdxForm} | Input[];\n minLength?: number;\n maxLength?: number;\n secret?: boolean;\n required?: boolean;\n options?: IdxOption[];\n mutable?: boolean;\n visible?: boolean;\n}\n\n\nexport interface IdxPollOptions {\n required?: boolean;\n refresh?: number;\n}\n\nexport type NextStep = {\n name: string;\n authenticator?: IdxAuthenticator;\n canSkip?: boolean;\n canResend?: boolean;\n inputs?: Input[];\n poll?: IdxPollOptions;\n authenticatorEnrollments?: IdxAuthenticator[];\n // eslint-disable-next-line no-use-before-define\n action?: (params?: IdxActionParams) => Promise<IdxTransaction>;\n idp?: IdpConfig;\n href?: string;\n relatesTo?: {\n type?: string;\n value: IdxAuthenticator;\n };\n refresh?: number;\n}\n\nexport enum IdxFeature {\n PASSWORD_RECOVERY = 'recover-password',\n REGISTRATION = 'enroll-profile',\n SOCIAL_IDP = 'redirect-idp',\n ACCOUNT_UNLOCK = 'unlock-account',\n}\n\n\nexport interface IdxTransaction {\n status: IdxStatus;\n tokens?: Tokens;\n nextStep?: NextStep;\n messages?: IdxMessage[];\n error?: APIError | IdxResponse;\n meta?: IdxTransactionMeta;\n enabledFeatures?: IdxFeature[];\n availableSteps?: NextStep[];\n requestDidSucceed?: boolean;\n stepUp?: boolean;\n \n // from idx-js, used by signin widget\n proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;\n neededToProceed: IdxRemediation[];\n rawIdxState: RawIdxResponse;\n interactionCode?: string;\n actions: IdxActions;\n context: IdxContext;\n}\n\n\nexport type Authenticator = {\n id?: string;\n key?: string;\n methodType?: string;\n phoneNumber?: string;\n channel?: string;\n};\n\nexport function isAuthenticator(obj: any): obj is Authenticator {\n return obj && (obj.key || obj.id);\n}\n\nexport interface RemediationResponse {\n idxResponse: IdxResponse;\n nextStep?: NextStep;\n messages?: IdxMessage[];\n terminal?: boolean;\n canceled?: boolean;\n}\n\nexport interface InteractResponse {\n state?: string;\n interactionHandle: string;\n meta: IdxTransactionMeta;\n}\n\nexport interface EmailVerifyCallbackResponse {\n state: string;\n otp: string;\n}\n\nexport interface IdxAPI {\n // lowest level api\n interact: (options?: InteractOptions) => Promise<InteractResponse>;\n introspect: (options?: IntrospectOptions) => Promise<IdxResponse>;\n makeIdxResponse: (rawIdxResponse: RawIdxResponse, toPersist: IdxToPersist, requestDidSucceed: boolean) => IdxResponse;\n\n // flow entrypoints\n authenticate: (options?: AuthenticationOptions) => Promise<IdxTransaction>;\n register: (options?: RegistrationOptions) => Promise<IdxTransaction>;\n recoverPassword: (options?: PasswordRecoveryOptions) => Promise<IdxTransaction>;\n unlockAccount: (options?: AccountUnlockOptions) => Promise<IdxTransaction>;\n poll: (options?: IdxPollOptions) => Promise<IdxTransaction>;\n\n // flow control\n start: (options?: StartOptions) => Promise<IdxTransaction>;\n canProceed(options?: ProceedOptions): boolean;\n proceed: (options?: ProceedOptions) => Promise<IdxTransaction>;\n cancel: (options?: CancelOptions) => Promise<IdxTransaction>;\n getFlow(): FlowIdentifier | undefined;\n setFlow(flow: FlowIdentifier): void;\n\n // call `start` instead of `startTransaction`. `startTransaction` will be removed in next major version (7.0)\n startTransaction: (options?: StartOptions) => Promise<IdxTransaction>;\n\n // redirect callbacks\n isInteractionRequired: (hashOrSearch?: string) => boolean;\n isInteractionRequiredError: (error: Error) => boolean; \n handleInteractionCodeRedirect: (url: string) => Promise<void>;\n isEmailVerifyCallback: (search: string) => boolean;\n parseEmailVerifyCallback: (search: string) => EmailVerifyCallbackResponse;\n handleEmailVerifyCallback: (search: string) => Promise<IdxTransaction | undefined>;\n isEmailVerifyCallbackError: (error: Error) => boolean;\n\n // transaction meta\n getSavedTransactionMeta: (options?: IdxTransactionMetaOptions) => IdxTransactionMeta | undefined;\n createTransactionMeta: (options?: IdxTransactionMetaOptions) => Promise<IdxTransactionMeta>;\n getTransactionMeta: (options?: IdxTransactionMetaOptions) => Promise<IdxTransactionMeta>;\n saveTransactionMeta: (meta: unknown) => void;\n clearTransactionMeta: () => void;\n isTransactionMetaValid: (meta: unknown) => boolean;\n}\n\nexport interface IdxTransactionManagerInterface extends TransactionManagerInterface {\n saveIdxResponse(data: SavedIdxResponse): void;\n loadIdxResponse(options?: IntrospectOptions): SavedIdxResponse | null;\n clearIdxResponse(): void;\n}\n\nexport type IdxTransactionManagerConstructor = TransactionManagerConstructor<IdxTransactionManagerInterface>;\n\nexport interface OktaAuthIdxInterface\n<\n M extends IdxTransactionMeta = IdxTransactionMeta,\n S extends IdxStorageManagerInterface<M> = IdxStorageManagerInterface<M>,\n O extends OktaAuthIdxOptions = OktaAuthIdxOptions,\n TM extends IdxTransactionManagerInterface = IdxTransactionManagerInterface\n>\n extends OktaAuthOAuthInterface<M, S, O, TM>\n{\n idx: IdxAPI;\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAVA,IAkDYA,SAAS;AAAA;AAAA,WAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;AAAA,GAATA,SAAS,yBAATA,SAAS;AAAA,IAQTC,gBAAgB;AAAA;AAAA,WAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;AAAA,GAAhBA,gBAAgB,gCAAhBA,gBAAgB;AAAA,IAkDhBC,UAAU;AAAA;AAAA,WAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,0BAAVA,UAAU;AAsCf,SAASC,eAAe,CAACC,GAAQ,EAAwB;EAC9D,OAAOA,GAAG,KAAKA,GAAG,CAACC,GAAG,IAAID,GAAG,CAACE,EAAE,CAAC;AACnC"}
1
+ {"version":3,"file":"api.js","names":["IdxStatus","AuthenticatorKey","IdxFeature","isAuthenticator","obj","key","id"],"sources":["../../../../lib/idx/types/api.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-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 { APIError } from '../../errors/types';\nimport {\n OktaAuthOAuthInterface,\n Tokens,\n TransactionManagerConstructor,\n TransactionManagerInterface\n} from '../../oidc/types';\nimport { FlowIdentifier } from './FlowIdentifier';\nimport {\n IdxActions,\n IdxAuthenticator,\n IdxContext,\n IdxForm,\n IdxMessage,\n IdxOption,\n IdxRemediation,\n IdxResponse,\n RawIdxResponse,\n IdxActionParams,\n IdpConfig,\n IdxToPersist,\n ChallengeData,\n ActivationData,\n} from './idx-js';\nimport {\n AccountUnlockOptions,\n AuthenticationOptions,\n CancelOptions,\n InteractOptions,\n IntrospectOptions,\n OktaAuthIdxOptions,\n PasswordRecoveryOptions,\n ProceedOptions,\n RegistrationOptions,\n StartOptions,\n IdxTransactionMetaOptions\n} from './options';\nimport { IdxTransactionMeta } from './meta';\nimport { IdxStorageManagerInterface, SavedIdxResponse } from './storage';\nimport type {\n WebauthnEnrollValues,\n WebauthnVerificationValues\n} from '../authenticator';\nimport { OktaAuthConstructor } from '../../base/types';\n\nexport enum IdxStatus {\n SUCCESS = 'SUCCESS',\n PENDING = 'PENDING',\n FAILURE = 'FAILURE',\n TERMINAL = 'TERMINAL',\n CANCELED = 'CANCELED',\n}\n\nexport enum AuthenticatorKey {\n OKTA_PASSWORD = 'okta_password',\n OKTA_EMAIL = 'okta_email',\n PHONE_NUMBER = 'phone_number',\n GOOGLE_AUTHENTICATOR = 'google_otp',\n SECURITY_QUESTION = 'security_question',\n OKTA_VERIFY = 'okta_verify',\n WEBAUTHN = 'webauthn',\n}\n\nexport type Input = {\n name: string;\n key?: string;\n type?: string;\n label?: string;\n value?: string | {form: IdxForm} | Input[];\n minLength?: number;\n maxLength?: number;\n secret?: boolean;\n required?: boolean;\n options?: IdxOption[];\n mutable?: boolean;\n visible?: boolean;\n}\n\n\nexport interface IdxPollOptions {\n required?: boolean;\n refresh?: number;\n}\n\nexport type NextStep = {\n name: string;\n authenticator?: IdxAuthenticator;\n canSkip?: boolean;\n canResend?: boolean;\n inputs?: Input[];\n poll?: IdxPollOptions;\n authenticatorEnrollments?: IdxAuthenticator[];\n // eslint-disable-next-line no-use-before-define\n action?: (params?: IdxActionParams) => Promise<IdxTransaction>;\n idp?: IdpConfig;\n href?: string;\n relatesTo?: {\n type?: string;\n value: IdxAuthenticator;\n };\n refresh?: number;\n}\n\nexport enum IdxFeature {\n PASSWORD_RECOVERY = 'recover-password',\n REGISTRATION = 'enroll-profile',\n SOCIAL_IDP = 'redirect-idp',\n ACCOUNT_UNLOCK = 'unlock-account',\n}\n\n\nexport interface IdxTransaction {\n status: IdxStatus;\n tokens?: Tokens;\n nextStep?: NextStep;\n messages?: IdxMessage[];\n error?: APIError | IdxResponse;\n meta?: IdxTransactionMeta;\n enabledFeatures?: IdxFeature[];\n availableSteps?: NextStep[];\n requestDidSucceed?: boolean;\n stepUp?: boolean;\n \n // from idx-js, used by signin widget\n proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;\n neededToProceed: IdxRemediation[];\n rawIdxState: RawIdxResponse;\n interactionCode?: string;\n actions: IdxActions;\n context: IdxContext;\n}\n\n\nexport type Authenticator = {\n id?: string;\n key?: string;\n methodType?: string;\n phoneNumber?: string;\n channel?: string;\n};\n\nexport function isAuthenticator(obj: any): obj is Authenticator {\n return obj && (obj.key || obj.id);\n}\n\nexport interface RemediationResponse {\n idxResponse: IdxResponse;\n nextStep?: NextStep;\n messages?: IdxMessage[];\n terminal?: boolean;\n canceled?: boolean;\n}\n\nexport interface InteractResponse {\n state?: string;\n interactionHandle: string;\n meta: IdxTransactionMeta;\n}\n\nexport interface EmailVerifyCallbackResponse {\n state: string;\n otp: string;\n}\n\nexport interface IdxAPI {\n // lowest level api\n interact: (options?: InteractOptions) => Promise<InteractResponse>;\n introspect: (options?: IntrospectOptions) => Promise<IdxResponse>;\n makeIdxResponse: (rawIdxResponse: RawIdxResponse, toPersist: IdxToPersist, requestDidSucceed: boolean) => IdxResponse;\n\n // flow entrypoints\n authenticate: (options?: AuthenticationOptions) => Promise<IdxTransaction>;\n register: (options?: RegistrationOptions) => Promise<IdxTransaction>;\n recoverPassword: (options?: PasswordRecoveryOptions) => Promise<IdxTransaction>;\n unlockAccount: (options?: AccountUnlockOptions) => Promise<IdxTransaction>;\n poll: (options?: IdxPollOptions) => Promise<IdxTransaction>;\n\n // flow control\n start: (options?: StartOptions) => Promise<IdxTransaction>;\n canProceed(options?: ProceedOptions): boolean;\n proceed: (options?: ProceedOptions) => Promise<IdxTransaction>;\n cancel: (options?: CancelOptions) => Promise<IdxTransaction>;\n getFlow(): FlowIdentifier | undefined;\n setFlow(flow: FlowIdentifier): void;\n\n // call `start` instead of `startTransaction`. `startTransaction` will be removed in next major version (7.0)\n startTransaction: (options?: StartOptions) => Promise<IdxTransaction>;\n\n // redirect callbacks\n isInteractionRequired: (hashOrSearch?: string) => boolean;\n isInteractionRequiredError: (error: Error) => boolean; \n handleInteractionCodeRedirect: (url: string) => Promise<void>;\n isEmailVerifyCallback: (search: string) => boolean;\n parseEmailVerifyCallback: (search: string) => EmailVerifyCallbackResponse;\n handleEmailVerifyCallback: (search: string) => Promise<IdxTransaction | undefined>;\n isEmailVerifyCallbackError: (error: Error) => boolean;\n\n // transaction meta\n getSavedTransactionMeta: (options?: IdxTransactionMetaOptions) => IdxTransactionMeta | undefined;\n createTransactionMeta: (options?: IdxTransactionMetaOptions) => Promise<IdxTransactionMeta>;\n getTransactionMeta: (options?: IdxTransactionMetaOptions) => Promise<IdxTransactionMeta>;\n saveTransactionMeta: (meta: unknown) => void;\n clearTransactionMeta: () => void;\n isTransactionMetaValid: (meta: unknown) => boolean;\n}\n\nexport interface IdxTransactionManagerInterface extends TransactionManagerInterface {\n saveIdxResponse(data: SavedIdxResponse): void;\n loadIdxResponse(options?: IntrospectOptions): SavedIdxResponse | null;\n clearIdxResponse(): void;\n}\n\nexport type IdxTransactionManagerConstructor = TransactionManagerConstructor<IdxTransactionManagerInterface>;\n\nexport interface WebauthnAPI {\n getAssertion(credential: PublicKeyCredential): WebauthnVerificationValues;\n getAttestation(credential: PublicKeyCredential): WebauthnEnrollValues;\n buildCredentialRequestOptions(\n challengeData: ChallengeData, authenticatorEnrollments: IdxAuthenticator[]\n ): CredentialRequestOptions;\n buildCredentialCreationOptions(\n activationData: ActivationData, authenticatorEnrollments: IdxAuthenticator[]\n ): CredentialCreationOptions;\n}\n\nexport interface OktaAuthIdxInterface\n<\n M extends IdxTransactionMeta = IdxTransactionMeta,\n S extends IdxStorageManagerInterface<M> = IdxStorageManagerInterface<M>,\n O extends OktaAuthIdxOptions = OktaAuthIdxOptions,\n TM extends IdxTransactionManagerInterface = IdxTransactionManagerInterface\n>\n extends OktaAuthOAuthInterface<M, S, O, TM>\n{\n idx: IdxAPI;\n}\n\nexport interface OktaAuthIdxConstructor\n<\n I extends OktaAuthIdxInterface = OktaAuthIdxInterface\n>\n extends OktaAuthConstructor<I>\n{\n new(...args: any[]): I;\n webauthn: WebauthnAPI;\n}\n\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAVA,IAyDYA,SAAS;AAAA;AAAA,WAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;AAAA,GAATA,SAAS,yBAATA,SAAS;AAAA,IAQTC,gBAAgB;AAAA;AAAA,WAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;AAAA,GAAhBA,gBAAgB,gCAAhBA,gBAAgB;AAAA,IAkDhBC,UAAU;AAAA;AAAA,WAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;AAAA,GAAVA,UAAU,0BAAVA,UAAU;AAsCf,SAASC,eAAe,CAACC,GAAQ,EAAwB;EAC9D,OAAOA,GAAG,KAAKA,GAAG,CAACC,GAAG,IAAID,GAAG,CAACE,EAAE,CAAC;AACnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"webauthn.js","names":["getEnrolledCredentials","authenticatorEnrollments","credentials","forEach","enrollement","key","push","type","id","base64UrlToBuffer","credentialId","buildCredentialCreationOptions","activationData","publicKey","rp","user","name","displayName","challenge","pubKeyCredParams","attestation","authenticatorSelection","excludeCredentials","buildCredentialRequestOptions","challengeData","userVerification","allowCredentials","getAttestation","credential","response","clientData","bufferToBase64Url","clientDataJSON","attestationObject","getAssertion","authenticatorData","signatureData","signature"],"sources":["../../../lib/idx/webauthn.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\nimport { base64UrlToBuffer, bufferToBase64Url } from '../crypto/base64';\nimport {\n ActivationData,\n ChallengeData,\n IdxAuthenticator,\n WebauthnEnrollValues,\n WebauthnVerificationValues\n} from './types';\n\n\nexport interface WebauthnAPI {\n getAssertion(credential: PublicKeyCredential): WebauthnVerificationValues;\n getAttestation(credential: PublicKeyCredential): WebauthnEnrollValues;\n buildCredentialRequestOptions(\n challengeData: ChallengeData, authenticatorEnrollments: IdxAuthenticator[]\n ): CredentialRequestOptions;\n buildCredentialCreationOptions(\n activationData: ActivationData, authenticatorEnrollments: IdxAuthenticator[]\n ): CredentialCreationOptions;\n}\n\n\n// Get known credentials from list of enrolled authenticators\nconst getEnrolledCredentials = (authenticatorEnrollments: IdxAuthenticator[] = []) => {\n const credentials: PublicKeyCredentialDescriptor[] = [];\n authenticatorEnrollments.forEach((enrollement) => {\n if (enrollement.key === 'webauthn') {\n credentials.push({\n type: 'public-key',\n id: base64UrlToBuffer(enrollement.credentialId),\n });\n }\n });\n return credentials;\n};\n\n// Build options for navigator.credentials.create\n// https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create\nexport const buildCredentialCreationOptions = (\n activationData: ActivationData, authenticatorEnrollments: IdxAuthenticator[]\n) => {\n return {\n publicKey: {\n rp: activationData.rp,\n user: {\n id: base64UrlToBuffer(activationData.user.id),\n name: activationData.user.name,\n displayName: activationData.user.displayName\n },\n challenge: base64UrlToBuffer(activationData.challenge),\n pubKeyCredParams: activationData.pubKeyCredParams,\n attestation: activationData.attestation,\n authenticatorSelection: activationData.authenticatorSelection,\n excludeCredentials: getEnrolledCredentials(authenticatorEnrollments),\n }\n } as CredentialCreationOptions;\n};\n\n\n// Build options for navigator.credentials.get\n// https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get\nexport const buildCredentialRequestOptions = (\n challengeData: ChallengeData, authenticatorEnrollments: IdxAuthenticator[]\n) => {\n return {\n publicKey: {\n challenge: base64UrlToBuffer(challengeData.challenge),\n userVerification: challengeData.userVerification,\n allowCredentials: getEnrolledCredentials(authenticatorEnrollments),\n }\n } as CredentialRequestOptions;\n};\n\n// Build attestation for webauthn enroll\n// https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse\nexport const getAttestation = (credential: PublicKeyCredential) => {\n const response = credential.response as AuthenticatorAttestationResponse;\n const id = credential.id;\n const clientData = bufferToBase64Url(response.clientDataJSON);\n const attestation = bufferToBase64Url(response.attestationObject);\n return {\n id,\n clientData,\n attestation\n };\n};\n\n// Build assertion for webauthn verification\n// https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse\nexport const getAssertion = (credential: PublicKeyCredential) => {\n const response = credential.response as AuthenticatorAssertionResponse;\n const id = credential.id;\n const clientData = bufferToBase64Url(response.clientDataJSON);\n const authenticatorData = bufferToBase64Url(response.authenticatorData);\n const signatureData = bufferToBase64Url(response.signature);\n return {\n id,\n clientData,\n authenticatorData,\n signatureData\n };\n};\n"],"mappings":";;;AAYA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA;AACA,MAAMA,sBAAsB,GAAG,CAACC,wBAA4C,GAAG,EAAE,KAAK;EACpF,MAAMC,WAA4C,GAAG,EAAE;EACvDD,wBAAwB,CAACE,OAAO,CAAEC,WAAW,IAAK;IAChD,IAAIA,WAAW,CAACC,GAAG,KAAK,UAAU,EAAE;MAClCH,WAAW,CAACI,IAAI,CAAC;QACfC,IAAI,EAAE,YAAY;QAClBC,EAAE,EAAE,IAAAC,uBAAiB,EAACL,WAAW,CAACM,YAAY;MAChD,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;EACF,OAAOR,WAAW;AACpB,CAAC;;AAED;AACA;AACO,MAAMS,8BAA8B,GAAG,CAC5CC,cAA8B,EAAEX,wBAA4C,KACzE;EACH,OAAO;IACLY,SAAS,EAAE;MACTC,EAAE,EAAEF,cAAc,CAACE,EAAE;MACrBC,IAAI,EAAE;QACJP,EAAE,EAAE,IAAAC,uBAAiB,EAACG,cAAc,CAACG,IAAI,CAACP,EAAE,CAAC;QAC7CQ,IAAI,EAAEJ,cAAc,CAACG,IAAI,CAACC,IAAI;QAC9BC,WAAW,EAAEL,cAAc,CAACG,IAAI,CAACE;MACnC,CAAC;MACDC,SAAS,EAAE,IAAAT,uBAAiB,EAACG,cAAc,CAACM,SAAS,CAAC;MACtDC,gBAAgB,EAAEP,cAAc,CAACO,gBAAgB;MACjDC,WAAW,EAAER,cAAc,CAACQ,WAAW;MACvCC,sBAAsB,EAAET,cAAc,CAACS,sBAAsB;MAC7DC,kBAA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entials","authenticatorEnrollments","credentials","forEach","enrollement","key","push","type","id","base64UrlToBuffer","credentialId","buildCredentialCreationOptions","activationData","publicKey","rp","user","name","displayName","challenge","pubKeyCredParams","attestation","authenticatorSelection","excludeCredentials","buildCredentialRequestOptions","challengeData","userVerification","allowCredentials","getAttestation","credential","response","clientData","bufferToBase64Url","clientDataJSON","attestationObject","getAssertion","authenticatorData","signatureData","signature"],"sources":["../../../lib/idx/webauthn.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\nimport { base64UrlToBuffer, bufferToBase64Url } from '../crypto/base64';\nimport {\n ActivationData,\n ChallengeData,\n IdxAuthenticator,\n} from './types';\n\n\n// Get known credentials from list of enrolled authenticators\nconst getEnrolledCredentials = (authenticatorEnrollments: IdxAuthenticator[] = []) => {\n const credentials: PublicKeyCredentialDescriptor[] = [];\n authenticatorEnrollments.forEach((enrollement) => {\n if (enrollement.key === 'webauthn') {\n credentials.push({\n type: 'public-key',\n id: base64UrlToBuffer(enrollement.credentialId),\n });\n }\n });\n return credentials;\n};\n\n// Build options for navigator.credentials.create\n// https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create\nexport const buildCredentialCreationOptions = (\n activationData: ActivationData, authenticatorEnrollments: IdxAuthenticator[]\n) => {\n return {\n publicKey: {\n rp: activationData.rp,\n user: {\n id: base64UrlToBuffer(activationData.user.id),\n name: activationData.user.name,\n displayName: activationData.user.displayName\n },\n challenge: base64UrlToBuffer(activationData.challenge),\n pubKeyCredParams: activationData.pubKeyCredParams,\n attestation: activationData.attestation,\n authenticatorSelection: activationData.authenticatorSelection,\n excludeCredentials: getEnrolledCredentials(authenticatorEnrollments),\n }\n } as CredentialCreationOptions;\n};\n\n\n// Build options for navigator.credentials.get\n// https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/get\nexport const buildCredentialRequestOptions = (\n challengeData: ChallengeData, authenticatorEnrollments: IdxAuthenticator[]\n) => {\n return {\n publicKey: {\n challenge: base64UrlToBuffer(challengeData.challenge),\n userVerification: challengeData.userVerification,\n allowCredentials: getEnrolledCredentials(authenticatorEnrollments),\n }\n } as CredentialRequestOptions;\n};\n\n// Build attestation for webauthn enroll\n// https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse\nexport const getAttestation = (credential: PublicKeyCredential) => {\n const response = credential.response as AuthenticatorAttestationResponse;\n const id = credential.id;\n const clientData = bufferToBase64Url(response.clientDataJSON);\n const attestation = bufferToBase64Url(response.attestationObject);\n return {\n id,\n clientData,\n attestation\n };\n};\n\n// Build assertion for webauthn verification\n// https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAssertionResponse\nexport const getAssertion = (credential: PublicKeyCredential) => {\n const response = credential.response as AuthenticatorAssertionResponse;\n const id = credential.id;\n const clientData = bufferToBase64Url(response.clientDataJSON);\n const authenticatorData = bufferToBase64Url(response.authenticatorData);\n const signatureData = bufferToBase64Url(response.signature);\n return {\n id,\n clientData,\n authenticatorData,\n signatureData\n };\n};\n"],"mappings":";;;AAYA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA,MAAMA,sBAAsB,GAAG,CAACC,wBAA4C,GAAG,EAAE,KAAK;EACpF,MAAMC,WAA4C,GAAG,EAAE;EACvDD,wBAAwB,CAACE,OAAO,CAAEC,WAAW,IAAK;IAChD,IAAIA,WAAW,CAACC,GAAG,KAAK,UAAU,EAAE;MAClCH,WAAW,CAACI,IAAI,CAAC;QACfC,IAAI,EAAE,YAAY;QAClBC,EAAE,EAAE,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