@okta/okta-auth-js 7.1.1 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +93 -36
  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 +2 -1
  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 +6 -2
  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 +15 -0
  65. package/cjs/services/AutoRenewService.js.map +1 -1
  66. package/cjs/util/jsonpath.js +13 -0
  67. package/cjs/util/jsonpath.js.map +1 -0
  68. package/dist/okta-auth-js.authn.min.analyzer.html +2 -2
  69. package/dist/okta-auth-js.authn.min.js +1 -1
  70. package/dist/okta-auth-js.authn.min.js.map +1 -1
  71. package/dist/okta-auth-js.core.min.analyzer.html +2 -2
  72. package/dist/okta-auth-js.core.min.js +1 -1
  73. package/dist/okta-auth-js.core.min.js.map +1 -1
  74. package/dist/okta-auth-js.idx.min.analyzer.html +2 -2
  75. package/dist/okta-auth-js.idx.min.js +1 -1
  76. package/dist/okta-auth-js.idx.min.js.map +1 -1
  77. package/dist/okta-auth-js.min.analyzer.html +2 -2
  78. package/dist/okta-auth-js.min.js +1 -1
  79. package/dist/okta-auth-js.min.js.map +1 -1
  80. package/dist/okta-auth-js.myaccount.min.analyzer.html +2 -2
  81. package/dist/okta-auth-js.myaccount.min.js +1 -1
  82. package/dist/okta-auth-js.myaccount.min.js.map +1 -1
  83. package/esm/browser/core/mixin.js +3 -0
  84. package/esm/browser/core/mixin.js.map +1 -1
  85. package/esm/browser/exports/exports/authn.js +4 -1
  86. package/esm/browser/exports/exports/authn.js.map +1 -1
  87. package/esm/browser/exports/exports/core.js +4 -1
  88. package/esm/browser/exports/exports/core.js.map +1 -1
  89. package/esm/browser/exports/exports/default.js +7 -2
  90. package/esm/browser/exports/exports/default.js.map +1 -1
  91. package/esm/browser/exports/exports/idx.js +4 -1
  92. package/esm/browser/exports/exports/idx.js.map +1 -1
  93. package/esm/browser/exports/exports/myaccount.js +7 -2
  94. package/esm/browser/exports/exports/myaccount.js.map +1 -1
  95. package/esm/browser/http/OktaUserAgent.js +2 -2
  96. package/esm/browser/idx/IdxTransactionManager.js +1 -4
  97. package/esm/browser/idx/IdxTransactionManager.js.map +1 -1
  98. package/esm/browser/idx/factory/OktaAuthIdx.js.map +1 -1
  99. package/esm/browser/idx/idxState/v1/idxResponseParser.js +2 -2
  100. package/esm/browser/idx/idxState/v1/idxResponseParser.js.map +1 -1
  101. package/esm/browser/idx/mixin.js.map +1 -1
  102. package/esm/browser/idx/types/api.js.map +1 -1
  103. package/esm/browser/idx/webauthn.js.map +1 -1
  104. package/esm/browser/myaccount/api.js +1 -0
  105. package/esm/browser/myaccount/api.js.map +1 -1
  106. package/esm/browser/myaccount/emailApi.js.map +1 -1
  107. package/esm/browser/myaccount/passwordApi.js +56 -0
  108. package/esm/browser/myaccount/passwordApi.js.map +1 -0
  109. package/esm/browser/myaccount/phoneApi.js.map +1 -1
  110. package/esm/browser/myaccount/profileApi.js.map +1 -1
  111. package/esm/browser/myaccount/request.js +3 -1
  112. package/esm/browser/myaccount/request.js.map +1 -1
  113. package/esm/browser/myaccount/transactions/PasswordTransaction.js +73 -0
  114. package/esm/browser/myaccount/transactions/PasswordTransaction.js.map +1 -0
  115. package/esm/browser/myaccount/types.js +6 -1
  116. package/esm/browser/myaccount/types.js.map +1 -1
  117. package/esm/browser/oidc/TokenManager.js +5 -0
  118. package/esm/browser/oidc/TokenManager.js.map +1 -1
  119. package/esm/browser/oidc/endpoints/authorize.js +3 -2
  120. package/esm/browser/oidc/endpoints/authorize.js.map +1 -1
  121. package/esm/browser/oidc/enrollAuthenticator.js +36 -0
  122. package/esm/browser/oidc/enrollAuthenticator.js.map +1 -0
  123. package/esm/browser/oidc/factory/api.js +10 -12
  124. package/esm/browser/oidc/factory/api.js.map +1 -1
  125. package/esm/browser/oidc/getWithRedirect.js +6 -1
  126. package/esm/browser/oidc/getWithRedirect.js.map +1 -1
  127. package/esm/browser/oidc/handleOAuthResponse.js +3 -2
  128. package/esm/browser/oidc/handleOAuthResponse.js.map +1 -1
  129. package/esm/browser/oidc/mixin/index.js +6 -3
  130. package/esm/browser/oidc/mixin/index.js.map +1 -1
  131. package/esm/browser/oidc/types/TokenManager.js.map +1 -1
  132. package/esm/browser/oidc/util/defaultEnrollAuthenticatorParams.js +31 -0
  133. package/esm/browser/oidc/util/defaultEnrollAuthenticatorParams.js.map +1 -0
  134. package/esm/browser/oidc/util/enrollAuthenticatorMeta.js +33 -0
  135. package/esm/browser/oidc/util/enrollAuthenticatorMeta.js.map +1 -0
  136. package/esm/browser/oidc/util/prepareEnrollAuthenticatorParams.js +34 -0
  137. package/esm/browser/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -0
  138. package/esm/browser/package.json +1 -1
  139. package/esm/browser/services/AutoRenewService.js +14 -0
  140. package/esm/browser/services/AutoRenewService.js.map +1 -1
  141. package/esm/browser/util/jsonpath.js +21 -0
  142. package/esm/browser/util/jsonpath.js.map +1 -0
  143. package/esm/node/core/mixin.js +3 -0
  144. package/esm/node/core/mixin.js.map +1 -1
  145. package/esm/node/exports/exports/authn.js +4 -1
  146. package/esm/node/exports/exports/authn.js.map +1 -1
  147. package/esm/node/exports/exports/core.js +4 -1
  148. package/esm/node/exports/exports/core.js.map +1 -1
  149. package/esm/node/exports/exports/default.js +7 -2
  150. package/esm/node/exports/exports/default.js.map +1 -1
  151. package/esm/node/exports/exports/idx.js +4 -1
  152. package/esm/node/exports/exports/idx.js.map +1 -1
  153. package/esm/node/exports/exports/myaccount.js +7 -2
  154. package/esm/node/exports/exports/myaccount.js.map +1 -1
  155. package/esm/node/http/OktaUserAgent.js +2 -2
  156. package/esm/node/idx/IdxTransactionManager.js +1 -4
  157. package/esm/node/idx/IdxTransactionManager.js.map +1 -1
  158. package/esm/node/idx/factory/OktaAuthIdx.js.map +1 -1
  159. package/esm/node/idx/idxState/v1/idxResponseParser.js +2 -2
  160. package/esm/node/idx/idxState/v1/idxResponseParser.js.map +1 -1
  161. package/esm/node/idx/mixin.js.map +1 -1
  162. package/esm/node/idx/types/api.js.map +1 -1
  163. package/esm/node/idx/webauthn.js.map +1 -1
  164. package/esm/node/myaccount/api.js +1 -0
  165. package/esm/node/myaccount/api.js.map +1 -1
  166. package/esm/node/myaccount/emailApi.js.map +1 -1
  167. package/esm/node/myaccount/passwordApi.js +56 -0
  168. package/esm/node/myaccount/passwordApi.js.map +1 -0
  169. package/esm/node/myaccount/phoneApi.js.map +1 -1
  170. package/esm/node/myaccount/profileApi.js.map +1 -1
  171. package/esm/node/myaccount/request.js +3 -1
  172. package/esm/node/myaccount/request.js.map +1 -1
  173. package/esm/node/myaccount/transactions/PasswordTransaction.js +73 -0
  174. package/esm/node/myaccount/transactions/PasswordTransaction.js.map +1 -0
  175. package/esm/node/myaccount/types.js +6 -1
  176. package/esm/node/myaccount/types.js.map +1 -1
  177. package/esm/node/oidc/TokenManager.js +5 -0
  178. package/esm/node/oidc/TokenManager.js.map +1 -1
  179. package/esm/node/oidc/endpoints/authorize.js +3 -2
  180. package/esm/node/oidc/endpoints/authorize.js.map +1 -1
  181. package/esm/node/oidc/enrollAuthenticator.js +37 -0
  182. package/esm/node/oidc/enrollAuthenticator.js.map +1 -0
  183. package/esm/node/oidc/factory/api.js +10 -12
  184. package/esm/node/oidc/factory/api.js.map +1 -1
  185. package/esm/node/oidc/getWithRedirect.js +6 -1
  186. package/esm/node/oidc/getWithRedirect.js.map +1 -1
  187. package/esm/node/oidc/handleOAuthResponse.js +3 -2
  188. package/esm/node/oidc/handleOAuthResponse.js.map +1 -1
  189. package/esm/node/oidc/mixin/index.js +6 -3
  190. package/esm/node/oidc/mixin/index.js.map +1 -1
  191. package/esm/node/oidc/types/TokenManager.js.map +1 -1
  192. package/esm/node/oidc/util/defaultEnrollAuthenticatorParams.js +31 -0
  193. package/esm/node/oidc/util/defaultEnrollAuthenticatorParams.js.map +1 -0
  194. package/esm/node/oidc/util/enrollAuthenticatorMeta.js +33 -0
  195. package/esm/node/oidc/util/enrollAuthenticatorMeta.js.map +1 -0
  196. package/esm/node/oidc/util/prepareEnrollAuthenticatorParams.js +34 -0
  197. package/esm/node/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -0
  198. package/esm/node/package.json +1 -1
  199. package/esm/node/util/jsonpath.js +21 -0
  200. package/esm/node/util/jsonpath.js.map +1 -0
  201. package/package.json +5 -5
  202. package/types/lib/core/types/api.d.ts +1 -0
  203. package/types/lib/exports/default.d.ts +1 -1
  204. package/types/lib/exports/idx.d.ts +1 -1
  205. package/types/lib/idx/factory/OktaAuthIdx.d.ts +3 -3
  206. package/types/lib/idx/mixin.d.ts +2 -2
  207. package/types/lib/idx/types/api.d.ts +13 -1
  208. package/types/lib/idx/webauthn.d.ts +1 -7
  209. package/types/lib/myaccount/api.d.ts +1 -0
  210. package/types/lib/myaccount/emailApi.d.ts +7 -7
  211. package/types/lib/myaccount/passwordApi.d.ts +17 -0
  212. package/types/lib/myaccount/phoneApi.d.ts +6 -6
  213. package/types/lib/myaccount/profileApi.d.ts +3 -3
  214. package/types/lib/myaccount/transactions/PasswordTransaction.d.ts +13 -0
  215. package/types/lib/myaccount/transactions/index.d.ts +1 -0
  216. package/types/lib/myaccount/types.d.ts +17 -2
  217. package/types/lib/oidc/TokenManager.d.ts +1 -0
  218. package/types/lib/oidc/enrollAuthenticator.d.ts +14 -0
  219. package/types/lib/oidc/factory/api.d.ts +2 -1
  220. package/types/lib/oidc/types/TokenManager.d.ts +1 -0
  221. package/types/lib/oidc/types/api.d.ts +5 -4
  222. package/types/lib/oidc/types/endpoints.d.ts +18 -0
  223. package/types/lib/oidc/types/index.d.ts +1 -0
  224. package/types/lib/oidc/types/meta.d.ts +1 -1
  225. package/types/lib/oidc/types/options.d.ts +6 -1
  226. package/types/lib/oidc/types/proto.d.ts +1 -0
  227. package/types/lib/oidc/util/defaultEnrollAuthenticatorParams.d.ts +2 -0
  228. package/types/lib/oidc/util/enrollAuthenticatorMeta.d.ts +2 -0
  229. package/types/lib/oidc/util/index.d.ts +3 -0
  230. package/types/lib/oidc/util/prepareEnrollAuthenticatorParams.d.ts +2 -0
  231. package/types/lib/services/AutoRenewService.d.ts +1 -0
  232. package/types/lib/util/jsonpath.d.ts +2 -0
  233. package/umd/authn.js +1 -1
  234. package/umd/authn.js.map +1 -1
  235. package/umd/core.js +1 -1
  236. package/umd/core.js.map +1 -1
  237. package/umd/default.js +1 -1
  238. package/umd/default.js.map +1 -1
  239. package/umd/idx.js +1 -1
  240. package/umd/idx.js.map +1 -1
  241. package/umd/myaccount.js +1 -1
  242. package/umd/myaccount.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -1,11 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Features
