@okta/okta-auth-js 7.4.3 → 7.5.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 +22 -0
- package/README.md +1 -1
- package/cjs/browser/fingerprint.js +1 -2
- package/cjs/browser/fingerprint.js.map +1 -1
- package/cjs/core/ServiceManager/browser.js +3 -4
- package/cjs/core/ServiceManager/browser.js.map +1 -1
- package/cjs/core/types/api.js.map +1 -1
- package/cjs/fetch/fetchRequest.js +1 -2
- package/cjs/fetch/fetchRequest.js.map +1 -1
- package/cjs/http/OktaUserAgent.js +2 -2
- package/cjs/http/request.js +11 -5
- package/cjs/http/request.js.map +1 -1
- package/cjs/http/types.js.map +1 -1
- package/cjs/idx/IdxTransactionManager.js +1 -1
- package/cjs/idx/IdxTransactionManager.js.map +1 -1
- package/cjs/idx/authenticator/OktaPassword.js +1 -2
- package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
- package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +1 -2
- package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
- package/cjs/idx/authenticator/getAuthenticator.js +3 -4
- package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
- package/cjs/idx/factory/MinimalOktaAuthIdx.js +20 -0
- package/cjs/idx/factory/MinimalOktaAuthIdx.js.map +1 -0
- package/cjs/idx/factory/api.js +9 -0
- package/cjs/idx/factory/api.js.map +1 -1
- package/cjs/idx/factory/index.js +11 -0
- package/cjs/idx/factory/index.js.map +1 -1
- package/cjs/idx/factory/minimalApi.js +41 -0
- package/cjs/idx/factory/minimalApi.js.map +1 -0
- package/cjs/idx/flow/AccountUnlockFlow.js +2 -1
- package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -1
- package/cjs/idx/flow/AuthenticationFlow.js +1 -0
- package/cjs/idx/flow/AuthenticationFlow.js.map +1 -1
- package/cjs/idx/flow/FlowSpecification.js.map +1 -1
- package/cjs/idx/flow/PasswordRecoveryFlow.js +1 -0
- package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
- package/cjs/idx/idxState/index.js +1 -1
- package/cjs/idx/idxState/index.js.map +1 -1
- package/cjs/idx/idxState/v1/generateIdxAction.js +2 -2
- package/cjs/idx/idxState/v1/generateIdxAction.js.map +1 -1
- package/cjs/idx/idxState/v1/idxResponseParser.js +11 -10
- package/cjs/idx/idxState/v1/idxResponseParser.js.map +1 -1
- package/cjs/idx/idxState/v1/makeIdxState.js +1 -2
- package/cjs/idx/idxState/v1/makeIdxState.js.map +1 -1
- package/cjs/idx/idxState/v1/parsers.js +1 -4
- package/cjs/idx/idxState/v1/parsers.js.map +1 -1
- package/cjs/idx/idxState/v1/remediationParser.js +4 -5
- package/cjs/idx/idxState/v1/remediationParser.js.map +1 -1
- package/cjs/idx/interact.js +1 -2
- package/cjs/idx/interact.js.map +1 -1
- package/cjs/idx/mixinMinimal.js +19 -0
- package/cjs/idx/mixinMinimal.js.map +1 -0
- package/cjs/idx/poll.js +3 -5
- package/cjs/idx/poll.js.map +1 -1
- package/cjs/idx/proceed.js +1 -1
- package/cjs/idx/proceed.js.map +1 -1
- package/cjs/idx/remediators/Base/AuthenticatorData.js +1 -1
- package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
- package/cjs/idx/remediators/Base/Remediator.js +5 -7
- package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
- package/cjs/idx/remediators/Base/SelectAuthenticator.js +3 -4
- package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js +1 -2
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/EnrollPoll.js +1 -1
- package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
- package/cjs/idx/remediators/Identify.js.map +1 -1
- package/cjs/idx/remediators/ReEnrollAuthenticatorWarning.js +22 -0
- package/cjs/idx/remediators/ReEnrollAuthenticatorWarning.js.map +1 -0
- package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +2 -3
- package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
- package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +2 -3
- package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -1
- package/cjs/idx/remediators/SelectEnrollmentChannel.js +1 -2
- package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
- package/cjs/idx/remediators/index.js +11 -0
- package/cjs/idx/remediators/index.js.map +1 -1
- package/cjs/idx/remediators/util.js +2 -4
- package/cjs/idx/remediators/util.js.map +1 -1
- package/cjs/idx/run.js +7 -10
- package/cjs/idx/run.js.map +1 -1
- package/cjs/idx/transactionMeta.js +1 -1
- package/cjs/idx/transactionMeta.js.map +1 -1
- package/cjs/idx/types/FlowSpecification.js +2 -0
- package/cjs/idx/types/FlowSpecification.js.map +1 -0
- package/cjs/idx/types/api.js.map +1 -1
- package/cjs/idx/types/index.js.map +1 -1
- package/cjs/idx/util.js +23 -10
- package/cjs/idx/util.js.map +1 -1
- package/cjs/myaccount/emailApi.js +11 -15
- package/cjs/myaccount/emailApi.js.map +1 -1
- package/cjs/myaccount/passwordApi.js +8 -10
- package/cjs/myaccount/passwordApi.js.map +1 -1
- package/cjs/myaccount/phoneApi.js +7 -9
- package/cjs/myaccount/phoneApi.js.map +1 -1
- package/cjs/myaccount/profileApi.js +7 -9
- package/cjs/myaccount/profileApi.js.map +1 -1
- package/cjs/myaccount/request.js +18 -27
- package/cjs/myaccount/request.js.map +1 -1
- package/cjs/myaccount/transactions/Base.js.map +1 -1
- package/cjs/myaccount/transactions/EmailChallengeTransaction.js +4 -4
- package/cjs/myaccount/transactions/EmailChallengeTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/EmailTransaction.js +8 -9
- package/cjs/myaccount/transactions/EmailTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/PasswordTransaction.js +6 -9
- package/cjs/myaccount/transactions/PasswordTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/PhoneTransaction.js +2 -3
- package/cjs/myaccount/transactions/PhoneTransaction.js.map +1 -1
- package/cjs/myaccount/types.js +1 -52
- package/cjs/myaccount/types.js.map +1 -1
- package/cjs/oidc/TokenManager.js +4 -4
- package/cjs/oidc/TokenManager.js.map +1 -1
- package/cjs/oidc/TransactionManager.js +1 -1
- package/cjs/oidc/TransactionManager.js.map +1 -1
- package/cjs/oidc/factory/baseApi.js +29 -0
- package/cjs/oidc/factory/baseApi.js.map +1 -0
- package/cjs/oidc/getToken.js +1 -2
- package/cjs/oidc/getToken.js.map +1 -1
- package/cjs/oidc/introspect.js +3 -5
- package/cjs/oidc/introspect.js.map +1 -1
- package/cjs/oidc/mixin/index.js +6 -13
- package/cjs/oidc/mixin/index.js.map +1 -1
- package/cjs/oidc/mixin/minimal.js +29 -0
- package/cjs/oidc/mixin/minimal.js.map +1 -0
- package/cjs/oidc/renewTokens.js +1 -2
- package/cjs/oidc/renewTokens.js.map +1 -1
- package/cjs/oidc/types/api.js.map +1 -1
- package/cjs/oidc/util/errors.js +2 -2
- package/cjs/oidc/util/errors.js.map +1 -1
- package/cjs/oidc/util/loginRedirect.js +10 -0
- package/cjs/oidc/util/loginRedirect.js.map +1 -1
- package/cjs/oidc/util/validateClaims.js +1 -1
- package/cjs/oidc/util/validateClaims.js.map +1 -1
- package/cjs/oidc/verifyToken.js +1 -1
- package/cjs/oidc/verifyToken.js.map +1 -1
- package/cjs/services/LeaderElectionService.js +3 -6
- package/cjs/services/LeaderElectionService.js.map +1 -1
- package/cjs/services/SyncStorageService.js +6 -11
- package/cjs/services/SyncStorageService.js.map +1 -1
- package/dist/okta-auth-js.authn.min.analyzer.html +2 -2
- package/dist/okta-auth-js.authn.min.js +1 -1
- package/dist/okta-auth-js.authn.min.js.map +1 -1
- package/dist/okta-auth-js.core.min.analyzer.html +2 -2
- package/dist/okta-auth-js.core.min.js +1 -1
- package/dist/okta-auth-js.core.min.js.map +1 -1
- package/dist/okta-auth-js.idx.min.analyzer.html +2 -2
- package/dist/okta-auth-js.idx.min.js +1 -1
- package/dist/okta-auth-js.idx.min.js.map +1 -1
- package/dist/okta-auth-js.min.analyzer.html +2 -2
- package/dist/okta-auth-js.min.js +1 -1
- package/dist/okta-auth-js.min.js.map +1 -1
- package/dist/okta-auth-js.myaccount.min.analyzer.html +2 -2
- package/dist/okta-auth-js.myaccount.min.js +1 -1
- package/dist/okta-auth-js.myaccount.min.js.map +1 -1
- package/esm/browser/exports/exports/authn.js +1 -1
- package/esm/browser/exports/exports/core.js +1 -1
- package/esm/browser/exports/exports/default.js +2 -9
- package/esm/browser/exports/exports/default.js.map +1 -1
- package/esm/browser/exports/exports/idx.js +2 -1
- package/esm/browser/exports/exports/idx.js.map +1 -1
- package/esm/browser/exports/exports/myaccount.js +1 -9
- package/esm/browser/exports/exports/myaccount.js.map +1 -1
- package/esm/browser/http/OktaUserAgent.js +2 -2
- package/esm/browser/http/request.js +7 -1
- package/esm/browser/http/request.js.map +1 -1
- package/esm/browser/idx/cancel.js +1 -0
- package/esm/browser/idx/cancel.js.map +1 -1
- package/esm/browser/idx/factory/MinimalOktaAuthIdx.js +31 -0
- package/esm/browser/idx/factory/MinimalOktaAuthIdx.js.map +1 -0
- package/esm/browser/idx/factory/api.js +7 -0
- package/esm/browser/idx/factory/api.js.map +1 -1
- package/esm/browser/idx/factory/minimalApi.js +38 -0
- package/esm/browser/idx/factory/minimalApi.js.map +1 -0
- package/esm/browser/idx/flow/AccountUnlockFlow.js +2 -0
- package/esm/browser/idx/flow/AccountUnlockFlow.js.map +1 -1
- package/esm/browser/idx/flow/AuthenticationFlow.js +2 -0
- package/esm/browser/idx/flow/AuthenticationFlow.js.map +1 -1
- package/esm/browser/idx/flow/FlowSpecification.js.map +1 -1
- package/esm/browser/idx/flow/PasswordRecoveryFlow.js +2 -0
- package/esm/browser/idx/flow/PasswordRecoveryFlow.js.map +1 -1
- package/esm/browser/idx/flow/RegistrationFlow.js +1 -0
- package/esm/browser/idx/flow/RegistrationFlow.js.map +1 -1
- package/esm/browser/idx/idxState/v1/idxResponseParser.js +4 -4
- package/esm/browser/idx/idxState/v1/idxResponseParser.js.map +1 -1
- package/esm/browser/idx/idxState/v1/makeIdxState.js.map +1 -1
- package/esm/browser/idx/idxState/v1/parsers.js.map +1 -1
- package/esm/browser/idx/idxState/v1/remediationParser.js +1 -6
- package/esm/browser/idx/idxState/v1/remediationParser.js.map +1 -1
- package/esm/browser/idx/mixinMinimal.js +29 -0
- package/esm/browser/idx/mixinMinimal.js.map +1 -0
- package/esm/browser/idx/recoverPassword.js +1 -0
- package/esm/browser/idx/recoverPassword.js.map +1 -1
- package/esm/browser/idx/remediators/Base/Remediator.js.map +1 -1
- package/esm/browser/idx/remediators/Identify.js.map +1 -1
- package/esm/browser/idx/remediators/ReEnrollAuthenticatorWarning.js +20 -0
- package/esm/browser/idx/remediators/ReEnrollAuthenticatorWarning.js.map +1 -0
- package/esm/browser/idx/remediators/index.js +1 -0
- package/esm/browser/idx/remediators/index.js.map +1 -1
- package/esm/browser/idx/run.js +4 -22
- package/esm/browser/idx/run.js.map +1 -1
- package/esm/browser/idx/types/api.js.map +1 -1
- package/esm/browser/idx/util.js +16 -3
- package/esm/browser/idx/util.js.map +1 -1
- package/esm/browser/myaccount/emailApi.js +9 -11
- package/esm/browser/myaccount/emailApi.js.map +1 -1
- package/esm/browser/myaccount/passwordApi.js +4 -6
- package/esm/browser/myaccount/passwordApi.js.map +1 -1
- package/esm/browser/myaccount/phoneApi.js +5 -6
- package/esm/browser/myaccount/phoneApi.js.map +1 -1
- package/esm/browser/myaccount/profileApi.js +6 -6
- package/esm/browser/myaccount/profileApi.js.map +1 -1
- package/esm/browser/myaccount/request.js +13 -28
- package/esm/browser/myaccount/request.js.map +1 -1
- package/esm/browser/myaccount/transactions/Base.js.map +1 -1
- package/esm/browser/myaccount/transactions/EmailChallengeTransaction.js +3 -3
- package/esm/browser/myaccount/transactions/EmailChallengeTransaction.js.map +1 -1
- package/esm/browser/myaccount/transactions/EmailTransaction.js +5 -6
- package/esm/browser/myaccount/transactions/EmailTransaction.js.map +1 -1
- package/esm/browser/myaccount/transactions/PasswordTransaction.js +3 -6
- package/esm/browser/myaccount/transactions/PasswordTransaction.js.map +1 -1
- package/esm/browser/myaccount/transactions/PhoneTransaction.js +1 -2
- package/esm/browser/myaccount/transactions/PhoneTransaction.js.map +1 -1
- package/esm/browser/myaccount/types.js +0 -4
- package/esm/browser/myaccount/types.js.map +1 -1
- package/esm/browser/oidc/TokenManager.js +3 -2
- package/esm/browser/oidc/TokenManager.js.map +1 -1
- package/esm/browser/oidc/factory/baseApi.js +28 -0
- package/esm/browser/oidc/factory/baseApi.js.map +1 -0
- package/esm/browser/oidc/introspect.js +1 -1
- package/esm/browser/oidc/introspect.js.map +1 -1
- package/esm/browser/oidc/mixin/index.js +2 -9
- package/esm/browser/oidc/mixin/index.js.map +1 -1
- package/esm/browser/oidc/mixin/minimal.js +45 -0
- package/esm/browser/oidc/mixin/minimal.js.map +1 -0
- package/esm/browser/oidc/util/loginRedirect.js +11 -1
- package/esm/browser/oidc/util/loginRedirect.js.map +1 -1
- package/esm/browser/oidc/util/validateClaims.js +2 -1
- package/esm/browser/oidc/util/validateClaims.js.map +1 -1
- package/esm/browser/package.json +1 -1
- package/esm/node/exports/exports/authn.js +1 -1
- package/esm/node/exports/exports/core.js +1 -1
- package/esm/node/exports/exports/default.js +2 -9
- package/esm/node/exports/exports/default.js.map +1 -1
- package/esm/node/exports/exports/idx.js +2 -1
- package/esm/node/exports/exports/idx.js.map +1 -1
- package/esm/node/exports/exports/myaccount.js +1 -9
- package/esm/node/exports/exports/myaccount.js.map +1 -1
- package/esm/node/fetch/fetchRequest.js +1 -1
- package/esm/node/fetch/fetchRequest.js.map +1 -1
- package/esm/node/http/OktaUserAgent.js +2 -2
- package/esm/node/http/request.js +7 -1
- package/esm/node/http/request.js.map +1 -1
- package/esm/node/idx/cancel.js +1 -0
- package/esm/node/idx/cancel.js.map +1 -1
- package/esm/node/idx/factory/MinimalOktaAuthIdx.js +31 -0
- package/esm/node/idx/factory/MinimalOktaAuthIdx.js.map +1 -0
- package/esm/node/idx/factory/api.js +7 -0
- package/esm/node/idx/factory/api.js.map +1 -1
- package/esm/node/idx/factory/minimalApi.js +38 -0
- package/esm/node/idx/factory/minimalApi.js.map +1 -0
- package/esm/node/idx/flow/AccountUnlockFlow.js +2 -0
- package/esm/node/idx/flow/AccountUnlockFlow.js.map +1 -1
- package/esm/node/idx/flow/AuthenticationFlow.js +2 -0
- package/esm/node/idx/flow/AuthenticationFlow.js.map +1 -1
- package/esm/node/idx/flow/FlowSpecification.js.map +1 -1
- package/esm/node/idx/flow/PasswordRecoveryFlow.js +2 -0
- package/esm/node/idx/flow/PasswordRecoveryFlow.js.map +1 -1
- package/esm/node/idx/flow/RegistrationFlow.js +1 -0
- package/esm/node/idx/flow/RegistrationFlow.js.map +1 -1
- package/esm/node/idx/idxState/v1/idxResponseParser.js +4 -4
- package/esm/node/idx/idxState/v1/idxResponseParser.js.map +1 -1
- package/esm/node/idx/idxState/v1/makeIdxState.js.map +1 -1
- package/esm/node/idx/idxState/v1/parsers.js.map +1 -1
- package/esm/node/idx/idxState/v1/remediationParser.js +1 -6
- package/esm/node/idx/idxState/v1/remediationParser.js.map +1 -1
- package/esm/node/idx/mixinMinimal.js +29 -0
- package/esm/node/idx/mixinMinimal.js.map +1 -0
- package/esm/node/idx/recoverPassword.js +1 -0
- package/esm/node/idx/recoverPassword.js.map +1 -1
- package/esm/node/idx/remediators/Base/Remediator.js.map +1 -1
- package/esm/node/idx/remediators/Identify.js.map +1 -1
- package/esm/node/idx/remediators/ReEnrollAuthenticatorWarning.js +20 -0
- package/esm/node/idx/remediators/ReEnrollAuthenticatorWarning.js.map +1 -0
- package/esm/node/idx/remediators/index.js +1 -0
- package/esm/node/idx/remediators/index.js.map +1 -1
- package/esm/node/idx/run.js +4 -22
- package/esm/node/idx/run.js.map +1 -1
- package/esm/node/idx/types/api.js.map +1 -1
- package/esm/node/idx/util.js +16 -3
- package/esm/node/idx/util.js.map +1 -1
- package/esm/node/myaccount/emailApi.js +9 -11
- package/esm/node/myaccount/emailApi.js.map +1 -1
- package/esm/node/myaccount/passwordApi.js +4 -6
- package/esm/node/myaccount/passwordApi.js.map +1 -1
- package/esm/node/myaccount/phoneApi.js +5 -6
- package/esm/node/myaccount/phoneApi.js.map +1 -1
- package/esm/node/myaccount/profileApi.js +6 -6
- package/esm/node/myaccount/profileApi.js.map +1 -1
- package/esm/node/myaccount/request.js +13 -28
- package/esm/node/myaccount/request.js.map +1 -1
- package/esm/node/myaccount/transactions/Base.js.map +1 -1
- package/esm/node/myaccount/transactions/EmailChallengeTransaction.js +3 -3
- package/esm/node/myaccount/transactions/EmailChallengeTransaction.js.map +1 -1
- package/esm/node/myaccount/transactions/EmailTransaction.js +5 -6
- package/esm/node/myaccount/transactions/EmailTransaction.js.map +1 -1
- package/esm/node/myaccount/transactions/PasswordTransaction.js +3 -6
- package/esm/node/myaccount/transactions/PasswordTransaction.js.map +1 -1
- package/esm/node/myaccount/transactions/PhoneTransaction.js +1 -2
- package/esm/node/myaccount/transactions/PhoneTransaction.js.map +1 -1
- package/esm/node/myaccount/types.js +0 -5
- package/esm/node/myaccount/types.js.map +1 -1
- package/esm/node/oidc/TokenManager.js +3 -2
- package/esm/node/oidc/TokenManager.js.map +1 -1
- package/esm/node/oidc/factory/baseApi.js +29 -0
- package/esm/node/oidc/factory/baseApi.js.map +1 -0
- package/esm/node/oidc/introspect.js +1 -1
- package/esm/node/oidc/introspect.js.map +1 -1
- package/esm/node/oidc/mixin/index.js +2 -9
- package/esm/node/oidc/mixin/index.js.map +1 -1
- package/esm/node/oidc/mixin/minimal.js +46 -0
- package/esm/node/oidc/mixin/minimal.js.map +1 -0
- package/esm/node/oidc/util/loginRedirect.js +11 -1
- package/esm/node/oidc/util/loginRedirect.js.map +1 -1
- package/esm/node/oidc/util/validateClaims.js +2 -1
- package/esm/node/oidc/util/validateClaims.js.map +1 -1
- package/esm/node/package.json +1 -1
- package/package.json +4 -4
- package/types/lib/core/types/api.d.ts +1 -0
- package/types/lib/http/types.d.ts +1 -1
- package/types/lib/idx/factory/MinimalOktaAuthIdx.d.ts +8 -0
- package/types/lib/idx/factory/index.d.ts +1 -0
- package/types/lib/idx/factory/minimalApi.d.ts +14 -0
- package/types/lib/idx/flow/FlowSpecification.d.ts +1 -8
- package/types/lib/idx/idxState/v1/idxResponseParser.d.ts +4 -3
- package/types/lib/idx/idxState/v1/remediationParser.d.ts +2 -2
- package/types/lib/idx/mixinMinimal.d.ts +6 -0
- package/types/lib/idx/remediators/Base/Remediator.d.ts +1 -0
- package/types/lib/idx/remediators/Identify.d.ts +1 -0
- package/types/lib/idx/remediators/ReEnrollAuthenticatorWarning.d.ts +15 -0
- package/types/lib/idx/remediators/index.d.ts +1 -0
- package/types/lib/idx/types/FlowSpecification.d.ts +8 -0
- package/types/lib/idx/types/api.d.ts +18 -2
- package/types/lib/idx/types/index.d.ts +1 -0
- package/types/lib/idx/util.d.ts +10 -2
- package/types/lib/myaccount/emailApi.d.ts +2 -1
- package/types/lib/myaccount/passwordApi.d.ts +2 -1
- package/types/lib/myaccount/phoneApi.d.ts +2 -1
- package/types/lib/myaccount/profileApi.d.ts +2 -1
- package/types/lib/myaccount/request.d.ts +4 -16
- package/types/lib/myaccount/transactions/Base.d.ts +14 -1
- package/types/lib/myaccount/transactions/EmailTransaction.d.ts +2 -1
- package/types/lib/myaccount/types.d.ts +1 -1
- package/types/lib/oidc/factory/baseApi.d.ts +14 -0
- package/types/lib/oidc/mixin/minimal.d.ts +4 -0
- package/types/lib/oidc/types/api.d.ts +8 -0
- package/types/lib/oidc/util/loginRedirect.d.ts +2 -1
- package/umd/authn.js +1 -1
- package/umd/authn.js.map +1 -1
- package/umd/core.js +1 -1
- package/umd/core.js.map +1 -1
- package/umd/default.js +1 -1
- package/umd/default.js.map +1 -1
- package/umd/idx.js +1 -1
- package/umd/idx.js.map +1 -1
- package/umd/myaccount.js +1 -1
- package/umd/myaccount.js.map +1 -1
package/cjs/idx/factory/index.js
CHANGED
|
@@ -22,4 +22,15 @@ Object.keys(_OktaAuthIdx).forEach(function (key) {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
|
+
var _MinimalOktaAuthIdx = require("./MinimalOktaAuthIdx");
|
|
26
|
+
Object.keys(_MinimalOktaAuthIdx).forEach(function (key) {
|
|
27
|
+
if (key === "default" || key === "__esModule") return;
|
|
28
|
+
if (key in exports && exports[key] === _MinimalOktaAuthIdx[key]) return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _MinimalOktaAuthIdx[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
25
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/idx/factory/index.ts"],"sourcesContent":["export * from './api';\nexport * from './OktaAuthIdx';\n"],"mappings":";;AAAA;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":"index.js","names":[],"sources":["../../../../lib/idx/factory/index.ts"],"sourcesContent":["export * from './api';\nexport * from './OktaAuthIdx';\nexport * from './MinimalOktaAuthIdx';\n"],"mappings":";;AAAA;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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.createMinimalIdxAPI = createMinimalIdxAPI;
|
|
4
|
+
var _idxState = require("../idxState");
|
|
5
|
+
var _proceed = require("../proceed");
|
|
6
|
+
var _startTransaction = require("../startTransaction");
|
|
7
|
+
var _transactionMeta = require("../transactionMeta");
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
10
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
11
|
+
*
|
|
12
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
15
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
*
|
|
17
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
// Factory
|
|
22
|
+
function createMinimalIdxAPI(minimalSdk) {
|
|
23
|
+
const sdk = minimalSdk;
|
|
24
|
+
const boundStartTransaction = _startTransaction.startTransaction.bind(null, sdk);
|
|
25
|
+
const idx = {
|
|
26
|
+
makeIdxResponse: _idxState.makeIdxState.bind(null, sdk),
|
|
27
|
+
start: boundStartTransaction,
|
|
28
|
+
startTransaction: boundStartTransaction,
|
|
29
|
+
// Use `start` instead. `startTransaction` will be removed in 7.0
|
|
30
|
+
proceed: _proceed.proceed.bind(null, sdk),
|
|
31
|
+
canProceed: _proceed.canProceed.bind(null, sdk),
|
|
32
|
+
getSavedTransactionMeta: _transactionMeta.getSavedTransactionMeta.bind(null, sdk),
|
|
33
|
+
createTransactionMeta: _transactionMeta.createTransactionMeta.bind(null, sdk),
|
|
34
|
+
getTransactionMeta: _transactionMeta.getTransactionMeta.bind(null, sdk),
|
|
35
|
+
saveTransactionMeta: _transactionMeta.saveTransactionMeta.bind(null, sdk),
|
|
36
|
+
clearTransactionMeta: _transactionMeta.clearTransactionMeta.bind(null, sdk),
|
|
37
|
+
isTransactionMetaValid: _transactionMeta.isTransactionMetaValid
|
|
38
|
+
};
|
|
39
|
+
return idx;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=minimalApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimalApi.js","names":["createMinimalIdxAPI","minimalSdk","sdk","boundStartTransaction","startTransaction","bind","idx","makeIdxResponse","makeIdxState","start","proceed","canProceed","getSavedTransactionMeta","createTransactionMeta","getTransactionMeta","saveTransactionMeta","clearTransactionMeta","isTransactionMetaValid"],"sources":["../../../../lib/idx/factory/minimalApi.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\n\nimport { makeIdxState } from '../idxState';\nimport { canProceed, proceed } from '../proceed';\nimport { startTransaction } from '../startTransaction';\nimport {\n clearTransactionMeta,\n createTransactionMeta,\n getSavedTransactionMeta,\n getTransactionMeta,\n isTransactionMetaValid,\n saveTransactionMeta\n} from '../transactionMeta';\nimport { MinimalIdxAPI, MinimalOktaAuthIdxInterface, OktaAuthIdxInterface } from '../types';\n\n// Factory\nexport function createMinimalIdxAPI(minimalSdk: MinimalOktaAuthIdxInterface): MinimalIdxAPI {\n const sdk = minimalSdk as OktaAuthIdxInterface;\n const boundStartTransaction = startTransaction.bind(null, sdk);\n const idx = {\n makeIdxResponse: makeIdxState.bind(null, sdk),\n\n start: boundStartTransaction,\n startTransaction: boundStartTransaction, // Use `start` instead. `startTransaction` will be removed in 7.0\n proceed: proceed.bind(null, sdk),\n canProceed: canProceed.bind(null, sdk),\n \n getSavedTransactionMeta: getSavedTransactionMeta.bind(null, sdk),\n createTransactionMeta: createTransactionMeta.bind(null, sdk),\n getTransactionMeta: getTransactionMeta.bind(null, sdk),\n saveTransactionMeta: saveTransactionMeta.bind(null, sdk),\n clearTransactionMeta: clearTransactionMeta.bind(null, sdk),\n isTransactionMetaValid,\n };\n return idx;\n}\n\n"],"mappings":";;;AAaA;AACA;AACA;AACA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACO,SAASA,mBAAmB,CAACC,UAAuC,EAAiB;EAC1F,MAAMC,GAAG,GAAGD,UAAkC;EAC9C,MAAME,qBAAqB,GAAGC,kCAAgB,CAACC,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;EAC9D,MAAMI,GAAG,GAAG;IACVC,eAAe,EAAEC,sBAAY,CAACH,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;IAE7CO,KAAK,EAAEN,qBAAqB;IAC5BC,gBAAgB,EAAED,qBAAqB;IAAE;IACzCO,OAAO,EAAEA,gBAAO,CAACL,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;IAChCS,UAAU,EAAEA,mBAAU,CAACN,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;IAEtCU,uBAAuB,EAAEA,wCAAuB,CAACP,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;IAChEW,qBAAqB,EAAEA,sCAAqB,CAACR,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;IAC5DY,kBAAkB,EAAEA,mCAAkB,CAACT,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;IACtDa,mBAAmB,EAAEA,oCAAmB,CAACV,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;IACxDc,oBAAoB,EAAEA,qCAAoB,CAACX,IAAI,CAAC,IAAI,EAAEH,GAAG,CAAC;IAC1De,sBAAsB,EAAtBA;EACF,CAAC;EACD,OAAOX,GAAG;AACZ"}
|
|
@@ -23,7 +23,8 @@ const AccountUnlockFlow = {
|
|
|
23
23
|
'select-authenticator-authenticate': _remediators.SelectAuthenticatorAuthenticate,
|
|
24
24
|
'challenge-authenticator': _remediators.ChallengeAuthenticator,
|
|
25
25
|
'challenge-poll': _remediators.ChallengePoll,
|
|
26
|
-
'authenticator-verification-data': _remediators.AuthenticatorVerificationData
|
|
26
|
+
'authenticator-verification-data': _remediators.AuthenticatorVerificationData,
|
|
27
|
+
'reenroll-authenticator-warning': _remediators.ReEnrollAuthenticatorWarning
|
|
27
28
|
};
|
|
28
29
|
exports.AccountUnlockFlow = AccountUnlockFlow;
|
|
29
30
|
//# sourceMappingURL=AccountUnlockFlow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountUnlockFlow.js","names":["AccountUnlockFlow","Identify","SelectAuthenticatorUnlockAccount","SelectAuthenticatorAuthenticate","ChallengeAuthenticator","ChallengePoll","AuthenticatorVerificationData"],"sources":["../../../../lib/idx/flow/AccountUnlockFlow.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { RemediationFlow } from './RemediationFlow';\nimport {\n Identify,\n SelectAuthenticatorUnlockAccount,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n ChallengePoll,\n AuthenticatorVerificationData\n} from '../remediators';\n\nexport const AccountUnlockFlow: RemediationFlow = {\n 'identify': Identify,\n // NOTE: unlock-account is purposely not included. Handled as action\n // because it's a rememdiation which requires no input\n // 'unlock-account': UnlockAccount,\n 'select-authenticator-unlock-account': SelectAuthenticatorUnlockAccount,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'challenge-poll': ChallengePoll,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n};\n"],"mappings":";;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"AccountUnlockFlow.js","names":["AccountUnlockFlow","Identify","SelectAuthenticatorUnlockAccount","SelectAuthenticatorAuthenticate","ChallengeAuthenticator","ChallengePoll","AuthenticatorVerificationData","ReEnrollAuthenticatorWarning"],"sources":["../../../../lib/idx/flow/AccountUnlockFlow.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { RemediationFlow } from './RemediationFlow';\nimport {\n Identify,\n SelectAuthenticatorUnlockAccount,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n ChallengePoll,\n AuthenticatorVerificationData,\n ReEnrollAuthenticatorWarning\n} from '../remediators';\n\nexport const AccountUnlockFlow: RemediationFlow = {\n 'identify': Identify,\n // NOTE: unlock-account is purposely not included. Handled as action\n // because it's a rememdiation which requires no input\n // 'unlock-account': UnlockAccount,\n 'select-authenticator-unlock-account': SelectAuthenticatorUnlockAccount,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'challenge-poll': ChallengePoll,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'reenroll-authenticator-warning': ReEnrollAuthenticatorWarning,\n};\n"],"mappings":";;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcO,MAAMA,iBAAkC,GAAG;EAChD,UAAU,EAAEC,qBAAQ;EACpB;EACA;EACA;EACA,qCAAqC,EAAEC,6CAAgC;EACvE,mCAAmC,EAAEC,4CAA+B;EACpE,yBAAyB,EAAEC,mCAAsB;EACjD,gBAAgB,EAAEC,0BAAa;EAC/B,iCAAiC,EAAEC,0CAA6B;EAChE,gCAAgC,EAAEC;AACpC,CAAC;AAAC"}
|
|
@@ -24,6 +24,7 @@ const AuthenticationFlow = {
|
|
|
24
24
|
'challenge-authenticator': _remediators.ChallengeAuthenticator,
|
|
25
25
|
'challenge-poll': _remediators.ChallengePoll,
|
|
26
26
|
'reenroll-authenticator': _remediators.ReEnrollAuthenticator,
|
|
27
|
+
'reenroll-authenticator-warning': _remediators.ReEnrollAuthenticatorWarning,
|
|
27
28
|
'enroll-poll': _remediators.EnrollPoll,
|
|
28
29
|
'select-enrollment-channel': _remediators.SelectEnrollmentChannel,
|
|
29
30
|
'enrollment-channel-data': _remediators.EnrollmentChannelData,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticationFlow.js","names":["AuthenticationFlow","Identify","SelectAuthenticatorAuthenticate","SelectAuthenticatorEnroll","AuthenticatorEnrollmentData","AuthenticatorVerificationData","EnrollAuthenticator","ChallengeAuthenticator","ChallengePoll","ReEnrollAuthenticator","EnrollPoll","SelectEnrollmentChannel","EnrollmentChannelData","RedirectIdp","Skip"],"sources":["../../../../lib/idx/flow/AuthenticationFlow.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { RemediationFlow } from './RemediationFlow';\nimport { \n Identify,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n ReEnrollAuthenticator,\n RedirectIdp,\n AuthenticatorEnrollmentData,\n SelectAuthenticatorEnroll,\n EnrollAuthenticator,\n AuthenticatorVerificationData,\n EnrollPoll,\n ChallengePoll,\n SelectEnrollmentChannel,\n EnrollmentChannelData,\n Skip\n} from '../remediators';\n\nexport const AuthenticationFlow: RemediationFlow = {\n 'identify': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'enroll-authenticator': EnrollAuthenticator,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'challenge-poll': ChallengePoll,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n 'enroll-poll': EnrollPoll,\n 'select-enrollment-channel': SelectEnrollmentChannel,\n 'enrollment-channel-data': EnrollmentChannelData,\n 'redirect-idp': RedirectIdp,\n 'skip': Skip,\n};\n"],"mappings":";;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"AuthenticationFlow.js","names":["AuthenticationFlow","Identify","SelectAuthenticatorAuthenticate","SelectAuthenticatorEnroll","AuthenticatorEnrollmentData","AuthenticatorVerificationData","EnrollAuthenticator","ChallengeAuthenticator","ChallengePoll","ReEnrollAuthenticator","ReEnrollAuthenticatorWarning","EnrollPoll","SelectEnrollmentChannel","EnrollmentChannelData","RedirectIdp","Skip"],"sources":["../../../../lib/idx/flow/AuthenticationFlow.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { RemediationFlow } from './RemediationFlow';\nimport { \n Identify,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n ReEnrollAuthenticator,\n ReEnrollAuthenticatorWarning,\n RedirectIdp,\n AuthenticatorEnrollmentData,\n SelectAuthenticatorEnroll,\n EnrollAuthenticator,\n AuthenticatorVerificationData,\n EnrollPoll,\n ChallengePoll,\n SelectEnrollmentChannel,\n EnrollmentChannelData,\n Skip\n} from '../remediators';\n\nexport const AuthenticationFlow: RemediationFlow = {\n 'identify': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'enroll-authenticator': EnrollAuthenticator,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'challenge-poll': ChallengePoll,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n 'reenroll-authenticator-warning': ReEnrollAuthenticatorWarning,\n 'enroll-poll': EnrollPoll,\n 'select-enrollment-channel': SelectEnrollmentChannel,\n 'enrollment-channel-data': EnrollmentChannelData,\n 'redirect-idp': RedirectIdp,\n 'skip': Skip,\n};\n"],"mappings":";;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsBO,MAAMA,kBAAmC,GAAG;EACjD,UAAU,EAAEC,qBAAQ;EACpB,mCAAmC,EAAEC,4CAA+B;EACpE,6BAA6B,EAAEC,sCAAyB;EACxD,+BAA+B,EAAEC,wCAA2B;EAC5D,iCAAiC,EAAEC,0CAA6B;EAChE,sBAAsB,EAAEC,gCAAmB;EAC3C,yBAAyB,EAAEC,mCAAsB;EACjD,gBAAgB,EAAEC,0BAAa;EAC/B,wBAAwB,EAAEC,kCAAqB;EAC/C,gCAAgC,EAAEC,yCAA4B;EAC9D,aAAa,EAAEC,uBAAU;EACzB,2BAA2B,EAAEC,oCAAuB;EACpD,yBAAyB,EAAEC,kCAAqB;EAChD,cAAc,EAAEC,wBAAW;EAC3B,MAAM,EAAEC;AACV,CAAC;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowSpecification.js","names":["getFlowSpecification","oktaAuth","flow","remediators","actions","withCredentials","RegistrationFlow","PasswordRecoveryFlow","AccountUnlockFlow","AuthenticationFlow"],"sources":["../../../../lib/idx/flow/FlowSpecification.ts"],"sourcesContent":["import { OktaAuthIdxInterface, FlowIdentifier } from '../types';\nimport { AuthenticationFlow } from './AuthenticationFlow';\nimport { PasswordRecoveryFlow } from './PasswordRecoveryFlow';\nimport { RegistrationFlow } from './RegistrationFlow';\nimport { AccountUnlockFlow } from './AccountUnlockFlow';\
|
|
1
|
+
{"version":3,"file":"FlowSpecification.js","names":["getFlowSpecification","oktaAuth","flow","remediators","actions","withCredentials","RegistrationFlow","PasswordRecoveryFlow","AccountUnlockFlow","AuthenticationFlow"],"sources":["../../../../lib/idx/flow/FlowSpecification.ts"],"sourcesContent":["import { OktaAuthIdxInterface, FlowIdentifier, FlowSpecification } from '../types';\nimport { AuthenticationFlow } from './AuthenticationFlow';\nimport { PasswordRecoveryFlow } from './PasswordRecoveryFlow';\nimport { RegistrationFlow } from './RegistrationFlow';\nimport { AccountUnlockFlow } from './AccountUnlockFlow';\n\n// eslint-disable-next-line complexity\nexport function getFlowSpecification(\n oktaAuth: OktaAuthIdxInterface,\n flow: FlowIdentifier = 'default'\n): FlowSpecification {\n let remediators, actions, withCredentials = true;\n switch (flow) {\n case 'register':\n case 'signup':\n case 'enrollProfile':\n remediators = RegistrationFlow;\n withCredentials = false;\n break;\n case 'recoverPassword':\n case 'resetPassword':\n remediators = PasswordRecoveryFlow;\n actions = [\n 'currentAuthenticator-recover', \n 'currentAuthenticatorEnrollment-recover'\n ];\n withCredentials = false;\n break;\n case 'unlockAccount':\n remediators = AccountUnlockFlow;\n withCredentials = false;\n actions = [\n 'unlock-account'\n ];\n break;\n case 'authenticate':\n case 'login':\n case 'signin':\n remediators = AuthenticationFlow;\n break;\n default:\n // default case has no flow monitor\n remediators = AuthenticationFlow;\n break;\n }\n return { flow, remediators, actions, withCredentials };\n}\n"],"mappings":";;;AACA;AACA;AACA;AACA;AAEA;AACO,SAASA,oBAAoB,CAClCC,QAA8B,EAC9BC,IAAoB,GAAG,SAAS,EACb;EACnB,IAAIC,WAAW;IAAEC,OAAO;IAAEC,eAAe,GAAG,IAAI;EAChD,QAAQH,IAAI;IACV,KAAK,UAAU;IACf,KAAK,QAAQ;IACb,KAAK,eAAe;MAClBC,WAAW,GAAGG,kCAAgB;MAC9BD,eAAe,GAAG,KAAK;MACvB;IACF,KAAK,iBAAiB;IACtB,KAAK,eAAe;MAClBF,WAAW,GAAGI,0CAAoB;MAClCH,OAAO,GAAG,CACR,8BAA8B,EAC9B,wCAAwC,CACzC;MACDC,eAAe,GAAG,KAAK;MACvB;IACF,KAAK,eAAe;MAClBF,WAAW,GAAGK,oCAAiB;MAC/BH,eAAe,GAAG,KAAK;MACvBD,OAAO,GAAG,CACR,gBAAgB,CACjB;MACD;IACF,KAAK,cAAc;IACnB,KAAK,OAAO;IACZ,KAAK,QAAQ;MACXD,WAAW,GAAGM,sCAAkB;MAChC;IACF;MACE;MACAN,WAAW,GAAGM,sCAAkB;MAChC;EAAM;EAEV,OAAO;IAAEP,IAAI;IAAEC,WAAW;IAAEC,OAAO;IAAEC;EAAgB,CAAC;AACxD"}
|
|
@@ -24,6 +24,7 @@ const PasswordRecoveryFlow = {
|
|
|
24
24
|
'authenticator-enrollment-data': _remediators.AuthenticatorEnrollmentData,
|
|
25
25
|
'reset-authenticator': _remediators.ResetAuthenticator,
|
|
26
26
|
'reenroll-authenticator': _remediators.ReEnrollAuthenticator,
|
|
27
|
+
'reenroll-authenticator-warning': _remediators.ReEnrollAuthenticatorWarning,
|
|
27
28
|
'enroll-poll': _remediators.EnrollPoll
|
|
28
29
|
};
|
|
29
30
|
exports.PasswordRecoveryFlow = PasswordRecoveryFlow;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordRecoveryFlow.js","names":["PasswordRecoveryFlow","Identify","SelectAuthenticatorAuthenticate","SelectAuthenticatorEnroll","ChallengeAuthenticator","AuthenticatorVerificationData","AuthenticatorEnrollmentData","ResetAuthenticator","ReEnrollAuthenticator","EnrollPoll"],"sources":["../../../../lib/idx/flow/PasswordRecoveryFlow.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { RemediationFlow } from './RemediationFlow';\nimport {\n Identify,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n AuthenticatorVerificationData,\n ResetAuthenticator,\n ReEnrollAuthenticator,\n SelectAuthenticatorEnroll,\n AuthenticatorEnrollmentData,\n EnrollPoll\n} from '../remediators';\n\nexport const PasswordRecoveryFlow: RemediationFlow = {\n 'identify': Identify,\n 'identify-recovery': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'reset-authenticator': ResetAuthenticator,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n 'enroll-poll': EnrollPoll,\n};\n"],"mappings":";;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"PasswordRecoveryFlow.js","names":["PasswordRecoveryFlow","Identify","SelectAuthenticatorAuthenticate","SelectAuthenticatorEnroll","ChallengeAuthenticator","AuthenticatorVerificationData","AuthenticatorEnrollmentData","ResetAuthenticator","ReEnrollAuthenticator","ReEnrollAuthenticatorWarning","EnrollPoll"],"sources":["../../../../lib/idx/flow/PasswordRecoveryFlow.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { RemediationFlow } from './RemediationFlow';\nimport {\n Identify,\n SelectAuthenticatorAuthenticate,\n ChallengeAuthenticator,\n AuthenticatorVerificationData,\n ResetAuthenticator,\n ReEnrollAuthenticator,\n ReEnrollAuthenticatorWarning,\n SelectAuthenticatorEnroll,\n AuthenticatorEnrollmentData,\n EnrollPoll\n} from '../remediators';\n\nexport const PasswordRecoveryFlow: RemediationFlow = {\n 'identify': Identify,\n 'identify-recovery': Identify,\n 'select-authenticator-authenticate': SelectAuthenticatorAuthenticate,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'challenge-authenticator': ChallengeAuthenticator,\n 'authenticator-verification-data': AuthenticatorVerificationData,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'reset-authenticator': ResetAuthenticator,\n 'reenroll-authenticator': ReEnrollAuthenticator,\n 'reenroll-authenticator-warning': ReEnrollAuthenticatorWarning,\n 'enroll-poll': EnrollPoll,\n};\n"],"mappings":";;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBO,MAAMA,oBAAqC,GAAG;EACnD,UAAU,EAAEC,qBAAQ;EACpB,mBAAmB,EAAEA,qBAAQ;EAC7B,mCAAmC,EAAEC,4CAA+B;EACpE,6BAA6B,EAAEC,sCAAyB;EACxD,yBAAyB,EAAEC,mCAAsB;EACjD,iCAAiC,EAAEC,0CAA6B;EAChE,+BAA+B,EAAEC,wCAA2B;EAC5D,qBAAqB,EAAEC,+BAAkB;EACzC,wBAAwB,EAAEC,kCAAqB;EAC/C,gCAAgC,EAAEC,yCAA4B;EAC9D,aAAa,EAAEC;AACjB,CAAC;AAAC"}
|
|
@@ -33,7 +33,7 @@ function validateVersionConfig(version) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function makeIdxState(authClient, rawIdxResponse, toPersist, requestDidSucceed) {
|
|
36
|
-
const version =
|
|
36
|
+
const version = rawIdxResponse?.version ?? _constants.IDX_API_VERSION;
|
|
37
37
|
validateVersionConfig(version);
|
|
38
38
|
const {
|
|
39
39
|
makeIdxState
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["parsersForVersion","version","v1","undefined","Error","validateVersionConfig","cleanVersion","replace","makeIdxState","authClient","rawIdxResponse","toPersist","requestDidSucceed","IDX_API_VERSION"],"sources":["../../../../lib/idx/idxState/index.ts"],"sourcesContent":["import { OktaAuthIdxInterface } from '../types'; // auth-js/types\nimport { IdxResponse, IdxToPersist, RawIdxResponse } from '../types/idx-js'; // idx/types\nimport { IDX_API_VERSION } from '../../constants';\nimport v1 from './v1/parsers';\n\n\nexport const parsersForVersion = function parsersForVersion( version ) {\n switch (version) {\n case '1.0.0':\n return v1;\n case undefined:\n case null:\n throw new Error('Api version is required');\n default:\n throw new Error(`Unknown api version: ${version}. Use an exact semver version.`);\n }\n};\n\nexport function validateVersionConfig(version) {\n if ( !version ) {\n throw new Error('version is required');\n }\n\n const cleanVersion = (version ?? '').replace(/[^0-9a-zA-Z._-]/, '');\n if ( cleanVersion !== version || !version ) {\n throw new Error('invalid version supplied - version is required and uses semver syntax');\n }\n\n parsersForVersion(version); // will throw for invalid version\n}\n\nexport function makeIdxState ( \n authClient: OktaAuthIdxInterface,\n rawIdxResponse: RawIdxResponse,\n toPersist: IdxToPersist,\n requestDidSucceed: boolean,\n): IdxResponse {\n const version = rawIdxResponse?.version ?? IDX_API_VERSION;\n validateVersionConfig(version);\n \n const { makeIdxState } = parsersForVersion(version);\n return makeIdxState(authClient, rawIdxResponse, toPersist, requestDidSucceed);\n}\n"],"mappings":";;;;;;AAEA;AACA;AAHoD;AAC8B;;AAK3E,MAAMA,iBAAiB,GAAG,SAASA,iBAAiB,CAAEC,OAAO,EAAG;EACrE,QAAQA,OAAO;IACb,KAAK,OAAO;MACV,OAAOC,gBAAE;IACX,KAAKC,SAAS;IACd,KAAK,IAAI;MACP,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;IAC5C;MACE,MAAM,IAAIA,KAAK,CAAE,wBAAuBH,OAAQ,iCAAgC,CAAC;EAAC;AAExF,CAAC;AAAC;AAEK,SAASI,qBAAqB,CAACJ,OAAO,EAAE;EAC7C,IAAK,CAACA,OAAO,EAAG;IACd,MAAM,IAAIG,KAAK,CAAC,qBAAqB,CAAC;EACxC;EAEA,MAAME,YAAY,GAAG,CAACL,OAAO,IAAI,EAAE,EAAEM,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;EACnE,IAAKD,YAAY,KAAKL,OAAO,IAAI,CAACA,OAAO,EAAG;IAC1C,MAAM,IAAIG,KAAK,CAAC,uEAAuE,CAAC;EAC1F;EAEAJ,iBAAiB,CAACC,OAAO,CAAC,CAAC,CAAC;AAC9B;;AAEO,SAASO,YAAY,CAC1BC,UAAgC,EAChCC,cAA8B,EAC9BC,SAAuB,EACvBC,iBAA0B,EACb;EACb,MAAMX,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","names":["parsersForVersion","version","v1","undefined","Error","validateVersionConfig","cleanVersion","replace","makeIdxState","authClient","rawIdxResponse","toPersist","requestDidSucceed","IDX_API_VERSION"],"sources":["../../../../lib/idx/idxState/index.ts"],"sourcesContent":["import { OktaAuthIdxInterface } from '../types'; // auth-js/types\nimport { IdxResponse, IdxToPersist, RawIdxResponse } from '../types/idx-js'; // idx/types\nimport { IDX_API_VERSION } from '../../constants';\nimport v1 from './v1/parsers';\n\n\nexport const parsersForVersion = function parsersForVersion( version ) {\n switch (version) {\n case '1.0.0':\n return v1;\n case undefined:\n case null:\n throw new Error('Api version is required');\n default:\n throw new Error(`Unknown api version: ${version}. Use an exact semver version.`);\n }\n};\n\nexport function validateVersionConfig(version) {\n if ( !version ) {\n throw new Error('version is required');\n }\n\n const cleanVersion = (version ?? '').replace(/[^0-9a-zA-Z._-]/, '');\n if ( cleanVersion !== version || !version ) {\n throw new Error('invalid version supplied - version is required and uses semver syntax');\n }\n\n parsersForVersion(version); // will throw for invalid version\n}\n\nexport function makeIdxState ( \n authClient: OktaAuthIdxInterface,\n rawIdxResponse: RawIdxResponse,\n toPersist: IdxToPersist,\n requestDidSucceed: boolean,\n): IdxResponse {\n const version = rawIdxResponse?.version ?? IDX_API_VERSION;\n validateVersionConfig(version);\n \n const { makeIdxState } = parsersForVersion(version);\n return makeIdxState(authClient, rawIdxResponse, toPersist, requestDidSucceed);\n}\n"],"mappings":";;;;;;AAEA;AACA;AAHoD;AAC8B;;AAK3E,MAAMA,iBAAiB,GAAG,SAASA,iBAAiB,CAAEC,OAAO,EAAG;EACrE,QAAQA,OAAO;IACb,KAAK,OAAO;MACV,OAAOC,gBAAE;IACX,KAAKC,SAAS;IACd,KAAK,IAAI;MACP,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;IAC5C;MACE,MAAM,IAAIA,KAAK,CAAE,wBAAuBH,OAAQ,iCAAgC,CAAC;EAAC;AAExF,CAAC;AAAC;AAEK,SAASI,qBAAqB,CAACJ,OAAO,EAAE;EAC7C,IAAK,CAACA,OAAO,EAAG;IACd,MAAM,IAAIG,KAAK,CAAC,qBAAqB,CAAC;EACxC;EAEA,MAAME,YAAY,GAAG,CAACL,OAAO,IAAI,EAAE,EAAEM,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;EACnE,IAAKD,YAAY,KAAKL,OAAO,IAAI,CAACA,OAAO,EAAG;IAC1C,MAAM,IAAIG,KAAK,CAAC,uEAAuE,CAAC;EAC1F;EAEAJ,iBAAiB,CAACC,OAAO,CAAC,CAAC,CAAC;AAC9B;;AAEO,SAASO,YAAY,CAC1BC,UAAgC,EAChCC,cAA8B,EAC9BC,SAAuB,EACvBC,iBAA0B,EACb;EACb,MAAMX,OAAO,GAAGS,cAAc,EAAET,OAAO,IAAIY,0BAAe;EAC1DR,qBAAqB,CAACJ,OAAO,CAAC;EAE9B,MAAM;IAAEO;EAAa,CAAC,GAAGR,iBAAiB,CAACC,OAAO,CAAC;EACnD,OAAOO,YAAY,CAACC,UAAU,EAAEC,cAAc,EAAEC,SAAS,EAAEC,iBAAiB,CAAC;AAC/E"}
|
|
@@ -42,13 +42,13 @@ const generateDirectFetch = function generateDirectFetch(authClient, {
|
|
|
42
42
|
method: actionDefinition.method,
|
|
43
43
|
headers,
|
|
44
44
|
args: body,
|
|
45
|
-
withCredentials:
|
|
45
|
+
withCredentials: toPersist?.withCredentials ?? true
|
|
46
46
|
});
|
|
47
47
|
return authClient.idx.makeIdxResponse({
|
|
48
48
|
...response
|
|
49
49
|
}, toPersist, true);
|
|
50
50
|
} catch (err) {
|
|
51
|
-
if (!(err instanceof _AuthApiError.default) || !
|
|
51
|
+
if (!(err instanceof _AuthApiError.default) || !err?.xhr) {
|
|
52
52
|
throw err;
|
|
53
53
|
}
|
|
54
54
|
const response = err.xhr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateIdxAction.js","names":["generateDirectFetch","authClient","actionDefinition","defaultParamsForAction","immutableParamsForAction","toPersist","target","href","params","headers","accepts","body","JSON","stringify","response","httpRequest","url","method","args","withCredentials","idx","makeIdxResponse","err","AuthApiError","xhr","payload","responseJSON","parse","responseText","wwwAuthHeader","idxResponse","status","stepUp","generateIdxAction","generator","defaultParams","neededParams","immutableParams","divideActionParamsByMutability","action","name"],"sources":["../../../../../lib/idx/idxState/v1/generateIdxAction.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, complexity */\nimport { httpRequest } from '../../../http';\nimport { OktaAuthIdxInterface } from '../../types'; // auth-js/types\nimport { IdxActionFunction, IdxActionParams, IdxResponse, IdxToPersist } from '../../types/idx-js';\nimport { divideActionParamsByMutability } from './actionParser';\nimport AuthApiError from '../../../errors/AuthApiError';\n\nconst generateDirectFetch = function generateDirectFetch(authClient: OktaAuthIdxInterface, { \n actionDefinition, \n defaultParamsForAction = {}, \n immutableParamsForAction = {}, \n toPersist = {} as IdxToPersist\n}): IdxActionFunction {\n const target = actionDefinition.href;\n return async function(params: IdxActionParams = {}): Promise<IdxResponse> {\n const headers = {\n 'Content-Type': 'application/json',\n 'Accept': actionDefinition.accepts || 'application/ion+json',\n };\n const body = JSON.stringify({\n ...defaultParamsForAction,\n ...params,\n ...immutableParamsForAction\n });\n\n try {\n const response = await httpRequest(authClient, {\n url: target,\n method: actionDefinition.method,\n headers,\n args: body,\n withCredentials: toPersist?.withCredentials ?? true\n });\n\n return authClient.idx.makeIdxResponse({ ...response }, toPersist, true);\n }\n catch (err) {\n if (!(err instanceof AuthApiError) || !err?.xhr) {\n throw err;\n }\n\n const response = err.xhr;\n const payload = response.responseJSON || JSON.parse(response.responseText);\n const wwwAuthHeader = response.headers['WWW-Authenticate'] || response.headers['www-authenticate'];\n\n const idxResponse = authClient.idx.makeIdxResponse({ ...payload }, toPersist, false);\n if (response.status === 401 && wwwAuthHeader === 'Oktadevicejwt realm=\"Okta Device\"') {\n // Okta server responds 401 status code with WWW-Authenticate header and new remediation\n // so that the iOS/MacOS credential SSO extension (Okta Verify) can intercept\n // the response reaches here when Okta Verify is not installed\n // set `stepUp` to true if flow should be continued without showing any errors\n idxResponse.stepUp = true;\n }\n\n return idxResponse;\n }\n };\n};\n\n// TODO: Resolve in M2: Either build the final polling solution or remove this code\n// const generatePollingFetch = function generatePollingFetch( { actionDefinition, defaultParamsForAction = {}, immutableParamsForAction = {} } ) {\n// // TODO: Discussions ongoing about when/how to terminate polling: OKTA-246581\n// const target = actionDefinition.href;\n// return async function(params) {\n// return fetch(target, {\n// method: actionDefinition.method,\n// headers: {\n// 'content-type': actionDefinition.accepts,\n// },\n// body: JSON.stringify({ ...defaultParamsForAction, ...params, ...immutableParamsForAction })\n// })\n// .then( response => response.ok ? response.json() : response.json().then( err => Promise.reject(err)) )\n// .then( idxResponse => makeIdxState(authClient, idxResponse) );\n// };\n// };\n\nconst generateIdxAction = function generateIdxAction( authClient: OktaAuthIdxInterface, actionDefinition, toPersist ): IdxActionFunction {\n // TODO: leaving this here to see where the polling is EXPECTED to drop into the code, but removing any accidental trigger of incomplete code\n // const generator = actionDefinition.refresh ? generatePollingFetch : generateDirectFetch;\n const generator = generateDirectFetch;\n const { defaultParams, neededParams, immutableParams } = divideActionParamsByMutability( actionDefinition );\n\n const action = generator(authClient, {\n actionDefinition,\n defaultParamsForAction: defaultParams[actionDefinition.name],\n immutableParamsForAction: immutableParams[actionDefinition.name],\n toPersist\n });\n action.neededParams = neededParams;\n return action;\n};\n\nexport default generateIdxAction;\n"],"mappings":";;;;AAaA;AAGA;AACA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAOA,MAAMA,mBAAmB,GAAG,SAASA,mBAAmB,CAACC,UAAgC,EAAE;EACzFC,gBAAgB;EAChBC,sBAAsB,GAAG,CAAC,CAAC;EAC3BC,wBAAwB,GAAG,CAAC,CAAC;EAC7BC,SAAS,GAAG,CAAC;AACf,CAAC,EAAqB;EACpB,MAAMC,MAAM,GAAGJ,gBAAgB,CAACK,IAAI;EACpC,OAAO,gBAAeC,MAAuB,GAAG,CAAC,CAAC,EAAwB;IACxE,MAAMC,OAAO,GAAG;MACd,cAAc,EAAE,kBAAkB;MAClC,QAAQ,EAAEP,gBAAgB,CAACQ,OAAO,IAAI;IACxC,CAAC;IACD,MAAMC,IAAI,GAAGC,IAAI,CAACC,SAAS,CAAC;MAC1B,GAAGV,sBAAsB;MACzB,GAAGK,MAAM;MACT,GAAGJ;IACL,CAAC,CAAC;IAEF,IAAI;MACF,MAAMU,QAAQ,GAAG,MAAM,IAAAC,iBAAW,EAACd,UAAU,EAAE;QAC7Ce,GAAG,EAAEV,MAAM;QACXW,MAAM,EAAEf,gBAAgB,CAACe,MAAM;QAC/BR,OAAO;QACPS,IAAI,EAAEP,IAAI;QACVQ,eAAe,
|
|
1
|
+
{"version":3,"file":"generateIdxAction.js","names":["generateDirectFetch","authClient","actionDefinition","defaultParamsForAction","immutableParamsForAction","toPersist","target","href","params","headers","accepts","body","JSON","stringify","response","httpRequest","url","method","args","withCredentials","idx","makeIdxResponse","err","AuthApiError","xhr","payload","responseJSON","parse","responseText","wwwAuthHeader","idxResponse","status","stepUp","generateIdxAction","generator","defaultParams","neededParams","immutableParams","divideActionParamsByMutability","action","name"],"sources":["../../../../../lib/idx/idxState/v1/generateIdxAction.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, complexity */\nimport { httpRequest } from '../../../http';\nimport { OktaAuthIdxInterface } from '../../types'; // auth-js/types\nimport { IdxActionFunction, IdxActionParams, IdxResponse, IdxToPersist } from '../../types/idx-js';\nimport { divideActionParamsByMutability } from './actionParser';\nimport AuthApiError from '../../../errors/AuthApiError';\n\nconst generateDirectFetch = function generateDirectFetch(authClient: OktaAuthIdxInterface, { \n actionDefinition, \n defaultParamsForAction = {}, \n immutableParamsForAction = {}, \n toPersist = {} as IdxToPersist\n}): IdxActionFunction {\n const target = actionDefinition.href;\n return async function(params: IdxActionParams = {}): Promise<IdxResponse> {\n const headers = {\n 'Content-Type': 'application/json',\n 'Accept': actionDefinition.accepts || 'application/ion+json',\n };\n const body = JSON.stringify({\n ...defaultParamsForAction,\n ...params,\n ...immutableParamsForAction\n });\n\n try {\n const response = await httpRequest(authClient, {\n url: target,\n method: actionDefinition.method,\n headers,\n args: body,\n withCredentials: toPersist?.withCredentials ?? true\n });\n\n return authClient.idx.makeIdxResponse({ ...response }, toPersist, true);\n }\n catch (err) {\n if (!(err instanceof AuthApiError) || !err?.xhr) {\n throw err;\n }\n\n const response = err.xhr;\n const payload = response.responseJSON || JSON.parse(response.responseText);\n const wwwAuthHeader = response.headers['WWW-Authenticate'] || response.headers['www-authenticate'];\n\n const idxResponse = authClient.idx.makeIdxResponse({ ...payload }, toPersist, false);\n if (response.status === 401 && wwwAuthHeader === 'Oktadevicejwt realm=\"Okta Device\"') {\n // Okta server responds 401 status code with WWW-Authenticate header and new remediation\n // so that the iOS/MacOS credential SSO extension (Okta Verify) can intercept\n // the response reaches here when Okta Verify is not installed\n // set `stepUp` to true if flow should be continued without showing any errors\n idxResponse.stepUp = true;\n }\n\n return idxResponse;\n }\n };\n};\n\n// TODO: Resolve in M2: Either build the final polling solution or remove this code\n// const generatePollingFetch = function generatePollingFetch( { actionDefinition, defaultParamsForAction = {}, immutableParamsForAction = {} } ) {\n// // TODO: Discussions ongoing about when/how to terminate polling: OKTA-246581\n// const target = actionDefinition.href;\n// return async function(params) {\n// return fetch(target, {\n// method: actionDefinition.method,\n// headers: {\n// 'content-type': actionDefinition.accepts,\n// },\n// body: JSON.stringify({ ...defaultParamsForAction, ...params, ...immutableParamsForAction })\n// })\n// .then( response => response.ok ? response.json() : response.json().then( err => Promise.reject(err)) )\n// .then( idxResponse => makeIdxState(authClient, idxResponse) );\n// };\n// };\n\nconst generateIdxAction = function generateIdxAction( authClient: OktaAuthIdxInterface, actionDefinition, toPersist ): IdxActionFunction {\n // TODO: leaving this here to see where the polling is EXPECTED to drop into the code, but removing any accidental trigger of incomplete code\n // const generator = actionDefinition.refresh ? generatePollingFetch : generateDirectFetch;\n const generator = generateDirectFetch;\n const { defaultParams, neededParams, immutableParams } = divideActionParamsByMutability( actionDefinition );\n\n const action = generator(authClient, {\n actionDefinition,\n defaultParamsForAction: defaultParams[actionDefinition.name],\n immutableParamsForAction: immutableParams[actionDefinition.name],\n toPersist\n });\n action.neededParams = neededParams;\n return action;\n};\n\nexport default generateIdxAction;\n"],"mappings":"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"}
|
|
@@ -19,14 +19,15 @@ var _errors = require("../../../errors");
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
/* eslint-disable max-len */
|
|
22
|
-
|
|
23
|
-
// @ts-nocheck
|
|
22
|
+
|
|
24
23
|
// auth-js/types
|
|
25
24
|
|
|
26
|
-
const SKIP_FIELDS =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const SKIP_FIELDS = {
|
|
26
|
+
'remediation': true,
|
|
27
|
+
// remediations are put into proceed/neededToProceed
|
|
28
|
+
'context': true // the API response of 'context' isn't externally useful. We ignore it and put all non-action (contextual) info into idxState.context
|
|
29
|
+
};
|
|
30
|
+
|
|
30
31
|
const parseNonRemediations = function parseNonRemediations(authClient, idxResponse, toPersist = {}) {
|
|
31
32
|
const actions = {};
|
|
32
33
|
const context = {};
|
|
@@ -64,6 +65,8 @@ const parseNonRemediations = function parseNonRemediations(authClient, idxRespon
|
|
|
64
65
|
if (value.rel) {
|
|
65
66
|
// is [field].value[subField] an action?
|
|
66
67
|
// add any "action" value subfields to actions
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
69
|
+
// @ts-ignore
|
|
67
70
|
actions[`${field}-${subField.name || subField}`] = (0, _generateIdxAction.default)(authClient, value, toPersist);
|
|
68
71
|
} else {
|
|
69
72
|
// add non-action value subfields to context
|
|
@@ -112,12 +115,10 @@ const convertRemediationAction = (authClient, remediation, toPersist) => {
|
|
|
112
115
|
return remediation;
|
|
113
116
|
};
|
|
114
117
|
const parseIdxResponse = function parseIdxResponse(authClient, idxResponse, toPersist = {}) {
|
|
115
|
-
|
|
116
|
-
const remediationData = ((_idxResponse$remediat = idxResponse.remediation) === null || _idxResponse$remediat === void 0 ? void 0 : _idxResponse$remediat.value) || [];
|
|
118
|
+
const remediationData = idxResponse.remediation?.value || [];
|
|
117
119
|
remediationData.forEach(remediation => {
|
|
118
|
-
var _remediation$relatesT;
|
|
119
120
|
// TODO: remove once IDX is fixed - OKTA-659181
|
|
120
|
-
if (remediation.name === 'launch-authenticator' &&
|
|
121
|
+
if (remediation.name === 'launch-authenticator' && remediation?.relatesTo?.[0] === 'authenticatorChallenge' && !idxResponse?.authenticatorChallenge) {
|
|
121
122
|
delete remediation.relatesTo;
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idxResponseParser.js","names":["SKIP_FIELDS","
|
|
1
|
+
{"version":3,"file":"idxResponseParser.js","names":["SKIP_FIELDS","parseNonRemediations","authClient","idxResponse","toPersist","actions","context","Object","keys","filter","field","forEach","fieldIsObject","rel","name","generateIdxAction","value","fieldValue","type","info","entries","subField","expandRelatesTo","k","query","Array","isArray","result","jsonpath","path","json","AuthSdkError","innerValue","convertRemediationAction","remediation","remediationActions","generateRemediationFunctions","actionFn","action","parseIdxResponse","remediationData","relatesTo","authenticatorChallenge","remediations","map"],"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\nimport { OktaAuthIdxInterface, IdxResponse, IdxRemediation, IdxContext } from '../../types'; // auth-js/types\nimport { IdxActions } from '../../types/idx-js';\nimport { generateRemediationFunctions } from './remediationParser';\nimport generateIdxAction from './generateIdxAction';\nimport { jsonpath } from '../../../util/jsonpath';\nimport { AuthSdkError } from '../../../errors';\n\nconst SKIP_FIELDS = {\n 'remediation': true, // remediations are put into proceed/neededToProceed\n 'context': true, // the API response of 'context' isn't externally useful. We ignore it and put all non-action (contextual) info into idxState.context\n};\n\nexport const parseNonRemediations = function parseNonRemediations( authClient: OktaAuthIdxInterface, idxResponse: IdxResponse, toPersist = {} ) {\n const actions = {};\n const context = {} as IdxContext;\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<IdxRemediation>(fieldValue)\n .forEach( ([subField, value]) => {\n if (value.rel) { // is [field].value[subField] an action?\n // add any \"action\" value subfields to actions\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\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 } else {\n throw new AuthSdkError(`Cannot resolve relatesTo: ${query}`);\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 => {\n // TODO: remove once IDX is fixed - OKTA-659181\n if (remediation.name === 'launch-authenticator' &&\n remediation?.relatesTo?.[0] === 'authenticatorChallenge' &&\n !idxResponse?.authenticatorChallenge\n ) {\n delete remediation.relatesTo;\n return;\n }\n\n return expandRelatesTo(idxResponse, remediation);\n }\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":"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"}
|
|
@@ -17,7 +17,6 @@ var _idxResponseParser = require("./idxResponseParser");
|
|
|
17
17
|
// auth-js/types
|
|
18
18
|
|
|
19
19
|
function makeIdxState(authClient, idxResponse, toPersist, requestDidSucceed) {
|
|
20
|
-
var _rawIdxResponse$succe, _rawIdxResponse$succe2, _rawIdxResponse$succe3;
|
|
21
20
|
const rawIdxResponse = idxResponse;
|
|
22
21
|
const {
|
|
23
22
|
remediations,
|
|
@@ -43,7 +42,7 @@ function makeIdxState(authClient, idxResponse, toPersist, requestDidSucceed) {
|
|
|
43
42
|
return remediationChoiceObject.action(paramsFromUser);
|
|
44
43
|
};
|
|
45
44
|
const findCode = item => item.name === 'interaction_code';
|
|
46
|
-
const interactionCode =
|
|
45
|
+
const interactionCode = rawIdxResponse.successWithInteractionCode?.value?.find(findCode)?.value;
|
|
47
46
|
return {
|
|
48
47
|
proceed,
|
|
49
48
|
neededToProceed,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeIdxState.js","names":["makeIdxState","authClient","idxResponse","toPersist","requestDidSucceed","rawIdxResponse","remediations","context","actions","parseIdxResponse","neededToProceed","proceed","remediationChoice","paramsFromUser","remediationChoiceObject","find","remediation","name","Promise","reject","actionFn","action","findCode","item","interactionCode","successWithInteractionCode","value","rawIdxState"],"sources":["../../../../../lib/idx/idxState/v1/makeIdxState.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 { IdxResponse, IdxToPersist } from '../../types/idx-js';\nimport { OktaAuthIdxInterface, RawIdxResponse } from '../../types'; // auth-js/types\nimport { parseIdxResponse } from './idxResponseParser';\n\nexport function makeIdxState( \n authClient: OktaAuthIdxInterface,\n idxResponse: RawIdxResponse,\n toPersist: IdxToPersist,\n requestDidSucceed: boolean\n): IdxResponse {\n const rawIdxResponse = idxResponse;\n const { remediations, context, actions } = parseIdxResponse( authClient, idxResponse, toPersist );\n const neededToProceed = [...remediations];\n\n const proceed: IdxResponse['proceed'] = async function( remediationChoice, paramsFromUser = {} ) {\n /*\n remediationChoice is the name attribute on each form\n name should remain unique for items inside the remediation that are considered forms(identify, select-factor)\n name can be duplicate for items like redirect where its not considered a form(redirect)\n when names are not unique its a redirect to a href, so widget wont POST to idx-js layer.\n */\n const remediationChoiceObject = remediations.find((remediation) => remediation.name === remediationChoice);\n if ( !remediationChoiceObject ) {\n return Promise.reject(`Unknown remediation choice: [${remediationChoice}]`);\n }\n\n const actionFn = remediationChoiceObject.action;\n if (typeof actionFn !== 'function') {\n return Promise.reject(`Current remediation cannot make form submit action: [${remediationChoice}]`);\n }\n\n return remediationChoiceObject.action(paramsFromUser);\n };\n\n const findCode = item => item.name === 'interaction_code';\n const interactionCode = rawIdxResponse.successWithInteractionCode?.value?.find( findCode )?.value as string;\n\n return {\n proceed,\n neededToProceed,\n actions,\n context,\n rawIdxState: rawIdxResponse,\n interactionCode,\n toPersist,\n requestDidSucceed,\n };\n}\n"],"mappings":";;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGuE;;AAGhE,SAASA,YAAY,CAC1BC,UAAgC,EAChCC,WAA2B,EAC3BC,SAAuB,EACvBC,iBAA0B,EACb;
|
|
1
|
+
{"version":3,"file":"makeIdxState.js","names":["makeIdxState","authClient","idxResponse","toPersist","requestDidSucceed","rawIdxResponse","remediations","context","actions","parseIdxResponse","neededToProceed","proceed","remediationChoice","paramsFromUser","remediationChoiceObject","find","remediation","name","Promise","reject","actionFn","action","findCode","item","interactionCode","successWithInteractionCode","value","rawIdxState"],"sources":["../../../../../lib/idx/idxState/v1/makeIdxState.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 { IdxResponse, IdxToPersist, IdxActionParams } from '../../types/idx-js';\nimport { OktaAuthIdxInterface, RawIdxResponse } from '../../types'; // auth-js/types\nimport { parseIdxResponse } from './idxResponseParser';\n\nexport function makeIdxState( \n authClient: OktaAuthIdxInterface,\n idxResponse: RawIdxResponse,\n toPersist: IdxToPersist,\n requestDidSucceed: boolean\n): IdxResponse {\n const rawIdxResponse = idxResponse;\n const { remediations, context, actions } = parseIdxResponse( authClient, idxResponse, toPersist );\n const neededToProceed = [...remediations];\n\n const proceed: IdxResponse['proceed'] = async function( remediationChoice, paramsFromUser = {} ) {\n /*\n remediationChoice is the name attribute on each form\n name should remain unique for items inside the remediation that are considered forms(identify, select-factor)\n name can be duplicate for items like redirect where its not considered a form(redirect)\n when names are not unique its a redirect to a href, so widget wont POST to idx-js layer.\n */\n const remediationChoiceObject = remediations.find((remediation) => remediation.name === remediationChoice);\n if ( !remediationChoiceObject ) {\n return Promise.reject(`Unknown remediation choice: [${remediationChoice}]`);\n }\n\n const actionFn = remediationChoiceObject.action;\n if (typeof actionFn !== 'function') {\n return Promise.reject(`Current remediation cannot make form submit action: [${remediationChoice}]`);\n }\n\n return remediationChoiceObject.action!(paramsFromUser as IdxActionParams);\n };\n\n const findCode = item => item.name === 'interaction_code';\n const interactionCode = rawIdxResponse.successWithInteractionCode?.value?.find( findCode )?.value as string;\n\n return {\n proceed,\n neededToProceed,\n actions,\n context,\n rawIdxState: rawIdxResponse,\n interactionCode,\n toPersist,\n requestDidSucceed,\n };\n}\n"],"mappings":";;;AAcA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGuE;;AAGhE,SAASA,YAAY,CAC1BC,UAAgC,EAChCC,WAA2B,EAC3BC,SAAuB,EACvBC,iBAA0B,EACb;EACb,MAAMC,cAAc,GAAIH,WAAW;EACnC,MAAM;IAAEI,YAAY;IAAEC,OAAO;IAAEC;EAAQ,CAAC,GAAG,IAAAC,mCAAgB,EAAER,UAAU,EAAEC,WAAW,EAAEC,SAAS,CAAE;EACjG,MAAMO,eAAe,GAAG,CAAC,GAAGJ,YAAY,CAAC;EAEzC,MAAMK,OAA+B,GAAG,gBAAgBC,iBAAiB,EAAEC,cAAc,GAAG,CAAC,CAAC,EAAG;IAC/F;AACJ;AACA;AACA;AACA;AACA;IACI,MAAMC,uBAAuB,GAAGR,YAAY,CAACS,IAAI,CAAEC,WAAW,IAAKA,WAAW,CAACC,IAAI,KAAKL,iBAAiB,CAAC;IAC1G,IAAK,CAACE,uBAAuB,EAAG;MAC9B,OAAOI,OAAO,CAACC,MAAM,CAAE,gCAA+BP,iBAAkB,GAAE,CAAC;IAC7E;IAEA,MAAMQ,QAAQ,GAAGN,uBAAuB,CAACO,MAAM;IAC/C,IAAI,OAAOD,QAAQ,KAAK,UAAU,EAAE;MAClC,OAAOF,OAAO,CAACC,MAAM,CAAE,wDAAuDP,iBAAkB,GAAE,CAAC;IACrG;IAEA,OAAOE,uBAAuB,CAACO,MAAM,CAAER,cAAc,CAAoB;EAC3E,CAAC;EAED,MAAMS,QAAQ,GAAGC,IAAI,IAAIA,IAAI,CAACN,IAAI,KAAK,kBAAkB;EACzD,MAAMO,eAAe,GAAGnB,cAAc,CAACoB,0BAA0B,EAAEC,KAAK,EAAEX,IAAI,CAAEO,QAAQ,CAAE,EAAEI,KAAe;EAE3G,OAAO;IACLf,OAAO;IACPD,eAAe;IACfF,OAAO;IACPD,OAAO;IACPoB,WAAW,EAAEtB,cAAc;IAC3BmB,eAAe;IACfrB,SAAS;IACTC;EACF,CAAC;AACH"}
|
|
@@ -12,10 +12,7 @@ var _makeIdxState = require("./makeIdxState");
|
|
|
12
12
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
*
|
|
14
14
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17
|
-
// @ts-nocheck
|
|
18
|
-
var _default = {
|
|
15
|
+
*/var _default = {
|
|
19
16
|
makeIdxState: _makeIdxState.makeIdxState
|
|
20
17
|
};
|
|
21
18
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.js","names":["makeIdxState"],"sources":["../../../../../lib/idx/idxState/v1/parsers.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\
|
|
1
|
+
{"version":3,"file":"parsers.js","names":["makeIdxState"],"sources":["../../../../../lib/idx/idxState/v1/parsers.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 { makeIdxState } from './makeIdxState';\n\nexport default {\n makeIdxState,\n};\n"],"mappings":";;;AAYA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAVA,eAce;EACbA,YAAY,EAAZA;AACF,CAAC;AAAA;AAAA"}
|
|
@@ -15,14 +15,13 @@ var _generateIdxAction = _interopRequireDefault(require("./generateIdxAction"));
|
|
|
15
15
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
19
|
-
// @ts-nocheck
|
|
20
18
|
// auth-js/types
|
|
21
19
|
|
|
22
20
|
const generateRemediationFunctions = function generateRemediationFunctions(authClient, remediationValue, toPersist = {}) {
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
return remediationValue.reduce((obj, remediation) => ({
|
|
22
|
+
...obj,
|
|
23
|
+
[remediation.name]: (0, _generateIdxAction.default)(authClient, remediation, toPersist)
|
|
24
|
+
}), {});
|
|
26
25
|
};
|
|
27
26
|
exports.generateRemediationFunctions = generateRemediationFunctions;
|
|
28
27
|
//# sourceMappingURL=remediationParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediationParser.js","names":["generateRemediationFunctions","authClient","remediationValue","toPersist","
|
|
1
|
+
{"version":3,"file":"remediationParser.js","names":["generateRemediationFunctions","authClient","remediationValue","toPersist","reduce","obj","remediation","name","generateIdxAction"],"sources":["../../../../../lib/idx/idxState/v1/remediationParser.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 { OktaAuthIdxInterface, IdxRemediation } from '../../types'; // auth-js/types\nimport generateIdxAction from './generateIdxAction';\n\nexport const generateRemediationFunctions = function generateRemediationFunctions(\n authClient: OktaAuthIdxInterface,\n remediationValue: IdxRemediation[],\n toPersist = {}\n) {\n return remediationValue.reduce((obj, remediation) => ({\n ...obj,\n [remediation.name]: generateIdxAction(authClient, remediation, toPersist)\n }), {});\n};\n"],"mappings":";;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEuE;;AAGhE,MAAMA,4BAA4B,GAAG,SAASA,4BAA4B,CAC/EC,UAAgC,EAChCC,gBAAkC,EAClCC,SAAS,GAAG,CAAC,CAAC,EACd;EACA,OAAOD,gBAAgB,CAACE,MAAM,CAAC,CAACC,GAAG,EAAEC,WAAW,MAAM;IACpD,GAAGD,GAAG;IACN,CAACC,WAAW,CAACC,IAAI,GAAG,IAAAC,0BAAiB,EAACP,UAAU,EAAEK,WAAW,EAAEH,SAAS;EAC1E,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACT,CAAC;AAAC"}
|
package/cjs/idx/interact.js
CHANGED
|
@@ -31,12 +31,11 @@ function getResponse(meta) {
|
|
|
31
31
|
|
|
32
32
|
// Begin or resume a transaction. Returns an interaction handle
|
|
33
33
|
async function interact(authClient, options = {}) {
|
|
34
|
-
var _meta;
|
|
35
34
|
options = (0, _util.removeNils)(options);
|
|
36
35
|
let meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient, options);
|
|
37
36
|
// If meta exists, it has been validated against all options
|
|
38
37
|
|
|
39
|
-
if (
|
|
38
|
+
if (meta?.interactionHandle) {
|
|
40
39
|
return getResponse(meta); // Saved transaction, return meta
|
|
41
40
|
}
|
|
42
41
|
|
package/cjs/idx/interact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interact.js","names":["getResponse","meta","interactionHandle","state","interact","authClient","options","removeNils","getSavedTransactionMeta","createTransactionMeta","baseUrl","getOAuthBaseUrl","clientId","redirectUri","scopes","withCredentials","codeChallenge","codeChallengeMethod","activationToken","recoveryToken","maxAge","acrValues","nonce","clientSecret","url","params","client_id","scope","join","redirect_uri","code_challenge","code_challenge_method","activation_token","recovery_token","client_secret","max_age","acr_values","headers","resp","httpRequest","method","args","interaction_handle","newMeta","saveTransactionMeta"],"sources":["../../../lib/idx/interact.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\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/* eslint complexity:[0,8] */\nimport { OktaAuthIdxInterface, IdxTransactionMeta, InteractOptions, InteractResponse } from './types';\nimport { getSavedTransactionMeta, saveTransactionMeta, createTransactionMeta } from './transactionMeta';\nimport { getOAuthBaseUrl } from '../oidc';\nimport { removeNils } from '../util';\nimport { httpRequest } from '../http';\n\n\n/* eslint-disable camelcase */\nexport interface InteractParams {\n client_id: string;\n scope: string;\n redirect_uri: string;\n code_challenge: string;\n code_challenge_method: string;\n state: string;\n activation_token?: string;\n recovery_token?: string;\n client_secret?: string;\n max_age?: string | number;\n acr_values?: string;\n nonce?: string;\n}\n/* eslint-enable camelcase */\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 (\n authClient: OktaAuthIdxInterface, \n options: InteractOptions = {}\n): Promise<InteractResponse> {\n options = removeNils(options);\n\n let meta = getSavedTransactionMeta(authClient, options);\n // If meta exists, it has been validated against all options\n\n if (meta?.interactionHandle) {\n return getResponse(meta); // Saved transaction, return meta\n }\n\n // Create new meta, respecting previous meta if it has been set and is not overridden\n meta = await createTransactionMeta(authClient, { ...meta, ...options });\n const baseUrl = getOAuthBaseUrl(authClient);\n let {\n clientId,\n redirectUri,\n state,\n scopes,\n withCredentials,\n codeChallenge,\n codeChallengeMethod,\n activationToken,\n recoveryToken,\n maxAge,\n acrValues,\n nonce\n } = meta as IdxTransactionMeta;\n const clientSecret = options.clientSecret || authClient.options.clientSecret;\n withCredentials = withCredentials ?? true;\n\n /* eslint-disable camelcase */\n const url = `${baseUrl}/v1/interact`;\n const params = {\n client_id: clientId,\n scope: scopes!.join(' '),\n redirect_uri: redirectUri,\n code_challenge: codeChallenge,\n code_challenge_method: codeChallengeMethod,\n state,\n ...(activationToken && { activation_token: activationToken }),\n ...(recoveryToken && { recovery_token: recoveryToken }),\n // X-Device-Token header need to pair with `client_secret`\n // eslint-disable-next-line max-len\n // https://oktawiki.atlassian.net/wiki/spaces/eng/pages/2445902453/Support+Device+Binding+in+interact#Scenario-1%3A-Non-User-Agent-with-Confidential-Client-(top-priority)\n ...(clientSecret && { client_secret: clientSecret }),\n ...(maxAge && { max_age: maxAge }),\n ...(acrValues && { acr_values: acrValues }),\n ...(nonce && { nonce }),\n } as InteractParams;\n /* eslint-enable camelcase */\n\n const headers = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n };\n\n const resp = await httpRequest(authClient, {\n method: 'POST',\n url,\n headers,\n withCredentials,\n args: params\n });\n const interactionHandle = resp.interaction_handle;\n\n const newMeta = {\n ...meta,\n interactionHandle,\n \n // Options which can be passed into interact() should be saved in the meta\n withCredentials,\n state,\n scopes,\n recoveryToken,\n activationToken\n };\n // Save transaction meta so it can be resumed\n saveTransactionMeta(authClient, newMeta);\n\n return getResponse(newMeta);\n}\n"],"mappings":";;;AAcA;AACA;AACA;AACA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuBA;;AAEA,SAASA,WAAW,CAACC,IAAwB,EAAoB;EAC/D,OAAO;IACLA,IAAI;IACJC,iBAAiB,EAAED,IAAI,CAACC,iBAAkB;IAC1CC,KAAK,EAAEF,IAAI,CAACE;EACd,CAAC;AACH;;AAEA;AACO,eAAeC,QAAQ,CAC5BC,UAAgC,EAChCC,OAAwB,GAAG,CAAC,CAAC,EACF;
|
|
1
|
+
{"version":3,"file":"interact.js","names":["getResponse","meta","interactionHandle","state","interact","authClient","options","removeNils","getSavedTransactionMeta","createTransactionMeta","baseUrl","getOAuthBaseUrl","clientId","redirectUri","scopes","withCredentials","codeChallenge","codeChallengeMethod","activationToken","recoveryToken","maxAge","acrValues","nonce","clientSecret","url","params","client_id","scope","join","redirect_uri","code_challenge","code_challenge_method","activation_token","recovery_token","client_secret","max_age","acr_values","headers","resp","httpRequest","method","args","interaction_handle","newMeta","saveTransactionMeta"],"sources":["../../../lib/idx/interact.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\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/* eslint complexity:[0,8] */\nimport { OktaAuthIdxInterface, IdxTransactionMeta, InteractOptions, InteractResponse } from './types';\nimport { getSavedTransactionMeta, saveTransactionMeta, createTransactionMeta } from './transactionMeta';\nimport { getOAuthBaseUrl } from '../oidc';\nimport { removeNils } from '../util';\nimport { httpRequest } from '../http';\n\n\n/* eslint-disable camelcase */\nexport interface InteractParams {\n client_id: string;\n scope: string;\n redirect_uri: string;\n code_challenge: string;\n code_challenge_method: string;\n state: string;\n activation_token?: string;\n recovery_token?: string;\n client_secret?: string;\n max_age?: string | number;\n acr_values?: string;\n nonce?: string;\n}\n/* eslint-enable camelcase */\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 (\n authClient: OktaAuthIdxInterface, \n options: InteractOptions = {}\n): Promise<InteractResponse> {\n options = removeNils(options);\n\n let meta = getSavedTransactionMeta(authClient, options);\n // If meta exists, it has been validated against all options\n\n if (meta?.interactionHandle) {\n return getResponse(meta); // Saved transaction, return meta\n }\n\n // Create new meta, respecting previous meta if it has been set and is not overridden\n meta = await createTransactionMeta(authClient, { ...meta, ...options });\n const baseUrl = getOAuthBaseUrl(authClient);\n let {\n clientId,\n redirectUri,\n state,\n scopes,\n withCredentials,\n codeChallenge,\n codeChallengeMethod,\n activationToken,\n recoveryToken,\n maxAge,\n acrValues,\n nonce\n } = meta as IdxTransactionMeta;\n const clientSecret = options.clientSecret || authClient.options.clientSecret;\n withCredentials = withCredentials ?? true;\n\n /* eslint-disable camelcase */\n const url = `${baseUrl}/v1/interact`;\n const params = {\n client_id: clientId,\n scope: scopes!.join(' '),\n redirect_uri: redirectUri,\n code_challenge: codeChallenge,\n code_challenge_method: codeChallengeMethod,\n state,\n ...(activationToken && { activation_token: activationToken }),\n ...(recoveryToken && { recovery_token: recoveryToken }),\n // X-Device-Token header need to pair with `client_secret`\n // eslint-disable-next-line max-len\n // https://oktawiki.atlassian.net/wiki/spaces/eng/pages/2445902453/Support+Device+Binding+in+interact#Scenario-1%3A-Non-User-Agent-with-Confidential-Client-(top-priority)\n ...(clientSecret && { client_secret: clientSecret }),\n ...(maxAge && { max_age: maxAge }),\n ...(acrValues && { acr_values: acrValues }),\n ...(nonce && { nonce }),\n } as InteractParams;\n /* eslint-enable camelcase */\n\n const headers = {\n 'Content-Type': 'application/x-www-form-urlencoded',\n };\n\n const resp = await httpRequest(authClient, {\n method: 'POST',\n url,\n headers,\n withCredentials,\n args: params\n });\n const interactionHandle = resp.interaction_handle;\n\n const newMeta = {\n ...meta,\n interactionHandle,\n \n // Options which can be passed into interact() should be saved in the meta\n withCredentials,\n state,\n scopes,\n recoveryToken,\n activationToken\n };\n // Save transaction meta so it can be resumed\n saveTransactionMeta(authClient, newMeta);\n\n return getResponse(newMeta);\n}\n"],"mappings":";;;AAcA;AACA;AACA;AACA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAuBA;;AAEA,SAASA,WAAW,CAACC,IAAwB,EAAoB;EAC/D,OAAO;IACLA,IAAI;IACJC,iBAAiB,EAAED,IAAI,CAACC,iBAAkB;IAC1CC,KAAK,EAAEF,IAAI,CAACE;EACd,CAAC;AACH;;AAEA;AACO,eAAeC,QAAQ,CAC5BC,UAAgC,EAChCC,OAAwB,GAAG,CAAC,CAAC,EACF;EAC3BA,OAAO,GAAG,IAAAC,gBAAU,EAACD,OAAO,CAAC;EAE7B,IAAIL,IAAI,GAAG,IAAAO,wCAAuB,EAACH,UAAU,EAAEC,OAAO,CAAC;EACvD;;EAEA,IAAIL,IAAI,EAAEC,iBAAiB,EAAE;IAC3B,OAAOF,WAAW,CAACC,IAAI,CAAC,CAAC,CAAC;EAC5B;;EAEA;EACAA,IAAI,GAAG,MAAM,IAAAQ,sCAAqB,EAACJ,UAAU,EAAE;IAAE,GAAGJ,IAAI;IAAE,GAAGK;EAAQ,CAAC,CAAC;EACvE,MAAMI,OAAO,GAAG,IAAAC,qBAAe,EAACN,UAAU,CAAC;EAC3C,IAAI;IACFO,QAAQ;IACRC,WAAW;IACXV,KAAK;IACLW,MAAM;IACNC,eAAe;IACfC,aAAa;IACbC,mBAAmB;IACnBC,eAAe;IACfC,aAAa;IACbC,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,GAAGrB,IAA0B;EAC9B,MAAMsB,YAAY,GAAGjB,OAAO,CAACiB,YAAY,IAAIlB,UAAU,CAACC,OAAO,CAACiB,YAAY;EAC5ER,eAAe,GAAGA,eAAe,IAAI,IAAI;;EAEzC;EACA,MAAMS,GAAG,GAAI,GAAEd,OAAQ,cAAa;EACpC,MAAMe,MAAM,GAAG;IACbC,SAAS,EAAEd,QAAQ;IACnBe,KAAK,EAAEb,MAAM,CAAEc,IAAI,CAAC,GAAG,CAAC;IACxBC,YAAY,EAAEhB,WAAW;IACzBiB,cAAc,EAAEd,aAAa;IAC7Be,qBAAqB,EAAEd,mBAAmB;IAC1Cd,KAAK;IACL,IAAIe,eAAe,IAAI;MAAEc,gBAAgB,EAAEd;IAAgB,CAAC,CAAC;IAC7D,IAAIC,aAAa,IAAI;MAAEc,cAAc,EAAEd;IAAc,CAAC,CAAC;IACvD;IACA;IACA;IACA,IAAII,YAAY,IAAI;MAAEW,aAAa,EAAEX;IAAa,CAAC,CAAC;IACpD,IAAIH,MAAM,IAAI;MAAEe,OAAO,EAAEf;IAAO,CAAC,CAAC;IAClC,IAAIC,SAAS,IAAI;MAAEe,UAAU,EAAEf;IAAU,CAAC,CAAC;IAC3C,IAAIC,KAAK,IAAI;MAAEA;IAAM,CAAC;EACxB,CAAmB;EACnB;;EAEA,MAAMe,OAAO,GAAG;IACd,cAAc,EAAE;EAClB,CAAC;EAED,MAAMC,IAAI,GAAG,MAAM,IAAAC,iBAAW,EAAClC,UAAU,EAAE;IACzCmC,MAAM,EAAE,MAAM;IACdhB,GAAG;IACHa,OAAO;IACPtB,eAAe;IACf0B,IAAI,EAAEhB;EACR,CAAC,CAAC;EACF,MAAMvB,iBAAiB,GAAGoC,IAAI,CAACI,kBAAkB;EAEjD,MAAMC,OAAO,GAAG;IACd,GAAG1C,IAAI;IACPC,iBAAiB;IAEjB;IACAa,eAAe;IACfZ,KAAK;IACLW,MAAM;IACNK,aAAa;IACbD;EACF,CAAC;EACD;EACA,IAAA0B,oCAAmB,EAACvC,UAAU,EAAEsC,OAAO,CAAC;EAExC,OAAO3C,WAAW,CAAC2C,OAAO,CAAC;AAC7B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.mixinMinimalIdx = mixinMinimalIdx;
|
|
5
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
6
|
+
var _minimalApi = require("../idx/factory/minimalApi");
|
|
7
|
+
var webauthn = _interopRequireWildcard(require("./webauthn"));
|
|
8
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
9
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
|
+
function mixinMinimalIdx(Base) {
|
|
11
|
+
var _class;
|
|
12
|
+
return _class = class OktaAuthIdx extends Base {
|
|
13
|
+
constructor(...args) {
|
|
14
|
+
super(...args);
|
|
15
|
+
this.idx = (0, _minimalApi.createMinimalIdxAPI)(this);
|
|
16
|
+
}
|
|
17
|
+
}, (0, _defineProperty2.default)(_class, "webauthn", webauthn), _class;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=mixinMinimal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixinMinimal.js","names":["mixinMinimalIdx","Base","OktaAuthIdx","constructor","args","idx","createMinimalIdxAPI","webauthn"],"sources":["../../../lib/idx/mixinMinimal.ts"],"sourcesContent":["import { OktaAuthConstructor } from '../base/types';\nimport { MinimalOktaOAuthInterface } from '../oidc/types';\nimport {\n IdxTransactionManagerInterface,\n OktaAuthIdxConstructor,\n OktaAuthIdxOptions,\n MinimalIdxAPI,\n WebauthnAPI,\n MinimalOktaAuthIdxInterface\n} from './types';\nimport { IdxTransactionMeta } from './types/meta';\nimport { IdxStorageManagerInterface } from './types/storage';\nimport { createMinimalIdxAPI } from '../idx/factory/minimalApi';\nimport * as webauthn from './webauthn';\n\nexport function mixinMinimalIdx\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<MinimalOktaOAuthInterface<M, S, O, TM>>\n = OktaAuthConstructor<MinimalOktaOAuthInterface<M, S, O, TM>>\n>\n(\n Base: TBase\n): TBase & OktaAuthIdxConstructor<MinimalOktaAuthIdxInterface<M, S, O, TM>>\n{\n return class OktaAuthIdx extends Base implements MinimalOktaAuthIdxInterface<M, S, O, TM>\n {\n idx: MinimalIdxAPI;\n static webauthn: WebauthnAPI = webauthn;\n \n constructor(...args: any[]) {\n super(...args);\n this.idx = createMinimalIdxAPI(this);\n }\n };\n}\n"],"mappings":";;;;;AAYA;AACA;AAAuC;AAAA;AAEhC,SAASA,eAAe,CAU7BC,IAAW,EAEb;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,+BAAmB,EAAC,IAAI,CAAC;IACtC;EACF,CAAC,oDANgCC,QAAQ;AAO3C"}
|
package/cjs/idx/poll.js
CHANGED
|
@@ -17,21 +17,19 @@ var _util = require("../util");
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
async function poll(authClient, options = {}) {
|
|
20
|
-
var _meta$remediations;
|
|
21
20
|
let transaction = await (0, _proceed.proceed)(authClient, {
|
|
22
21
|
startPolling: true
|
|
23
22
|
});
|
|
24
23
|
const meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient);
|
|
25
|
-
let availablePollingRemeditaions = meta
|
|
26
|
-
if (!
|
|
24
|
+
let availablePollingRemeditaions = meta?.remediations?.find(remediation => remediation.includes('poll'));
|
|
25
|
+
if (!availablePollingRemeditaions?.length) {
|
|
27
26
|
(0, _util.warn)('No polling remediations available at the current IDX flow stage');
|
|
28
27
|
}
|
|
29
28
|
if (Number.isInteger(options.refresh)) {
|
|
30
29
|
return new Promise(function (resolve, reject) {
|
|
31
30
|
setTimeout(async function () {
|
|
32
31
|
try {
|
|
33
|
-
|
|
34
|
-
const refresh = (_transaction$nextStep = transaction.nextStep) === null || _transaction$nextStep === void 0 ? void 0 : (_transaction$nextStep2 = _transaction$nextStep.poll) === null || _transaction$nextStep2 === void 0 ? void 0 : _transaction$nextStep2.refresh;
|
|
32
|
+
const refresh = transaction.nextStep?.poll?.refresh;
|
|
35
33
|
if (refresh) {
|
|
36
34
|
resolve(poll(authClient, {
|
|
37
35
|
refresh
|
package/cjs/idx/poll.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll.js","names":["poll","authClient","options","transaction","proceed","startPolling","meta","getSavedTransactionMeta","availablePollingRemeditaions","remediations","find","remediation","includes","length","warn","Number","isInteger","refresh","Promise","resolve","reject","setTimeout","nextStep","err"],"sources":["../../../lib/idx/poll.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 { proceed } from './proceed';\n\nimport { \n IdxPollOptions,\n IdxTransaction,\n OktaAuthIdxInterface,\n} from './types';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { warn } from '../util';\n\nexport async function poll(authClient: OktaAuthIdxInterface, options: IdxPollOptions = {}): Promise<IdxTransaction> {\n let transaction = await proceed(authClient, {\n startPolling: true\n });\n\n const meta = getSavedTransactionMeta(authClient);\n let availablePollingRemeditaions = meta?.remediations?.find(remediation => remediation.includes('poll'));\n if (!availablePollingRemeditaions?.length) {\n warn('No polling remediations available at the current IDX flow stage');\n }\n\n if (Number.isInteger(options.refresh)) {\n return new Promise(function (resolve, reject) {\n setTimeout(async function () {\n try {\n const refresh = transaction.nextStep?.poll?.refresh;\n if (refresh) {\n resolve(poll(authClient, {\n refresh\n }));\n } else {\n resolve(transaction);\n }\n } catch (err) {\n reject(err);\n }\n }, options.refresh);\n });\n }\n\n return transaction;\n}\n"],"mappings":";;;AAYA;AAOA;AACA;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,eAAeA,IAAI,CAACC,UAAgC,EAAEC,OAAuB,GAAG,CAAC,CAAC,EAA2B;
|
|
1
|
+
{"version":3,"file":"poll.js","names":["poll","authClient","options","transaction","proceed","startPolling","meta","getSavedTransactionMeta","availablePollingRemeditaions","remediations","find","remediation","includes","length","warn","Number","isInteger","refresh","Promise","resolve","reject","setTimeout","nextStep","err"],"sources":["../../../lib/idx/poll.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 { proceed } from './proceed';\n\nimport { \n IdxPollOptions,\n IdxTransaction,\n OktaAuthIdxInterface,\n} from './types';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { warn } from '../util';\n\nexport async function poll(authClient: OktaAuthIdxInterface, options: IdxPollOptions = {}): Promise<IdxTransaction> {\n let transaction = await proceed(authClient, {\n startPolling: true\n });\n\n const meta = getSavedTransactionMeta(authClient);\n let availablePollingRemeditaions = meta?.remediations?.find(remediation => remediation.includes('poll'));\n if (!availablePollingRemeditaions?.length) {\n warn('No polling remediations available at the current IDX flow stage');\n }\n\n if (Number.isInteger(options.refresh)) {\n return new Promise(function (resolve, reject) {\n setTimeout(async function () {\n try {\n const refresh = transaction.nextStep?.poll?.refresh;\n if (refresh) {\n resolve(poll(authClient, {\n refresh\n }));\n } else {\n resolve(transaction);\n }\n } catch (err) {\n reject(err);\n }\n }, options.refresh);\n });\n }\n\n return transaction;\n}\n"],"mappings":";;;AAYA;AAOA;AACA;AApBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYO,eAAeA,IAAI,CAACC,UAAgC,EAAEC,OAAuB,GAAG,CAAC,CAAC,EAA2B;EAClH,IAAIC,WAAW,GAAG,MAAM,IAAAC,gBAAO,EAACH,UAAU,EAAE;IAC1CI,YAAY,EAAE;EAChB,CAAC,CAAC;EAEF,MAAMC,IAAI,GAAG,IAAAC,wCAAuB,EAACN,UAAU,CAAC;EAChD,IAAIO,4BAA4B,GAAGF,IAAI,EAAEG,YAAY,EAAEC,IAAI,CAACC,WAAW,IAAIA,WAAW,CAACC,QAAQ,CAAC,MAAM,CAAC,CAAC;EACxG,IAAI,CAACJ,4BAA4B,EAAEK,MAAM,EAAE;IACzC,IAAAC,UAAI,EAAC,iEAAiE,CAAC;EACzE;EAEA,IAAIC,MAAM,CAACC,SAAS,CAACd,OAAO,CAACe,OAAO,CAAC,EAAE;IACrC,OAAO,IAAIC,OAAO,CAAC,UAAUC,OAAO,EAAEC,MAAM,EAAE;MAC5CC,UAAU,CAAC,kBAAkB;QAC3B,IAAI;UACF,MAAMJ,OAAO,GAAGd,WAAW,CAACmB,QAAQ,EAAEtB,IAAI,EAAEiB,OAAO;UACnD,IAAIA,OAAO,EAAE;YACXE,OAAO,CAACnB,IAAI,CAACC,UAAU,EAAE;cACvBgB;YACF,CAAC,CAAC,CAAC;UACL,CAAC,MAAM;YACLE,OAAO,CAAChB,WAAW,CAAC;UACtB;QACF,CAAC,CAAC,OAAOoB,GAAG,EAAE;UACZH,MAAM,CAACG,GAAG,CAAC;QACb;MACF,CAAC,EAAErB,OAAO,CAACe,OAAO,CAAC;IACrB,CAAC,CAAC;EACJ;EAEA,OAAOd,WAAW;AACpB"}
|