@okta/okta-auth-js 5.6.0 → 5.9.1
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.
- package/CHANGELOG.md +51 -0
- package/README.md +28 -1
- package/cjs/OktaAuth.js +69 -35
- package/cjs/OktaAuth.js.map +1 -1
- package/cjs/OktaUserAgent.js +2 -2
- package/cjs/StorageManager.js +8 -0
- package/cjs/StorageManager.js.map +1 -1
- package/cjs/TransactionManager.js +24 -12
- package/cjs/TransactionManager.js.map +1 -1
- package/cjs/builderUtil.js +6 -0
- package/cjs/builderUtil.js.map +1 -1
- package/cjs/constants.js +3 -1
- package/cjs/constants.js.map +1 -1
- package/cjs/features.js +1 -1
- package/cjs/features.js.map +1 -1
- package/cjs/idx/authenticate.js +3 -18
- package/cjs/idx/authenticate.js.map +1 -1
- package/cjs/idx/flow/AuthenticationFlow.js +30 -0
- package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
- package/cjs/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.js +0 -0
- package/cjs/idx/flow/AuthenticationFlowMonitor.js.map +1 -0
- package/cjs/idx/{flowMonitors → flow}/FlowMonitor.js +0 -0
- package/cjs/idx/flow/FlowMonitor.js.map +1 -0
- package/cjs/idx/flow/FlowSpecification.js +49 -0
- package/cjs/idx/flow/FlowSpecification.js.map +1 -0
- package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
- package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
- package/cjs/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.js +0 -0
- package/cjs/idx/flow/PasswordRecoveryFlowMonitor.js.map +1 -0
- package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +15 -12
- package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
- package/cjs/idx/{flowMonitors → flow}/RegistrationFlowMonitor.js +0 -0
- package/cjs/idx/flow/RegistrationFlowMonitor.js.map +1 -0
- package/cjs/idx/flow/RemediationFlow.js +2 -0
- package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
- package/cjs/idx/flow/index.js +119 -0
- package/cjs/idx/flow/index.js.map +1 -0
- package/cjs/idx/index.js +26 -0
- package/cjs/idx/index.js.map +1 -1
- package/cjs/idx/interact.js +5 -2
- package/cjs/idx/interact.js.map +1 -1
- package/cjs/idx/introspect.js +24 -7
- package/cjs/idx/introspect.js.map +1 -1
- package/cjs/idx/proceed.js +49 -0
- package/cjs/idx/proceed.js.map +1 -0
- package/cjs/idx/recoverPassword.js +3 -17
- package/cjs/idx/recoverPassword.js.map +1 -1
- package/cjs/idx/register.js +7 -16
- package/cjs/idx/register.js.map +1 -1
- package/cjs/idx/remediate.js +33 -37
- package/cjs/idx/remediate.js.map +1 -1
- package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js +3 -1
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/Identify.js +4 -2
- package/cjs/idx/remediators/Identify.js.map +1 -1
- package/cjs/idx/run.js +36 -8
- package/cjs/idx/run.js.map +1 -1
- package/cjs/idx/startTransaction.js +2 -0
- package/cjs/idx/startTransaction.js.map +1 -1
- package/cjs/idx/transactionMeta.js +77 -39
- package/cjs/idx/transactionMeta.js.map +1 -1
- package/cjs/idx/types/FlowIdentifier.js +2 -0
- package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
- package/cjs/idx/types/idx-js.js +5 -0
- package/cjs/idx/types/idx-js.js.map +1 -1
- package/cjs/idx/types/index.js +16 -0
- package/cjs/idx/types/index.js.map +1 -1
- package/cjs/oidc/endpoints/authorize.js +4 -1
- package/cjs/oidc/endpoints/authorize.js.map +1 -1
- package/cjs/oidc/getToken.js +14 -9
- package/cjs/oidc/getToken.js.map +1 -1
- package/cjs/oidc/getWithPopup.js +9 -2
- package/cjs/oidc/getWithPopup.js.map +1 -1
- package/cjs/oidc/getWithRedirect.js +2 -6
- package/cjs/oidc/getWithRedirect.js.map +1 -1
- package/cjs/oidc/renewTokens.js +28 -5
- package/cjs/oidc/renewTokens.js.map +1 -1
- package/cjs/oidc/util/browser.js +1 -13
- package/cjs/oidc/util/browser.js.map +1 -1
- package/cjs/oidc/util/loginRedirect.js +9 -5
- package/cjs/oidc/util/loginRedirect.js.map +1 -1
- package/cjs/oidc/util/urlParams.js +1 -1
- package/cjs/oidc/util/urlParams.js.map +1 -1
- package/cjs/options.js +12 -2
- package/cjs/options.js.map +1 -1
- package/cjs/server/serverStorage.js +2 -1
- package/cjs/server/serverStorage.js.map +1 -1
- package/cjs/tx/AuthTransaction.js +1 -3
- package/cjs/tx/AuthTransaction.js.map +1 -1
- package/cjs/tx/api.js +3 -0
- package/cjs/tx/api.js.map +1 -1
- package/cjs/types/Transaction.js.map +1 -1
- package/{esm/clock.js → cjs/util/emailVerify.js} +14 -18
- package/cjs/util/emailVerify.js.map +1 -0
- package/cjs/util/index.js +13 -0
- package/cjs/util/index.js.map +1 -1
- package/dist/okta-auth-js.min.js +2 -74
- package/dist/okta-auth-js.min.js.LICENSE.txt +32 -0
- package/dist/okta-auth-js.min.js.map +1 -1
- package/dist/okta-auth-js.polyfill.js +2 -18
- package/{esm/crypto/webcrypto.js → dist/okta-auth-js.polyfill.js.LICENSE.txt} +8 -4
- package/dist/okta-auth-js.polyfill.js.map +1 -1
- package/dist/okta-auth-js.umd.js +2 -74
- package/dist/okta-auth-js.umd.js.LICENSE.txt +32 -0
- package/dist/okta-auth-js.umd.js.map +1 -1
- package/esm/index.js +8368 -16
- package/esm/index.js.map +1 -1
- package/lib/OktaAuth.d.ts +7 -3
- package/lib/StorageManager.d.ts +1 -0
- package/lib/TransactionManager.d.ts +5 -1
- package/lib/constants.d.ts +1 -0
- package/lib/crypto/base64.d.ts +2 -2
- package/lib/crypto/oidcHash.d.ts +1 -1
- package/lib/crypto/verifyToken.d.ts +1 -1
- package/{esm/oidc/endpoints/index.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -5
- package/lib/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.d.ts +0 -0
- package/lib/idx/{flowMonitors → flow}/FlowMonitor.d.ts +0 -0
- package/lib/idx/flow/FlowSpecification.d.ts +10 -0
- package/{esm/crypto/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -6
- package/lib/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.d.ts +0 -0
- package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
- package/lib/idx/{flowMonitors → flow}/RegistrationFlowMonitor.d.ts +0 -0
- package/lib/idx/flow/RemediationFlow.d.ts +13 -0
- package/lib/idx/{flowMonitors → flow}/index.d.ts +7 -2
- package/lib/idx/index.d.ts +2 -0
- package/lib/idx/introspect.d.ts +2 -1
- package/{esm/errors/AuthApiError.js → lib/idx/proceed.d.ts} +9 -19
- package/lib/idx/remediators/Base/AuthenticatorData.d.ts +1 -4
- package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +1 -4
- package/lib/idx/remediators/Identify.d.ts +1 -0
- package/lib/idx/run.d.ts +9 -9
- package/lib/idx/transactionMeta.d.ts +28 -4
- package/lib/idx/types/FlowIdentifier.d.ts +1 -0
- package/lib/idx/types/idx-js.d.ts +4 -0
- package/lib/idx/types/index.d.ts +14 -3
- package/lib/oidc/getToken.d.ts +2 -2
- package/lib/oidc/renewTokens.d.ts +0 -12
- package/lib/oidc/util/loginRedirect.d.ts +1 -1
- package/lib/types/OktaAuthOptions.d.ts +2 -0
- package/lib/types/Transaction.d.ts +2 -0
- package/lib/types/api.d.ts +20 -5
- package/{esm/errors/AuthPollStopError.js → lib/util/emailVerify.d.ts} +5 -8
- package/lib/util/index.d.ts +1 -0
- package/package.json +26 -14
- package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/index.js +0 -54
- package/cjs/idx/flowMonitors/index.js.map +0 -1
- package/esm/AuthStateManager.js +0 -214
- package/esm/AuthStateManager.js.map +0 -1
- package/esm/OktaAuth.js +0 -679
- package/esm/OktaAuth.js.map +0 -1
- package/esm/OktaUserAgent.js +0 -49
- package/esm/OktaUserAgent.js.map +0 -1
- package/esm/PromiseQueue.js +0 -71
- package/esm/PromiseQueue.js.map +0 -1
- package/esm/SavedObject.js +0 -91
- package/esm/SavedObject.js.map +0 -1
- package/esm/StorageManager.js +0 -182
- package/esm/StorageManager.js.map +0 -1
- package/esm/TokenManager.js +0 -455
- package/esm/TokenManager.js.map +0 -1
- package/esm/TransactionManager.js +0 -316
- package/esm/TransactionManager.js.map +0 -1
- package/esm/browser/browserStorage.js +0 -256
- package/esm/browser/browserStorage.js.map +0 -1
- package/esm/browser/fingerprint.js +0 -74
- package/esm/browser/fingerprint.js.map +0 -1
- package/esm/builderUtil.js +0 -50
- package/esm/builderUtil.js.map +0 -1
- package/esm/clock.js.map +0 -1
- package/esm/constants.js +0 -35
- package/esm/constants.js.map +0 -1
- package/esm/crypto/base64.js +0 -66
- package/esm/crypto/base64.js.map +0 -1
- package/esm/crypto/browser.js.map +0 -1
- package/esm/crypto/index.js.map +0 -1
- package/esm/crypto/node.js +0 -54
- package/esm/crypto/node.js.map +0 -1
- package/esm/crypto/oidcHash.js +0 -27
- package/esm/crypto/oidcHash.js.map +0 -1
- package/esm/crypto/verifyToken.js +0 -39
- package/esm/crypto/verifyToken.js.map +0 -1
- package/esm/crypto/webcrypto.js.map +0 -1
- package/esm/errors/AuthApiError.js.map +0 -1
- package/esm/errors/AuthPollStopError.js.map +0 -1
- package/esm/errors/AuthSdkError.js +0 -29
- package/esm/errors/AuthSdkError.js.map +0 -1
- package/esm/errors/CustomError.js +0 -21
- package/esm/errors/CustomError.js.map +0 -1
- package/esm/errors/OAuthError.js +0 -22
- package/esm/errors/OAuthError.js.map +0 -1
- package/esm/errors/index.js +0 -22
- package/esm/errors/index.js.map +0 -1
- package/esm/features.js +0 -64
- package/esm/features.js.map +0 -1
- package/esm/fetch/fetchRequest.js +0 -92
- package/esm/fetch/fetchRequest.js.map +0 -1
- package/esm/http/headers.js +0 -17
- package/esm/http/headers.js.map +0 -1
- package/esm/http/index.js +0 -3
- package/esm/http/index.js.map +0 -1
- package/esm/http/request.js +0 -145
- package/esm/http/request.js.map +0 -1
- package/esm/idx/authenticate.js +0 -47
- package/esm/idx/authenticate.js.map +0 -1
- package/esm/idx/cancel.js +0 -32
- package/esm/idx/cancel.js.map +0 -1
- package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
- package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
- package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
- package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
- package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/index.js +0 -16
- package/esm/idx/flowMonitors/index.js.map +0 -1
- package/esm/idx/handleInteractionCodeRedirect.js +0 -64
- package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
- package/esm/idx/headers.js +0 -39
- package/esm/idx/headers.js.map +0 -1
- package/esm/idx/index.js +0 -20
- package/esm/idx/index.js.map +0 -1
- package/esm/idx/interact.js +0 -83
- package/esm/idx/interact.js.map +0 -1
- package/esm/idx/introspect.js +0 -45
- package/esm/idx/introspect.js.map +0 -1
- package/esm/idx/recoverPassword.js +0 -46
- package/esm/idx/recoverPassword.js.map +0 -1
- package/esm/idx/register.js +0 -63
- package/esm/idx/register.js.map +0 -1
- package/esm/idx/remediate.js +0 -302
- package/esm/idx/remediate.js.map +0 -1
- package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
- package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
- package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
- package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
- package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
- package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
- package/esm/idx/remediators/Base/Remediator.js +0 -221
- package/esm/idx/remediators/Base/Remediator.js.map +0 -1
- package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
- package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
- package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -63
- package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
- package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
- package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
- package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
- package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
- package/esm/idx/remediators/EnrollProfile.js +0 -79
- package/esm/idx/remediators/EnrollProfile.js.map +0 -1
- package/esm/idx/remediators/Identify.js +0 -86
- package/esm/idx/remediators/Identify.js.map +0 -1
- package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
- package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
- package/esm/idx/remediators/RedirectIdp.js +0 -38
- package/esm/idx/remediators/RedirectIdp.js.map +0 -1
- package/esm/idx/remediators/ResetAuthenticator.js +0 -18
- package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
- package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
- package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
- package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
- package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
- package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
- package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
- package/esm/idx/remediators/Skip.js +0 -23
- package/esm/idx/remediators/Skip.js.map +0 -1
- package/esm/idx/remediators/index.js +0 -26
- package/esm/idx/remediators/index.js.map +0 -1
- package/esm/idx/remediators/util.js +0 -35
- package/esm/idx/remediators/util.js.map +0 -1
- package/esm/idx/run.js +0 -201
- package/esm/idx/run.js.map +0 -1
- package/esm/idx/startTransaction.js +0 -27
- package/esm/idx/startTransaction.js.map +0 -1
- package/esm/idx/transactionMeta.js +0 -114
- package/esm/idx/transactionMeta.js.map +0 -1
- package/esm/idx/types/idx-js.js +0 -17
- package/esm/idx/types/idx-js.js.map +0 -1
- package/esm/idx/types/index.js +0 -44
- package/esm/idx/types/index.js.map +0 -1
- package/esm/oidc/decodeToken.js +0 -31
- package/esm/oidc/decodeToken.js.map +0 -1
- package/esm/oidc/endpoints/authorize.js +0 -61
- package/esm/oidc/endpoints/authorize.js.map +0 -1
- package/esm/oidc/endpoints/index.js.map +0 -1
- package/esm/oidc/endpoints/token.js +0 -97
- package/esm/oidc/endpoints/token.js.map +0 -1
- package/esm/oidc/endpoints/well-known.js +0 -58
- package/esm/oidc/endpoints/well-known.js.map +0 -1
- package/esm/oidc/exchangeCodeForTokens.js +0 -69
- package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
- package/esm/oidc/getToken.js +0 -175
- package/esm/oidc/getToken.js.map +0 -1
- package/esm/oidc/getUserInfo.js +0 -82
- package/esm/oidc/getUserInfo.js.map +0 -1
- package/esm/oidc/getWithPopup.js +0 -28
- package/esm/oidc/getWithPopup.js.map +0 -1
- package/esm/oidc/getWithRedirect.js +0 -65
- package/esm/oidc/getWithRedirect.js.map +0 -1
- package/esm/oidc/getWithoutPrompt.js +0 -29
- package/esm/oidc/getWithoutPrompt.js.map +0 -1
- package/esm/oidc/handleOAuthResponse.js +0 -148
- package/esm/oidc/handleOAuthResponse.js.map +0 -1
- package/esm/oidc/index.js +0 -29
- package/esm/oidc/index.js.map +0 -1
- package/esm/oidc/parseFromUrl.js +0 -144
- package/esm/oidc/parseFromUrl.js.map +0 -1
- package/esm/oidc/renewToken.js +0 -85
- package/esm/oidc/renewToken.js.map +0 -1
- package/esm/oidc/renewTokens.js +0 -52
- package/esm/oidc/renewTokens.js.map +0 -1
- package/esm/oidc/renewTokensWithRefresh.js +0 -55
- package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
- package/esm/oidc/revokeToken.js +0 -57
- package/esm/oidc/revokeToken.js.map +0 -1
- package/esm/oidc/util/browser.js +0 -85
- package/esm/oidc/util/browser.js.map +0 -1
- package/esm/oidc/util/defaultTokenParams.js +0 -42
- package/esm/oidc/util/defaultTokenParams.js.map +0 -1
- package/esm/oidc/util/errors.js +0 -31
- package/esm/oidc/util/errors.js.map +0 -1
- package/esm/oidc/util/index.js +0 -25
- package/esm/oidc/util/index.js.map +0 -1
- package/esm/oidc/util/loginRedirect.js +0 -84
- package/esm/oidc/util/loginRedirect.js.map +0 -1
- package/esm/oidc/util/oauth.js +0 -70
- package/esm/oidc/util/oauth.js.map +0 -1
- package/esm/oidc/util/pkce.js +0 -55
- package/esm/oidc/util/pkce.js.map +0 -1
- package/esm/oidc/util/prepareTokenParams.js +0 -75
- package/esm/oidc/util/prepareTokenParams.js.map +0 -1
- package/esm/oidc/util/refreshToken.js +0 -24
- package/esm/oidc/util/refreshToken.js.map +0 -1
- package/esm/oidc/util/urlParams.js +0 -54
- package/esm/oidc/util/urlParams.js.map +0 -1
- package/esm/oidc/util/validateClaims.js +0 -53
- package/esm/oidc/util/validateClaims.js.map +0 -1
- package/esm/oidc/util/validateToken.js +0 -21
- package/esm/oidc/util/validateToken.js.map +0 -1
- package/esm/oidc/verifyToken.js +0 -78
- package/esm/oidc/verifyToken.js.map +0 -1
- package/esm/options.js +0 -134
- package/esm/options.js.map +0 -1
- package/esm/server/serverStorage.js +0 -110
- package/esm/server/serverStorage.js.map +0 -1
- package/esm/services/TokenService.js +0 -103
- package/esm/services/TokenService.js.map +0 -1
- package/esm/session.js +0 -81
- package/esm/session.js.map +0 -1
- package/esm/tx/AuthTransaction.js +0 -215
- package/esm/tx/AuthTransaction.js.map +0 -1
- package/esm/tx/TransactionState.js.map +0 -1
- package/esm/tx/api.js +0 -84
- package/esm/tx/api.js.map +0 -1
- package/esm/tx/index.js +0 -18
- package/esm/tx/index.js.map +0 -1
- package/esm/tx/poll.js +0 -124
- package/esm/tx/poll.js.map +0 -1
- package/esm/tx/util.js +0 -26
- package/esm/tx/util.js.map +0 -1
- package/esm/types/AuthState.js +0 -3
- package/esm/types/Cookies.js +0 -3
- package/esm/types/EventEmitter.js +0 -3
- package/esm/types/EventEmitter.js.map +0 -1
- package/esm/types/JWT.js +0 -3
- package/esm/types/JWT.js.map +0 -1
- package/esm/types/OAuth.js +0 -3
- package/esm/types/OAuth.js.map +0 -1
- package/esm/types/OktaAuthOptions.js +0 -3
- package/esm/types/OktaAuthOptions.js.map +0 -1
- package/esm/types/Storage.js +0 -3
- package/esm/types/Storage.js.map +0 -1
- package/esm/types/Token.js +0 -29
- package/esm/types/Token.js.map +0 -1
- package/esm/types/TokenManager.js +0 -3
- package/esm/types/TokenManager.js.map +0 -1
- package/esm/types/Transaction.js +0 -57
- package/esm/types/Transaction.js.map +0 -1
- package/esm/types/UserClaims.js +0 -3
- package/esm/types/UserClaims.js.map +0 -1
- package/esm/types/api.js +0 -3
- package/esm/types/api.js.map +0 -1
- package/esm/types/http.js +0 -3
- package/esm/types/http.js.map +0 -1
- package/esm/types/index.js +0 -27
- package/esm/types/index.js.map +0 -1
- package/esm/util/console.js +0 -53
- package/esm/util/console.js.map +0 -1
- package/esm/util/index.js +0 -17
- package/esm/util/index.js.map +0 -1
- package/esm/util/misc.js +0 -33
- package/esm/util/misc.js.map +0 -1
- package/esm/util/object.js +0 -117
- package/esm/util/object.js.map +0 -1
- package/esm/util/sharedStorage.js +0 -43
- package/esm/util/sharedStorage.js.map +0 -1
- package/esm/util/types.js +0 -27
- package/esm/util/types.js.map +0 -1
- package/esm/util/url.js +0 -64
- package/esm/util/url.js.map +0 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _AuthenticationFlow = require("./AuthenticationFlow");
|
|
4
|
+
|
|
5
|
+
Object.keys(_AuthenticationFlow).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _AuthenticationFlow[key]) return;
|
|
8
|
+
Object.defineProperty(exports, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () {
|
|
11
|
+
return _AuthenticationFlow[key];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
var _AuthenticationFlowMonitor = require("./AuthenticationFlowMonitor");
|
|
17
|
+
|
|
18
|
+
Object.keys(_AuthenticationFlowMonitor).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _AuthenticationFlowMonitor[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _AuthenticationFlowMonitor[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
var _FlowMonitor = require("./FlowMonitor");
|
|
30
|
+
|
|
31
|
+
Object.keys(_FlowMonitor).forEach(function (key) {
|
|
32
|
+
if (key === "default" || key === "__esModule") return;
|
|
33
|
+
if (key in exports && exports[key] === _FlowMonitor[key]) return;
|
|
34
|
+
Object.defineProperty(exports, key, {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return _FlowMonitor[key];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var _FlowSpecification = require("./FlowSpecification");
|
|
43
|
+
|
|
44
|
+
Object.keys(_FlowSpecification).forEach(function (key) {
|
|
45
|
+
if (key === "default" || key === "__esModule") return;
|
|
46
|
+
if (key in exports && exports[key] === _FlowSpecification[key]) return;
|
|
47
|
+
Object.defineProperty(exports, key, {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return _FlowSpecification[key];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
var _PasswordRecoveryFlow = require("./PasswordRecoveryFlow");
|
|
56
|
+
|
|
57
|
+
Object.keys(_PasswordRecoveryFlow).forEach(function (key) {
|
|
58
|
+
if (key === "default" || key === "__esModule") return;
|
|
59
|
+
if (key in exports && exports[key] === _PasswordRecoveryFlow[key]) return;
|
|
60
|
+
Object.defineProperty(exports, key, {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _PasswordRecoveryFlow[key];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var _PasswordRecoveryFlowMonitor = require("./PasswordRecoveryFlowMonitor");
|
|
69
|
+
|
|
70
|
+
Object.keys(_PasswordRecoveryFlowMonitor).forEach(function (key) {
|
|
71
|
+
if (key === "default" || key === "__esModule") return;
|
|
72
|
+
if (key in exports && exports[key] === _PasswordRecoveryFlowMonitor[key]) return;
|
|
73
|
+
Object.defineProperty(exports, key, {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _PasswordRecoveryFlowMonitor[key];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
var _RegistrationFlow = require("./RegistrationFlow");
|
|
82
|
+
|
|
83
|
+
Object.keys(_RegistrationFlow).forEach(function (key) {
|
|
84
|
+
if (key === "default" || key === "__esModule") return;
|
|
85
|
+
if (key in exports && exports[key] === _RegistrationFlow[key]) return;
|
|
86
|
+
Object.defineProperty(exports, key, {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function () {
|
|
89
|
+
return _RegistrationFlow[key];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
var _RegistrationFlowMonitor = require("./RegistrationFlowMonitor");
|
|
95
|
+
|
|
96
|
+
Object.keys(_RegistrationFlowMonitor).forEach(function (key) {
|
|
97
|
+
if (key === "default" || key === "__esModule") return;
|
|
98
|
+
if (key in exports && exports[key] === _RegistrationFlowMonitor[key]) return;
|
|
99
|
+
Object.defineProperty(exports, key, {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () {
|
|
102
|
+
return _RegistrationFlowMonitor[key];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
var _RemediationFlow = require("./RemediationFlow");
|
|
108
|
+
|
|
109
|
+
Object.keys(_RemediationFlow).forEach(function (key) {
|
|
110
|
+
if (key === "default" || key === "__esModule") return;
|
|
111
|
+
if (key in exports && exports[key] === _RemediationFlow[key]) return;
|
|
112
|
+
Object.defineProperty(exports, key, {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function () {
|
|
115
|
+
return _RemediationFlow[key];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../lib/idx/flow/index.ts"],"names":[],"mappings":";;AAYA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nexport * from './AuthenticationFlow';\nexport * from './AuthenticationFlowMonitor';\nexport * from './FlowMonitor';\nexport * from './FlowSpecification';\nexport * from './PasswordRecoveryFlow';\nexport * from './PasswordRecoveryFlowMonitor';\nexport * from './RegistrationFlow';\nexport * from './RegistrationFlowMonitor';\nexport * from './RemediationFlow';\n"],"file":"index.js"}
|
package/cjs/idx/index.js
CHANGED
|
@@ -52,6 +52,19 @@ Object.keys(_introspect).forEach(function (key) {
|
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
+
var _proceed = require("./proceed");
|
|
56
|
+
|
|
57
|
+
Object.keys(_proceed).forEach(function (key) {
|
|
58
|
+
if (key === "default" || key === "__esModule") return;
|
|
59
|
+
if (key in exports && exports[key] === _proceed[key]) return;
|
|
60
|
+
Object.defineProperty(exports, key, {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _proceed[key];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
55
68
|
var _register = require("./register");
|
|
56
69
|
|
|
57
70
|
Object.keys(_register).forEach(function (key) {
|
|
@@ -103,4 +116,17 @@ Object.keys(_startTransaction).forEach(function (key) {
|
|
|
103
116
|
}
|
|
104
117
|
});
|
|
105
118
|
});
|
|
119
|
+
|
|
120
|
+
var _transactionMeta = require("./transactionMeta");
|
|
121
|
+
|
|
122
|
+
Object.keys(_transactionMeta).forEach(function (key) {
|
|
123
|
+
if (key === "default" || key === "__esModule") return;
|
|
124
|
+
if (key in exports && exports[key] === _transactionMeta[key]) return;
|
|
125
|
+
Object.defineProperty(exports, key, {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function () {
|
|
128
|
+
return _transactionMeta[key];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
106
132
|
//# sourceMappingURL=index.js.map
|
package/cjs/idx/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/index.ts"],"names":[],"mappings":";;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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\nexport * from './authenticate';\nexport * from './cancel';\nexport * from './interact';\nexport * from './introspect';\nexport * from './register';\nexport * from './recoverPassword';\nexport * from './handleInteractionCodeRedirect';\nexport * from './startTransaction';\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/index.ts"],"names":[],"mappings":";;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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\nexport * from './authenticate';\nexport * from './cancel';\nexport * from './interact';\nexport * from './introspect';\nexport * from './proceed';\nexport * from './register';\nexport * from './recoverPassword';\nexport * from './handleInteractionCodeRedirect';\nexport * from './startTransaction';\nexport * from './transactionMeta';\n"],"file":"index.js"}
|
package/cjs/idx/interact.js
CHANGED
|
@@ -31,7 +31,10 @@ function getResponse(meta) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
async function interact(authClient, options = {}) {
|
|
34
|
-
|
|
34
|
+
let state = options.state || authClient.options.state;
|
|
35
|
+
const meta = await (0, _transactionMeta.getTransactionMeta)(authClient, {
|
|
36
|
+
state
|
|
37
|
+
}); // Saved transaction, return meta
|
|
35
38
|
|
|
36
39
|
if (meta.interactionHandle) {
|
|
37
40
|
return getResponse(meta);
|
|
@@ -48,7 +51,7 @@ async function interact(authClient, options = {}) {
|
|
|
48
51
|
redirectUri
|
|
49
52
|
} = authClient.options; // These properties can be set in options, but also have a default value in global configuration.
|
|
50
53
|
|
|
51
|
-
|
|
54
|
+
state = state || meta.state;
|
|
52
55
|
const scopes = options.scopes || authClient.options.scopes || meta.scopes;
|
|
53
56
|
const baseUrl = (0, _oidc.getOAuthBaseUrl)(authClient);
|
|
54
57
|
return _oktaIdxJs.default.interact({
|
package/cjs/idx/interact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/interact.ts"],"names":["getResponse","meta","interactionHandle","state","interact","authClient","options","codeChallenge","codeChallengeMethod","clientId","redirectUri","scopes","baseUrl","idx","then","newMeta"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA,SAASA,WAAT,CAAqBC,IAArB,EAAiE;AAC/D,SAAO;AACLA,IAAAA,IADK;AAELC,IAAAA,iBAAiB,EAAED,IAAI,CAACC,iBAFnB;AAGLC,IAAAA,KAAK,EAAEF,IAAI,CAACE;AAHP,GAAP;AAKD,C,CAED;;;AACO,eAAeC,QAAf,CAAyBC,UAAzB,EAA+CC,OAAwB,GAAG,EAA1E,EAAyG;AAC9G,
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/interact.ts"],"names":["getResponse","meta","interactionHandle","state","interact","authClient","options","codeChallenge","codeChallengeMethod","clientId","redirectUri","scopes","baseUrl","idx","then","newMeta"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA,SAASA,WAAT,CAAqBC,IAArB,EAAiE;AAC/D,SAAO;AACLA,IAAAA,IADK;AAELC,IAAAA,iBAAiB,EAAED,IAAI,CAACC,iBAFnB;AAGLC,IAAAA,KAAK,EAAEF,IAAI,CAACE;AAHP,GAAP;AAKD,C,CAED;;;AACO,eAAeC,QAAf,CAAyBC,UAAzB,EAA+CC,OAAwB,GAAG,EAA1E,EAAyG;AAC9G,MAAIH,KAAK,GAAGG,OAAO,CAACH,KAAR,IAAiBE,UAAU,CAACC,OAAX,CAAmBH,KAAhD;AACA,QAAMF,IAAI,GAAG,MAAM,yCAAmBI,UAAnB,EAA+B;AAAEF,IAAAA;AAAF,GAA/B,CAAnB,CAF8G,CAI9G;;AACA,MAAIF,IAAI,CAACC,iBAAT,EAA4B;AAC1B,WAAOF,WAAW,CAACC,IAAD,CAAlB;AACD,GAP6G,CAS9G;;;AACA,QAAM;AAAEM,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAAyCP,IAA/C,CAV8G,CAY9G;;AACA,QAAM;AAAEQ,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA4BL,UAAU,CAACC,OAA7C,CAb8G,CAe9G;;AACAH,EAAAA,KAAK,GAAGA,KAAK,IAAIF,IAAI,CAACE,KAAtB;AACA,QAAMQ,MAAM,GAAGL,OAAO,CAACK,MAAR,IAAkBN,UAAU,CAACC,OAAX,CAAmBK,MAArC,IAA+CV,IAAI,CAACU,MAAnE;AAEA,QAAMC,OAAO,GAAG,2BAAgBP,UAAhB,CAAhB;AACA,SAAOQ,mBAAIT,QAAJ,CAAa;AAClB;AACAK,IAAAA,QAFkB;AAGlBG,IAAAA,OAHkB;AAIlBD,IAAAA,MAJkB;AAKlBR,IAAAA,KALkB;AAMlBO,IAAAA,WANkB;AAQlB;AACAH,IAAAA,aATkB;AAUlBC,IAAAA;AAVkB,GAAb,EAWJM,IAXI,CAWCZ,iBAAiB,IAAI;AAC3B,UAAMa,OAAO,GAAG,EACd,GAAGd,IADW;AAEdC,MAAAA,iBAFc;AAGdC,MAAAA,KAHc;AAIdQ,MAAAA;AAJc,KAAhB,CAD2B,CAO3B;;AACA,8CAAoBN,UAApB,EAAgCU,OAAhC;AAEA,WAAOf,WAAW,CAACe,OAAD,CAAlB;AACD,GAtBM,CAAP;AAuBD","sourcesContent":["/*!\n * Copyright (c) 2021, 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 idx from '@okta/okta-idx-js';\nimport { OktaAuth, IdxTransactionMeta } from '../types';\nimport { getTransactionMeta, saveTransactionMeta } from './transactionMeta';\nimport { getOAuthBaseUrl } from '../oidc';\n\nexport interface InteractOptions {\n state?: string;\n scopes?: string[];\n}\n\nexport interface InteractResponse {\n state?: string;\n interactionHandle: string;\n meta: IdxTransactionMeta;\n}\n\nfunction getResponse(meta: IdxTransactionMeta): InteractResponse {\n return {\n meta,\n interactionHandle: meta.interactionHandle,\n state: meta.state\n };\n}\n\n// Begin or resume a transaction. Returns an interaction handle\nexport async function interact (authClient: OktaAuth, options: InteractOptions = {}): Promise<InteractResponse> {\n let state = options.state || authClient.options.state;\n const meta = await getTransactionMeta(authClient, { state });\n\n // Saved transaction, return meta\n if (meta.interactionHandle) {\n return getResponse(meta);\n }\n\n // These properties are always loaded from meta (or calculated fresh)\n const { codeChallenge, codeChallengeMethod } = meta;\n\n // These properties are defined by global configuration\n const { clientId, redirectUri } = authClient.options;\n\n // These properties can be set in options, but also have a default value in global configuration.\n state = state || meta.state;\n const scopes = options.scopes || authClient.options.scopes || meta.scopes;\n\n const baseUrl = getOAuthBaseUrl(authClient);\n return idx.interact({\n // OAuth\n clientId, \n baseUrl,\n scopes,\n state,\n redirectUri,\n\n // PKCE\n codeChallenge,\n codeChallengeMethod\n }).then(interactionHandle => {\n const newMeta = {\n ...meta,\n interactionHandle,\n state,\n scopes\n };\n // Save transaction meta so it can be resumed\n saveTransactionMeta(authClient, newMeta);\n\n return getResponse(newMeta);\n });\n}\n"],"file":"interact.js"}
|
package/cjs/idx/introspect.js
CHANGED
|
@@ -6,6 +6,8 @@ exports.introspect = introspect;
|
|
|
6
6
|
|
|
7
7
|
var _oktaIdxJs = _interopRequireDefault(require("@okta/okta-idx-js"));
|
|
8
8
|
|
|
9
|
+
var _idxJs = require("./types/idx-js");
|
|
10
|
+
|
|
9
11
|
var _oidc = require("../oidc");
|
|
10
12
|
|
|
11
13
|
var _constants = require("../constants");
|
|
@@ -22,18 +24,33 @@ var _constants = require("../constants");
|
|
|
22
24
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
23
25
|
*/
|
|
24
26
|
async function introspect(authClient, options) {
|
|
25
|
-
|
|
27
|
+
const useLastResponse = !options.stateTokenExternalId; // email verify callback: must make a new response
|
|
28
|
+
|
|
29
|
+
let rawIdxResponse;
|
|
30
|
+
|
|
31
|
+
if (useLastResponse) {
|
|
32
|
+
// try load from storage first
|
|
33
|
+
rawIdxResponse = authClient.transactionManager.loadIdxResponse();
|
|
34
|
+
} // call idx.introspect if no existing idx response available in storage
|
|
26
35
|
|
|
27
|
-
rawIdxResponse = authClient.transactionManager.loadIdxResponse(); // call idx.introspect if no existing idx response available in storage
|
|
28
36
|
|
|
29
37
|
if (!rawIdxResponse) {
|
|
30
38
|
const version = _constants.IDX_API_VERSION;
|
|
31
39
|
const domain = (0, _oidc.getOAuthDomain)(authClient);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
rawIdxResponse = await _oktaIdxJs.default.introspect({
|
|
43
|
+
domain,
|
|
44
|
+
version,
|
|
45
|
+
...options
|
|
46
|
+
});
|
|
47
|
+
} catch (err) {
|
|
48
|
+
if ((0, _idxJs.isRawIdxResponse)(err)) {
|
|
49
|
+
rawIdxResponse = err;
|
|
50
|
+
} else {
|
|
51
|
+
throw err;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
37
54
|
}
|
|
38
55
|
|
|
39
56
|
return _oktaIdxJs.default.makeIdxState(rawIdxResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/introspect.ts"],"names":["introspect","authClient","options","rawIdxResponse","transactionManager","loadIdxResponse","version","IDX_API_VERSION","domain","idx","makeIdxState"],"mappings":";;;;;;AAYA;;
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/introspect.ts"],"names":["introspect","authClient","options","useLastResponse","stateTokenExternalId","rawIdxResponse","transactionManager","loadIdxResponse","version","IDX_API_VERSION","domain","idx","err","makeIdxState"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAcO,eAAeA,UAAf,CAA2BC,UAA3B,EAAiDC,OAAjD,EAAmG;AACxG,QAAMC,eAAe,GAAG,CAACD,OAAO,CAACE,oBAAjC,CADwG,CACjD;;AACvD,MAAIC,cAAJ;;AAEA,MAAIF,eAAJ,EAAqB;AACnB;AACAE,IAAAA,cAAc,GAAGJ,UAAU,CAACK,kBAAX,CAA8BC,eAA9B,EAAjB;AACD,GAPuG,CASxG;;;AACA,MAAI,CAACF,cAAL,EAAqB;AACnB,UAAMG,OAAO,GAAGC,0BAAhB;AACA,UAAMC,MAAM,GAAG,0BAAeT,UAAf,CAAf;;AACA,QAAI;AACFI,MAAAA,cAAc,GAAG,MAAMM,mBAAIX,UAAJ,CAAe;AAAEU,QAAAA,MAAF;AAAUF,QAAAA,OAAV;AAAmB,WAAGN;AAAtB,OAAf,CAAvB;AACD,KAFD,CAEE,OAAOU,GAAP,EAAY;AACZ,UAAI,6BAAiBA,GAAjB,CAAJ,EAA2B;AACzBP,QAAAA,cAAc,GAAGO,GAAjB;AACD,OAFD,MAEO;AACL,cAAMA,GAAN;AACD;AACF;AACF;;AAED,SAAOD,mBAAIE,YAAJ,CAAiBR,cAAjB,CAAP;AACD","sourcesContent":["/*!\n * Copyright (c) 2021, 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 idx from '@okta/okta-idx-js';\nimport { OktaAuth } from '../types';\nimport { IdxResponse, isRawIdxResponse, RawIdxResponse } from './types/idx-js';\nimport { getOAuthDomain } from '../oidc';\nimport { IDX_API_VERSION } from '../constants';\n\nexport interface IntrospectOptions {\n interactionHandle?: string;\n stateHandle?: string;\n stateTokenExternalId?: string;\n}\n\nexport async function introspect (authClient: OktaAuth, options: IntrospectOptions): Promise<IdxResponse> {\n const useLastResponse = !options.stateTokenExternalId; // email verify callback: must make a new response\n let rawIdxResponse: RawIdxResponse;\n \n if (useLastResponse) {\n // try load from storage first\n rawIdxResponse = authClient.transactionManager.loadIdxResponse();\n }\n \n // call idx.introspect if no existing idx response available in storage\n if (!rawIdxResponse) {\n const version = IDX_API_VERSION;\n const domain = getOAuthDomain(authClient);\n try {\n rawIdxResponse = await idx.introspect({ domain, version, ...options });\n } catch (err) {\n if (isRawIdxResponse(err)) {\n rawIdxResponse = err;\n } else {\n throw err;\n }\n }\n }\n\n return idx.makeIdxState(rawIdxResponse);\n}\n"],"file":"introspect.js"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.canProceed = canProceed;
|
|
4
|
+
exports.proceed = proceed;
|
|
5
|
+
|
|
6
|
+
var _run = require("./run");
|
|
7
|
+
|
|
8
|
+
var _transactionMeta = require("./transactionMeta");
|
|
9
|
+
|
|
10
|
+
var _flow = require("./flow");
|
|
11
|
+
|
|
12
|
+
var _errors = require("../errors");
|
|
13
|
+
|
|
14
|
+
/*!
|
|
15
|
+
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
16
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
17
|
+
*
|
|
18
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
21
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
*
|
|
23
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
function canProceed(authClient, options) {
|
|
26
|
+
const meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient, options);
|
|
27
|
+
return !!meta;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function proceed(authClient, options = {}) {
|
|
31
|
+
const {
|
|
32
|
+
stateTokenExternalId,
|
|
33
|
+
state
|
|
34
|
+
} = options;
|
|
35
|
+
const meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient, {
|
|
36
|
+
state
|
|
37
|
+
}); // Proceed always needs saved transaction meta, except in the case of email verify callback
|
|
38
|
+
|
|
39
|
+
if (!meta && !stateTokenExternalId) {
|
|
40
|
+
throw new _errors.AuthSdkError('Unable to proceed: saved transaction could not be loaded');
|
|
41
|
+
} // Determine the flow specification based on the saved flow
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const flowSpec = (0, _flow.getFlowSpecification)(authClient, meta === null || meta === void 0 ? void 0 : meta.flow);
|
|
45
|
+
return (0, _run.run)(authClient, { ...options,
|
|
46
|
+
...flowSpec
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=proceed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/proceed.ts"],"names":["canProceed","authClient","options","meta","proceed","stateTokenExternalId","state","AuthSdkError","flowSpec","flow"],"mappings":";;;;;AAiBA;;AAIA;;AACA;;AACA;;AAvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAmBO,SAASA,UAAT,CAAoBC,UAApB,EAA0CC,OAA1C,EAAwE;AAC7E,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoCC,OAApC,CAAb;AACA,SAAO,CAAC,CAACC,IAAT;AACD;;AAEM,eAAeC,OAAf,CACLH,UADK,EAELC,OAAuB,GAAG,EAFrB,EAGoB;AACzB,QAAM;AAAEG,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MAAkCJ,OAAxC;AACA,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoC;AAAEK,IAAAA;AAAF,GAApC,CAAb,CAFyB,CAIzB;;AACA,MAAI,CAACH,IAAD,IAAS,CAACE,oBAAd,EAAoC;AAClC,UAAM,IAAIE,oBAAJ,CAAiB,0DAAjB,CAAN;AACD,GAPwB,CASzB;;;AACA,QAAMC,QAAQ,GAAG,gCAAqBP,UAArB,EAAiCE,IAAjC,aAAiCA,IAAjC,uBAAiCA,IAAI,CAAEM,IAAvC,CAAjB;AAEA,SAAO,cAAIR,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErB,OAAGM;AAFkB,GAAhB,CAAP;AAID","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { \n OktaAuth,\n IdxTransaction,\n} from '../types';\nimport { run } from './run';\nimport { AuthenticationOptions } from './authenticate';\nimport { RegistrationOptions } from './register';\nimport { PasswordRecoveryOptions } from './recoverPassword';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { getFlowSpecification } from './flow';\nimport { AuthSdkError } from '../errors';\n\nexport type ProceedOptions = AuthenticationOptions\n & RegistrationOptions\n & PasswordRecoveryOptions;\n\nexport function canProceed(authClient: OktaAuth, options?: { state?: string }) {\n const meta = getSavedTransactionMeta(authClient, options);\n return !!meta;\n}\n\nexport async function proceed(\n authClient: OktaAuth,\n options: ProceedOptions = {}\n): Promise<IdxTransaction> {\n const { stateTokenExternalId, state } = options;\n const meta = getSavedTransactionMeta(authClient, { state });\n\n // Proceed always needs saved transaction meta, except in the case of email verify callback\n if (!meta && !stateTokenExternalId) {\n throw new AuthSdkError('Unable to proceed: saved transaction could not be loaded');\n }\n\n // Determine the flow specification based on the saved flow\n const flowSpec = getFlowSpecification(authClient, meta?.flow);\n\n return run(authClient, { \n ...options, \n ...flowSpec\n });\n}\n"],"file":"proceed.js"}
|
|
@@ -4,9 +4,7 @@ exports.recoverPassword = recoverPassword;
|
|
|
4
4
|
|
|
5
5
|
var _run = require("./run");
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var _flowMonitors = require("./flowMonitors");
|
|
7
|
+
var _flow = require("./flow");
|
|
10
8
|
|
|
11
9
|
/*!
|
|
12
10
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
@@ -19,22 +17,10 @@ var _flowMonitors = require("./flowMonitors");
|
|
|
19
17
|
*
|
|
20
18
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
21
19
|
*/
|
|
22
|
-
const flow = {
|
|
23
|
-
'identify': _remediators.Identify,
|
|
24
|
-
'identify-recovery': _remediators.Identify,
|
|
25
|
-
'select-authenticator-authenticate': _remediators.SelectAuthenticatorAuthenticate,
|
|
26
|
-
'challenge-authenticator': _remediators.ChallengeAuthenticator,
|
|
27
|
-
'authenticator-verification-data': _remediators.AuthenticatorVerificationData,
|
|
28
|
-
'reset-authenticator': _remediators.ResetAuthenticator,
|
|
29
|
-
'reenroll-authenticator': _remediators.ReEnrollAuthenticator
|
|
30
|
-
};
|
|
31
|
-
|
|
32
20
|
async function recoverPassword(authClient, options) {
|
|
33
|
-
const
|
|
21
|
+
const flowSpec = (0, _flow.getFlowSpecification)(authClient, 'recoverPassword');
|
|
34
22
|
return (0, _run.run)(authClient, { ...options,
|
|
35
|
-
|
|
36
|
-
flowMonitor,
|
|
37
|
-
actions: ['currentAuthenticator-recover', 'currentAuthenticatorEnrollment-recover']
|
|
23
|
+
...flowSpec
|
|
38
24
|
});
|
|
39
25
|
}
|
|
40
26
|
//# sourceMappingURL=recoverPassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/recoverPassword.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/recoverPassword.ts"],"names":["recoverPassword","authClient","options","flowSpec"],"mappings":";;;;AAaA;;AASA;;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA2BO,eAAeA,eAAf,CACLC,UADK,EACiBC,OADjB,EAEoB;AACzB,QAAMC,QAAQ,GAAG,gCAAqBF,UAArB,EAAiC,iBAAjC,CAAjB;AACA,SAAO,cACLA,UADK,EAEL,EACE,GAAGC,OADL;AAEE,OAAGC;AAFL,GAFK,CAAP;AAOD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { run } from './run';\nimport {\n IdentifyValues,\n SelectAuthenticatorAuthenticateValues,\n ChallengeAuthenticatorValues,\n AuthenticatorVerificationDataValues,\n ResetAuthenticatorValues,\n ReEnrollAuthenticatorValues,\n} from './remediators';\nimport { getFlowSpecification } from './flow';\nimport { \n OktaAuth, \n IdxOptions, \n IdxTransaction,\n} from '../types';\n\nexport type PasswordRecoveryOptions = IdxOptions \n & IdentifyValues \n & SelectAuthenticatorAuthenticateValues \n & ChallengeAuthenticatorValues \n & ResetAuthenticatorValues\n & AuthenticatorVerificationDataValues\n & ReEnrollAuthenticatorValues;\n\nexport async function recoverPassword(\n authClient: OktaAuth, options: PasswordRecoveryOptions\n): Promise<IdxTransaction> {\n const flowSpec = getFlowSpecification(authClient, 'recoverPassword');\n return run(\n authClient, \n { \n ...options,\n ...flowSpec,\n }\n );\n}\n"],"file":"recoverPassword.js"}
|
package/cjs/idx/register.js
CHANGED
|
@@ -8,9 +8,7 @@ var _transactionMeta = require("./transactionMeta");
|
|
|
8
8
|
|
|
9
9
|
var _startTransaction = require("./startTransaction");
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
var _flowMonitors = require("./flowMonitors");
|
|
11
|
+
var _flow = require("./flow");
|
|
14
12
|
|
|
15
13
|
var _errors = require("../errors");
|
|
16
14
|
|
|
@@ -27,21 +25,15 @@ var _types = require("../types");
|
|
|
27
25
|
*
|
|
28
26
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
29
27
|
*/
|
|
30
|
-
const flow = {
|
|
31
|
-
'select-enroll-profile': _remediators.SelectEnrollProfile,
|
|
32
|
-
'enroll-profile': _remediators.EnrollProfile,
|
|
33
|
-
'authenticator-enrollment-data': _remediators.AuthenticatorEnrollmentData,
|
|
34
|
-
'select-authenticator-enroll': _remediators.SelectAuthenticatorEnroll,
|
|
35
|
-
'enroll-authenticator': _remediators.EnrollAuthenticator,
|
|
36
|
-
'skip': _remediators.Skip
|
|
37
|
-
};
|
|
38
|
-
|
|
39
28
|
async function register(authClient, options) {
|
|
40
29
|
// Only check at the beginning of the transaction
|
|
41
30
|
if (!(0, _transactionMeta.transactionMetaExist)(authClient)) {
|
|
42
31
|
const {
|
|
43
32
|
enabledFeatures
|
|
44
|
-
} = await (0, _startTransaction.startTransaction)(authClient,
|
|
33
|
+
} = await (0, _startTransaction.startTransaction)(authClient, {
|
|
34
|
+
flow: 'register',
|
|
35
|
+
...options
|
|
36
|
+
});
|
|
45
37
|
|
|
46
38
|
if (enabledFeatures && !enabledFeatures.includes(_types.IdxFeature.REGISTRATION)) {
|
|
47
39
|
const error = new _errors.AuthSdkError('Registration is not supported based on your current org configuration.');
|
|
@@ -52,10 +44,9 @@ async function register(authClient, options) {
|
|
|
52
44
|
}
|
|
53
45
|
}
|
|
54
46
|
|
|
55
|
-
const
|
|
47
|
+
const flowSpec = (0, _flow.getFlowSpecification)(authClient, 'register');
|
|
56
48
|
return (0, _run.run)(authClient, { ...options,
|
|
57
|
-
|
|
58
|
-
flowMonitor
|
|
49
|
+
...flowSpec
|
|
59
50
|
});
|
|
60
51
|
}
|
|
61
52
|
//# sourceMappingURL=register.js.map
|
package/cjs/idx/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/register.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/register.ts"],"names":["register","authClient","options","enabledFeatures","flow","includes","IdxFeature","REGISTRATION","error","AuthSdkError","status","IdxStatus","FAILURE","flowSpec"],"mappings":";;;;AAaA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA8BO,eAAeA,QAAf,CACLC,UADK,EACiBC,OADjB,EAEoB;AACzB;AACA,MAAI,CAAC,2CAAqBD,UAArB,CAAL,EAAuC;AACrC,UAAM;AAAEE,MAAAA;AAAF,QAAsB,MAAM,wCAAiBF,UAAjB,EAA6B;AAAEG,MAAAA,IAAI,EAAE,UAAR;AAAoB,SAAGF;AAAvB,KAA7B,CAAlC;;AACA,QAAIC,eAAe,IAAI,CAACA,eAAe,CAACE,QAAhB,CAAyBC,kBAAWC,YAApC,CAAxB,EAA2E;AACzE,YAAMC,KAAK,GAAG,IAAIC,oBAAJ,CAAiB,wEAAjB,CAAd;AACA,aAAO;AAAEC,QAAAA,MAAM,EAAEC,iBAAUC,OAApB;AAA6BJ,QAAAA;AAA7B,OAAP;AACD;AACF;;AAED,QAAMK,QAAQ,GAAG,gCAAqBZ,UAArB,EAAiC,UAAjC,CAAjB;AACA,SAAO,cAAIA,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErB,OAAGW;AAFkB,GAAhB,CAAP;AAID","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { run } from './run';\nimport { transactionMetaExist } from './transactionMeta';\nimport { startTransaction } from './startTransaction';\nimport { \n EnrollProfileValues,\n SelectAuthenticatorEnrollValues,\n EnrollAuthenticatorValues,\n AuthenticatorEnrollmentDataValues,\n SkipValues,\n} from './remediators';\nimport { getFlowSpecification } from './flow';\nimport { AuthSdkError } from '../errors';\nimport { \n IdxOptions, \n IdxTransaction, \n OktaAuth, \n IdxFeature,\n IdxStatus,\n} from '../types';\n\nexport type RegistrationOptions = IdxOptions \n & EnrollProfileValues \n & SelectAuthenticatorEnrollValues \n & EnrollAuthenticatorValues \n & AuthenticatorEnrollmentDataValues \n & SkipValues;\n\nexport async function register(\n authClient: OktaAuth, options: RegistrationOptions\n): Promise<IdxTransaction> {\n // Only check at the beginning of the transaction\n if (!transactionMetaExist(authClient)) {\n const { enabledFeatures } = await startTransaction(authClient, { flow: 'register', ...options });\n if (enabledFeatures && !enabledFeatures.includes(IdxFeature.REGISTRATION)) {\n const error = new AuthSdkError('Registration is not supported based on your current org configuration.');\n return { status: IdxStatus.FAILURE, error };\n }\n }\n\n const flowSpec = getFlowSpecification(authClient, 'register');\n return run(authClient, { \n ...options, \n ...flowSpec\n });\n}\n"],"file":"register.js"}
|
package/cjs/idx/remediate.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
exports.getRemediator = getRemediator;
|
|
6
4
|
exports.remediate = remediate;
|
|
7
5
|
|
|
8
|
-
var _oktaIdxJs = _interopRequireDefault(require("@okta/okta-idx-js"));
|
|
9
|
-
|
|
10
6
|
var _errors = require("../errors");
|
|
11
7
|
|
|
12
8
|
var _idxJs = require("./types/idx-js");
|
|
@@ -27,20 +23,20 @@ var _idxJs = require("./types/idx-js");
|
|
|
27
23
|
// Return first match idxRemediation in allowed remediators
|
|
28
24
|
function getRemediator(idxRemediations, values, options) {
|
|
29
25
|
const {
|
|
30
|
-
|
|
26
|
+
remediators,
|
|
31
27
|
flowMonitor
|
|
32
28
|
} = options;
|
|
33
29
|
let remediator;
|
|
34
30
|
const remediatorCandidates = [];
|
|
35
31
|
|
|
36
32
|
for (let remediation of idxRemediations) {
|
|
37
|
-
const isRemeditionInFlow = Object.keys(
|
|
33
|
+
const isRemeditionInFlow = Object.keys(remediators).includes(remediation.name);
|
|
38
34
|
|
|
39
35
|
if (!isRemeditionInFlow) {
|
|
40
36
|
continue;
|
|
41
37
|
}
|
|
42
38
|
|
|
43
|
-
const T =
|
|
39
|
+
const T = remediators[remediation.name];
|
|
44
40
|
remediator = new T(remediation, values);
|
|
45
41
|
|
|
46
42
|
if (flowMonitor.isRemediatorCandidate(remediator, idxRemediations, values)) {
|
|
@@ -87,12 +83,12 @@ function canResendFn(idxResponse) {
|
|
|
87
83
|
return Object.keys(idxResponse.actions).some(actionName => actionName.includes('resend'));
|
|
88
84
|
}
|
|
89
85
|
|
|
90
|
-
function getIdxMessages(idxResponse,
|
|
86
|
+
function getIdxMessages(idxResponse, remediators) {
|
|
91
87
|
var _rawIdxState$messages;
|
|
92
88
|
|
|
93
89
|
let messages = [];
|
|
94
90
|
|
|
95
|
-
if (!
|
|
91
|
+
if (!remediators) {
|
|
96
92
|
return messages;
|
|
97
93
|
}
|
|
98
94
|
|
|
@@ -109,7 +105,7 @@ function getIdxMessages(idxResponse, flow) {
|
|
|
109
105
|
|
|
110
106
|
|
|
111
107
|
for (let remediation of neededToProceed) {
|
|
112
|
-
const T =
|
|
108
|
+
const T = remediators[remediation.name];
|
|
113
109
|
|
|
114
110
|
if (!T) {
|
|
115
111
|
continue;
|
|
@@ -140,32 +136,32 @@ function getNextStep(remediator, idxResponse) {
|
|
|
140
136
|
};
|
|
141
137
|
}
|
|
142
138
|
|
|
143
|
-
function handleIdxError(e,
|
|
139
|
+
function handleIdxError(e, remediators, remediator) {
|
|
144
140
|
// Handle idx messages
|
|
145
|
-
|
|
146
|
-
const idxState = _oktaIdxJs.default.makeIdxState(e);
|
|
147
|
-
|
|
148
|
-
const terminal = isTerminalResponse(idxState);
|
|
149
|
-
const messages = getIdxMessages(idxState, flow);
|
|
141
|
+
const idxState = (0, _idxJs.isIdxResponse)(e) ? e : null;
|
|
150
142
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
};
|
|
156
|
-
} else {
|
|
157
|
-
const nextStep = remediator && getNextStep(remediator, idxState);
|
|
158
|
-
return {
|
|
159
|
-
messages,
|
|
160
|
-
...(nextStep && {
|
|
161
|
-
nextStep
|
|
162
|
-
})
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
} // Thrown error terminates the interaction with idx
|
|
143
|
+
if (!idxState) {
|
|
144
|
+
// Thrown error terminates the interaction with idx
|
|
145
|
+
throw e;
|
|
146
|
+
}
|
|
166
147
|
|
|
148
|
+
const terminal = isTerminalResponse(idxState);
|
|
149
|
+
const messages = getIdxMessages(idxState, remediators);
|
|
167
150
|
|
|
168
|
-
|
|
151
|
+
if (terminal) {
|
|
152
|
+
return {
|
|
153
|
+
terminal,
|
|
154
|
+
messages
|
|
155
|
+
};
|
|
156
|
+
} else {
|
|
157
|
+
const nextStep = remediator && getNextStep(remediator, idxState);
|
|
158
|
+
return {
|
|
159
|
+
messages,
|
|
160
|
+
...(nextStep && {
|
|
161
|
+
nextStep
|
|
162
|
+
})
|
|
163
|
+
};
|
|
164
|
+
}
|
|
169
165
|
}
|
|
170
166
|
|
|
171
167
|
function getActionFromValues(values, idxResponse) {
|
|
@@ -186,7 +182,7 @@ async function remediate(idxResponse, values, options) {
|
|
|
186
182
|
interactionCode
|
|
187
183
|
} = idxResponse;
|
|
188
184
|
const {
|
|
189
|
-
|
|
185
|
+
remediators,
|
|
190
186
|
flowMonitor
|
|
191
187
|
} = options; // If the response contains an interaction code, there is no need to remediate
|
|
192
188
|
|
|
@@ -198,7 +194,7 @@ async function remediate(idxResponse, values, options) {
|
|
|
198
194
|
|
|
199
195
|
|
|
200
196
|
const terminal = isTerminalResponse(idxResponse);
|
|
201
|
-
const messages = getIdxMessages(idxResponse,
|
|
197
|
+
const messages = getIdxMessages(idxResponse, remediators);
|
|
202
198
|
|
|
203
199
|
if (terminal) {
|
|
204
200
|
return {
|
|
@@ -219,7 +215,7 @@ async function remediate(idxResponse, values, options) {
|
|
|
219
215
|
try {
|
|
220
216
|
idxResponse = await idxResponse.actions[action]();
|
|
221
217
|
} catch (e) {
|
|
222
|
-
return handleIdxError(e,
|
|
218
|
+
return handleIdxError(e, remediators);
|
|
223
219
|
}
|
|
224
220
|
|
|
225
221
|
if (action === 'cancel') {
|
|
@@ -274,7 +270,7 @@ async function remediate(idxResponse, values, options) {
|
|
|
274
270
|
|
|
275
271
|
|
|
276
272
|
const terminal = isTerminalResponse(idxResponse);
|
|
277
|
-
const messages = getIdxMessages(idxResponse,
|
|
273
|
+
const messages = getIdxMessages(idxResponse, remediators);
|
|
278
274
|
|
|
279
275
|
if (terminal) {
|
|
280
276
|
return {
|
|
@@ -297,7 +293,7 @@ async function remediate(idxResponse, values, options) {
|
|
|
297
293
|
values = remediator.getValuesAfterProceed();
|
|
298
294
|
return remediate(idxResponse, values, options); // recursive call
|
|
299
295
|
} catch (e) {
|
|
300
|
-
return handleIdxError(e,
|
|
296
|
+
return handleIdxError(e, remediators, remediator);
|
|
301
297
|
}
|
|
302
298
|
}
|
|
303
299
|
//# sourceMappingURL=remediate.js.map
|