6
+
7
+ - [#1333](https://github.com/okta/okta-auth-js/pull/1333) Adds support for MyAccount API password methods
8
+ - [#1324](https://github.com/okta/okta-auth-js/pull/1324) Adds `endpoints.authorize.enrollAuthenticator`. Adds `handleRedirect` and deprecates `handleLoginRedirect`.
9
+
10
+ ### Fixes
11
+
12
+ - [#1354](https://github.com/okta/okta-auth-js/pull/1354) Fixes token auto renew if token has expired before `AutoRenewService` start
13
+ - [#1359](https://github.com/okta/okta-auth-js/pull/1359) IDX: removes statehandle check when load saved idxResponse
14
+
3
15
  ## 7.1.1
4
16
 
5
17
  ### Fixes
6
18
 
7
19
  - [#1355](https://github.com/okta/okta-auth-js/pull/1355) Adds missing type `currentAuthenticatorEnrollment` to `IdxContext`
8
20
 
21
+ ## 7.1.0
22
+
23
+ ### Features
24
+
25
+ - [#1343](https://github.com/okta/okta-auth-js/pull/1343) Supports Step Up MFA against `/authorize` and `/interact` endpoints
26
+
27
+ # Other
28
+
29
+ - [#1342](https://github.com/okta/okta-auth-js/pull/1342) - fixes possible RCE in jsonpath-plus
30
+
9
31
  ## 7.0.2
10
32
 
11
33
  ### 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
  }
@@ -1174,7 +1177,7 @@ Check `window.location` to verify if the app is in OAuth callback state or not.
1174
1177
  if (authClient.isLoginRedirect()) {
1175
1178
  // callback flow
1176
1179
  try {
1177
- await authClient.handleLoginRedirect();
1180
+ await authClient.handleRedirect();
1178
1181
  } catch (e) {
1179
1182
  // log or display error details
1180
1183
  }
@@ -1186,12 +1189,23 @@ if (authClient.isLoginRedirect()) {
1186
1189
  ### `handleLoginRedirect(tokens?, originalUri?)`
1187
1190
 
1188
1191
  > :link: web browser only <br>
1189
- > :hourglass: async
1192
+ > :hourglass: async <br>
1193
+ > :warning: Deprecated, this method could be removed in next major release, use [sdk.handleRedirect](#handleredirectoriginaluri) instead.
1190
1194
 
1191
1195
  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
1196
 
1193
1197
  > **Note:** `handleLoginRedirect` throws `OAuthError` or `AuthSdkError` in case there are errors during token retrieval.
1194
1198
 
1199
+ ### `handleRedirect(originalUri?)`
1200
+
1201
+ > :link: web browser only <br>
1202
+ > :hourglass: async
1203
+
1204
+ 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.
1205
+ 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.
1206
+
1207
+ > **Note:** `handleRedirect` throws `OAuthError` or `AuthSdkError` in case there are errors during token retrieval or authenticator enrollment.
1208
+
1195
1209
  ### `setHeaders()`
1196
1210
 
1197
1211
  Can set (or unset) request headers after construction.
@@ -1238,7 +1252,7 @@ See [authn API](docs/authn.md#sessionsetcookieandredirectsessiontoken-redirectur
1238
1252
  #### `session.exists()`
1239
1253
 
1240
1254
  > :link: web browser only <br>
1241
- > :warning: This method requires access to [third party cookies] <br>(#third-party-cookies)
1255
+ > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1242
1256
  > :hourglass: async
1243
1257
 
1244
1258
  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 +1271,7 @@ authClient.session.exists()
1257
1271
  #### `session.get()`
1258
1272
 
1259
1273
  > :link: web browser only <br>
1260
- > :warning: This method requires access to [third party cookies] <br>(#third-party-cookies)
1274
+ > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1261
1275
  > :hourglass: async
1262
1276
 
1263
1277
  Gets the active [session](https://developer.okta.com/docs/api/resources/sessions#example).
@@ -1275,7 +1289,7 @@ authClient.session.get()
1275
1289
  #### `session.refresh()`
1276
1290
 
1277
1291
  > :link: web browser only <br>
1278
- > :warning: This method requires access to [third party cookies] <br>(#third-party-cookies)
1292
+ > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1279
1293
  > :hourglass: async
1280
1294
 
1281
1295
  Refresh the current session by extending its lifetime. This can be used as a keep-alive operation.
@@ -1298,8 +1312,7 @@ See detail in [IDX README](docs/idx.md)
1298
1312
 
1299
1313
  See detail in [MyAccount API README](docs/myaccount/README.md)
1300
1314
 
1301
-
1302
- ### `token`
1315
+ ### `endpoints`
1303
1316
 
1304
1317
  #### Authorize options
1305
1318
 
@@ -1315,39 +1328,71 @@ The following configuration options can be included in `token.getWithoutPrompt`,
1315
1328
  | `idp` | Identity provider to use if there is no Okta Session. |
1316
1329
  | `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
1330
  | `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. |
1331
+ | `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
1332
  | `maxAge` | Allowable elapsed time, in seconds, since the last time the end user was actively authenticated by Okta. |
1320
1333
  | `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. |
1334
+ | `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
1335
  | `loginHint` | A username to prepopulate if prompting for authentication. |
1322
1336
 
1323
1337
  For more details, see Okta's [Authorize Request API](https://developer.okta.com/docs/api/resources/oidc#request-parameters).
1324
1338
 
1339
+ #### `endpoints.authorize.enrollAuthenticator(options)`
1340
+
1341
+ > :link: web browser only <br>
1342
+ > [Early Access][early-access]
1343
+
1344
+ 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.
1345
+
1346
+ * `options` - See [Authorize options](#authorize-options)
1347
+
1348
+ Options that will be omitted: `scopes`, `nonce`.
1349
+
1350
+ Options that will be overridden: `responseType: 'none', prompt: 'enroll_authenticator'`.
1351
+
1352
+ Required options:
1353
+
1354
+ * `enrollAmrValues` - list of [authentication methods](https://self-issued.info/docs/draft-jones-oauth-amr-values-00.html) to allow the user to enroll in.
1355
+
1356
+ List of AMR values:
1357
+ | AMR Value | Authenticator |
1358
+ | ------------- | -------------------- |
1359
+ | `pwd` | Okta Password |
1360
+ | `kba` | Security question |
1361
+ | `email` | Okta Email |
1362
+ | `sms` | SMS |
1363
+ | `tel` | Voice call |
1364
+ | `duo` | DUO |
1365
+ | `symantec` | Symantec VIP |
1366
+ | `google_otp` | Google Authenticator |
1367
+ | `okta_verify` | Okta Verify |
1368
+ | `swk` | Custom App |
1369
+ | `pop` | WebAuthn |
1370
+ | `oath_otp` | On-Prem MFA |
1371
+ | `rsa` | RSA SecurID |
1372
+ | `yubikey` | Yubikey |
1373
+ | `otp` | Custom HOTP |
1374
+ | `fed` | External IdP |
1375
+ | `sc` + `swk` | SmartCard/PIV |
1376
+
1377
+ See [enroll_amr_values parameter details](https://developer.okta.com/docs/reference/api/oidc/#request-parameters) for more information.
1378
+
1379
+ * `acrValues` - must be `urn:okta:2fa:any:ifpossible`, which means the user is prompted for at least one factor before enrollment.
1380
+
1325
1381
  ##### Example
1326
1382
 
1327
1383
  ```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
- });
1384
+ try {
1385
+ authClient.endpoints.authorize.enrollAuthenticator({
1386
+ enrollAmrValues: ['okta_verify'],
1387
+ acrValues: 'urn:okta:2fa:any:ifpossible'
1388
+ })
1389
+ } catch(err) {
1390
+ // handle AuthSdkError
1391
+ }
1349
1392
  ```
1350
1393
 
1394
+ ### `token`
1395
+
1351
1396
  #### `token.getWithoutPrompt(options)`
1352
1397
 
1353
1398
  > :link: web browser only <br>
@@ -1358,11 +1403,22 @@ When you've obtained a sessionToken from the authorization flows, or a session a
1358
1403
 
1359
1404
  * `options` - See [Authorize options](#authorize-options)
1360
1405
 
1406
+ ##### Example
1407
+
1361
1408
  ```javascript
1362
1409
  authClient.token.getWithoutPrompt({
1363
1410
  responseType: 'id_token', // or array of types
1364
1411
  sessionToken: 'testSessionToken' // optional if the user has an existing Okta session
1365
- })
1412
+ scopes: [
1413
+ 'openid',
1414
+ 'email',
1415
+ 'profile'
1416
+ ],
1417
+ state: '8rFzn3MH5q',
1418
+ nonce: '51GePTswrm',
1419
+ // Use a custom IdP for social authentication
1420
+ idp: '0oa62b57p7c8PaGpU0h7'
1421
+ })
1366
1422
  .then(function(res) {
1367
1423
  var tokens = res.tokens;
1368
1424
 
@@ -1492,7 +1548,7 @@ console.log(decodedToken.header, decodedToken.payload, decodedToken.signature);
1492
1548
 
1493
1549
  #### `token.renew(tokenToRenew)`
1494
1550
 
1495
- > :warning: This method requires access to [third party cookies](#third-party-cookies)
1551
+ > :warning: This method requires access to [third party cookies](#third-party-cookies) <br>
1496
1552
  > :hourglass: async
1497
1553
 
1498
1554
  Returns a new token if the Okta [session](https://developer.okta.com/docs/api/resources/sessions#example) is still valid.
@@ -1597,6 +1653,7 @@ Returns a `TokenParams` object. If `PKCE` is enabled, this object will contain v
1597
1653
 
1598
1654
  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
1655
 
1656
+
1600
1657
  ### `tokenManager` API
1601
1658
 
1602
1659
  #### `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;A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I,IAAI,CAACG,cAAc,CAACF,KAAK,CAAC;UACvD,MAAM,IAAI,CAACK,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.2.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.2.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,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PA,OAAO,CAAEW,YAAY,EAAE;IACzB;EACF,CAAC;AACH"}
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","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.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,gBAAgB,KAAK,KAAK,EAAE;QACtC,IAAI,CAACA,gBAAgB,EAAE;MACzB;IACF;IAEAC,eAAe,CAACC,IAAsB,EAAQ;MAC5C,IAAI,CAAC,IAAI,CAACC,gBAAgB,EAAE;QAC1B;MACF;MACA,MAAMC,OAAO,GAAG,IAAI,CAACC,cAAc,CAACC,qBAAqB,EAAE;MAC3D,IAAI,CAACF,OAAO,EAAE;QACZ;MACF;MACAA,OAAO,CAACG,UAAU,CAACL,IAAI,CAAC;IAC1B;;IAEA;IACAM,eAAe,CAACV,OAA2B,EAA2B;MACpE,IAAI,CAAC,IAAI,CAACK,gBAAgB,EAAE;QAC1B,OAAO,IAAI;MACb;MACA,MAAMC,OAAO,GAAG,IAAI,CAACC,cAAc,CAACC,qBAAqB,EAAE;MAC3D,IAAI,CAACF,OAAO,EAAE;QACZ,OAAO,IAAI;MACb;MACA,MAAMK,WAAW,GAAGL,OAAO,CAACM,UAAU,EAAE;MACxC,IAAI,CAACD,WAAW,IAAI,CAAC,IAAAE,uBAAgB,EAACF,WAAW,CAACG,cAAc,CAAC,EAAE;QACjE,OAAO,IAAI;MACb;MAEA,IAAId,OAAO,EAAE;QACX,MAAM;UAAEe;QAAkB,CAAC,GAAGf,OAAO;QACrC,IAAIe,iBAAiB,IAAIJ,WAAW,CAACI,iBAAiB,KAAKA,iBAAiB,EAAE;UAC5E,OAAO,IAAI;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,CAA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AC,CAAC,CAACZ,OAAO,CAACoB,UAAU,IAAIT,eAAe,CAACjB,WAAW,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;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@@
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 { 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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AAC;AACH,CAAC;AAAC"}
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} 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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xB,MAAMsB,UAAU,GAAG,IAAAC,uBAAiB,EAACF,QAAQ,CAACG,cAAc,CAAC;EAC7D,MAAMZ,WAAW,GAAG,IAAAW,uBAAiB,EAACF,QAAQ,CAACI,iBAAiB,CAAC;EACjE,OAAO;IACLzB,EAAE;IACFsB,UAAU;IACVV;EACF,CAAC;AACH,CAAC;;AAED;AACA;AAAA;AACO,MAAMc,YAAY,GAAIN,UAA+B,IAAK;EAC/D,MAAMC,QAAQ,GAAGD,UAAU,CAACC,QAA0C;EACtE,MAAMrB,EAAE,GAAGoB,UAAU,CAACpB,EAAE;EACxB,MAAMsB,UAAU,GAAG,IAAAC,uBAAiB,EAACF,QAAQ,CAACG,cAAc,CAAC;EAC7D,MAAMG,iBAAiB,GAAG,IAAAJ,uBAAiB,EAACF,QAAQ,CAACM,iBAAiB,CAAC;EACvE,MAAMC,aAAa,GAAG,IAAAL,uBAAiB,EAACF,QAAQ,CAACQ,SAAS,CAAC;EAC3D,OAAO;IACL7B,EAAE;IACFsB,UAAU;IACVK,iBAAiB;IACjBC;EACF,CAAC;AACH,CAAC;AAAC"}
@@ -33,4 +33,15 @@ Object.keys(_phoneApi).forEach(function (key) {
33
33
  }
34
34
  });
35
35
  });
36
+ var _passwordApi = require("./passwordApi");
37
+ Object.keys(_passwordApi).forEach(function (key) {
38
+ if (key === "default" || key === "__esModule") return;
39
+ if (key in exports && exports[key] === _passwordApi[key]) return;
40
+ Object.defineProperty(exports, key, {
41
+ enumerable: true,
42
+ get: function () {
43
+ return _passwordApi[key];
44
+ }
45
+ });
46
+ });
36
47
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","names":[],"sources":["../../../lib/myaccount/api.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n// exports all public methods from myaccount module\n\nexport * from './profileApi';\nexport * from './emailApi';\nexport * from './phoneApi';\n"],"mappings":";;AAeA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"api.js","names":[],"sources":["../../../lib/myaccount/api.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\n// exports all public methods from myaccount module\n\nexport * from './profileApi';\nexport * from './emailApi';\nexport * from './phoneApi';\nexport * from './passwordApi';"],"mappings":";;AAeA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}