@okta/okta-auth-js 5.7.0 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +12 -2
- package/cjs/OktaAuth.js +88 -43
- package/cjs/OktaAuth.js.map +1 -1
- package/cjs/OktaUserAgent.js +2 -2
- package/cjs/OktaUserAgent.js.map +1 -1
- package/cjs/StorageManager.js +8 -0
- package/cjs/StorageManager.js.map +1 -1
- package/cjs/TokenManager.js +24 -2
- package/cjs/TokenManager.js.map +1 -1
- package/cjs/TransactionManager.js +24 -12
- package/cjs/TransactionManager.js.map +1 -1
- package/cjs/constants.js +3 -1
- package/cjs/constants.js.map +1 -1
- package/cjs/features.js +1 -1
- package/cjs/features.js.map +1 -1
- package/cjs/idx/authenticate.js +3 -18
- package/cjs/idx/authenticate.js.map +1 -1
- package/cjs/idx/authenticator/Authenticator.js +14 -0
- package/cjs/idx/authenticator/Authenticator.js.map +1 -0
- package/cjs/idx/authenticator/OktaPassword.js +31 -0
- package/cjs/idx/authenticator/OktaPassword.js.map +1 -0
- package/cjs/idx/authenticator/OktaVerifyTotp.js +17 -0
- package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -0
- package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +50 -0
- package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -0
- package/cjs/idx/authenticator/SecurityQuestionVerification.js +31 -0
- package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -0
- package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +34 -0
- package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -0
- package/cjs/idx/authenticator/getAuthenticator.js +42 -0
- package/cjs/idx/authenticator/getAuthenticator.js.map +1 -0
- package/cjs/idx/authenticator/index.js +80 -0
- package/cjs/idx/authenticator/index.js.map +1 -0
- package/cjs/idx/cancel.js +5 -0
- package/cjs/idx/cancel.js.map +1 -1
- package/cjs/idx/flow/AuthenticationFlow.js +32 -0
- package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
- package/cjs/idx/flow/FlowSpecification.js +39 -0
- package/cjs/idx/flow/FlowSpecification.js.map +1 -0
- package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
- package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
- package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +16 -12
- package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
- package/cjs/idx/flow/RemediationFlow.js +2 -0
- package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
- package/cjs/idx/flow/index.js +67 -0
- package/cjs/idx/flow/index.js.map +1 -0
- package/cjs/idx/index.js +39 -0
- package/cjs/idx/index.js.map +1 -1
- package/cjs/idx/interact.js +13 -4
- package/cjs/idx/interact.js.map +1 -1
- package/cjs/idx/introspect.js +24 -7
- package/cjs/idx/introspect.js.map +1 -1
- package/cjs/idx/poll.js +59 -0
- package/cjs/idx/poll.js.map +1 -0
- package/cjs/idx/proceed.js +49 -0
- package/cjs/idx/proceed.js.map +1 -0
- package/cjs/idx/recoverPassword.js +3 -17
- package/cjs/idx/recoverPassword.js.map +1 -1
- package/cjs/idx/register.js +22 -20
- package/cjs/idx/register.js.map +1 -1
- package/cjs/idx/remediate.js +61 -118
- package/cjs/idx/remediate.js.map +1 -1
- package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +9 -12
- package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
- package/cjs/idx/remediators/AuthenticatorVerificationData.js +6 -9
- package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
- package/cjs/idx/remediators/Base/AuthenticatorData.js +43 -32
- package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
- package/cjs/idx/remediators/Base/Remediator.js +51 -20
- package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
- package/cjs/idx/remediators/Base/SelectAuthenticator.js +16 -16
- package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js +8 -28
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
- package/{esm/idx/remediators/RedirectIdp.js → cjs/idx/remediators/ChallengePoll.js} +13 -25
- package/cjs/idx/remediators/ChallengePoll.js.map +1 -0
- package/cjs/idx/remediators/EnrollPoll.js +56 -0
- package/cjs/idx/remediators/EnrollPoll.js.map +1 -0
- package/cjs/idx/remediators/Identify.js +4 -36
- package/cjs/idx/remediators/Identify.js.map +1 -1
- package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +23 -2
- package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
- package/cjs/idx/remediators/Skip.js +7 -0
- package/cjs/idx/remediators/Skip.js.map +1 -1
- package/cjs/idx/remediators/index.js +26 -0
- package/cjs/idx/remediators/index.js.map +1 -1
- package/cjs/idx/run.js +36 -16
- package/cjs/idx/run.js.map +1 -1
- package/cjs/idx/startTransaction.js +2 -0
- package/cjs/idx/startTransaction.js.map +1 -1
- package/cjs/idx/transactionMeta.js +77 -39
- package/cjs/idx/transactionMeta.js.map +1 -1
- package/cjs/idx/types/FlowIdentifier.js +2 -0
- package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
- package/cjs/idx/types/idx-js.js +5 -0
- package/cjs/idx/types/idx-js.js.map +1 -1
- package/cjs/idx/types/index.js +18 -1
- package/cjs/idx/types/index.js.map +1 -1
- package/cjs/oidc/endpoints/authorize.js +4 -1
- package/cjs/oidc/endpoints/authorize.js.map +1 -1
- package/cjs/oidc/getWithRedirect.js +2 -6
- package/cjs/oidc/getWithRedirect.js.map +1 -1
- package/cjs/oidc/util/loginRedirect.js +9 -5
- package/cjs/oidc/util/loginRedirect.js.map +1 -1
- package/cjs/oidc/util/urlParams.js +1 -1
- package/cjs/oidc/util/urlParams.js.map +1 -1
- package/cjs/options.js +12 -2
- package/cjs/options.js.map +1 -1
- package/cjs/server/serverStorage.js +2 -1
- package/cjs/server/serverStorage.js.map +1 -1
- package/cjs/types/Token.js.map +1 -1
- package/cjs/types/Transaction.js.map +1 -1
- package/{esm/clock.js → cjs/util/emailVerify.js} +14 -18
- package/cjs/util/emailVerify.js.map +1 -0
- package/cjs/util/index.js +13 -0
- package/cjs/util/index.js.map +1 -1
- package/dist/okta-auth-js.min.js +2 -74
- package/dist/okta-auth-js.min.js.LICENSE.txt +32 -0
- package/dist/okta-auth-js.min.js.map +1 -1
- package/dist/okta-auth-js.polyfill.js +2 -18
- package/{esm/crypto/webcrypto.js → dist/okta-auth-js.polyfill.js.LICENSE.txt} +8 -4
- package/dist/okta-auth-js.polyfill.js.map +1 -1
- package/dist/okta-auth-js.umd.js +2 -74
- package/dist/okta-auth-js.umd.js.LICENSE.txt +32 -0
- package/dist/okta-auth-js.umd.js.map +1 -1
- package/esm/index.js +8580 -16
- package/esm/index.js.map +1 -1
- package/lib/OktaAuth.d.ts +6 -3
- package/lib/StorageManager.d.ts +1 -0
- package/lib/TokenManager.d.ts +2 -0
- package/lib/TransactionManager.d.ts +5 -1
- package/lib/constants.d.ts +1 -0
- package/lib/crypto/base64.d.ts +2 -2
- package/lib/crypto/oidcHash.d.ts +1 -1
- package/lib/crypto/verifyToken.d.ts +1 -1
- package/lib/idx/authenticator/Authenticator.d.ts +12 -0
- package/lib/idx/authenticator/OktaPassword.d.ts +11 -0
- package/lib/idx/authenticator/OktaVerifyTotp.d.ts +9 -0
- package/lib/idx/authenticator/SecurityQuestionEnrollment.d.ts +28 -0
- package/lib/idx/authenticator/SecurityQuestionVerification.d.ts +14 -0
- package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +10 -0
- package/lib/idx/authenticator/getAuthenticator.d.ts +3 -0
- package/lib/idx/authenticator/index.d.ts +6 -0
- package/{esm/oidc/endpoints/index.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -5
- package/lib/idx/flow/FlowSpecification.d.ts +8 -0
- package/{esm/crypto/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -6
- package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
- package/lib/idx/flow/RemediationFlow.d.ts +13 -0
- package/lib/idx/{flowMonitors → flow}/index.d.ts +5 -4
- package/lib/idx/index.d.ts +3 -0
- package/lib/idx/interact.d.ts +1 -0
- package/lib/idx/introspect.d.ts +2 -1
- package/lib/idx/poll.d.ts +13 -0
- package/lib/idx/proceed.d.ts +21 -0
- package/lib/idx/register.d.ts +1 -1
- package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +9 -5
- package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +0 -1
- package/lib/idx/remediators/Base/AuthenticatorData.d.ts +8 -3
- package/lib/idx/remediators/Base/Remediator.d.ts +9 -6
- package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +5 -4
- package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +8 -4
- package/lib/idx/remediators/ChallengePoll.d.ts +15 -0
- package/{esm/tx/util.js → lib/idx/remediators/EnrollPoll.d.ts} +11 -13
- package/lib/idx/remediators/Identify.d.ts +1 -3
- package/lib/idx/remediators/SelectAuthenticatorAuthenticate.d.ts +6 -2
- package/lib/idx/remediators/Skip.d.ts +3 -0
- package/lib/idx/remediators/index.d.ts +2 -0
- package/lib/idx/run.d.ts +8 -9
- package/lib/idx/transactionMeta.d.ts +28 -4
- package/lib/idx/types/FlowIdentifier.d.ts +1 -0
- package/lib/idx/types/idx-js.d.ts +53 -1
- package/lib/idx/types/index.d.ts +18 -4
- package/lib/oidc/util/loginRedirect.d.ts +1 -1
- package/lib/types/OktaAuthOptions.d.ts +3 -0
- package/lib/types/Token.d.ts +1 -0
- package/lib/types/Transaction.d.ts +2 -0
- package/lib/types/api.d.ts +15 -2
- package/lib/{idx/flowMonitors/AuthenticationFlowMonitor.d.ts → util/emailVerify.d.ts} +5 -3
- package/lib/util/index.d.ts +1 -0
- package/package.json +22 -13
- package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -45
- package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/FlowMonitor.js +0 -69
- package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -55
- package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js +0 -35
- package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/index.js +0 -54
- package/cjs/idx/flowMonitors/index.js.map +0 -1
- package/esm/AuthStateManager.js +0 -214
- package/esm/AuthStateManager.js.map +0 -1
- package/esm/OktaAuth.js +0 -681
- package/esm/OktaAuth.js.map +0 -1
- package/esm/OktaUserAgent.js +0 -49
- package/esm/OktaUserAgent.js.map +0 -1
- package/esm/PromiseQueue.js +0 -71
- package/esm/PromiseQueue.js.map +0 -1
- package/esm/SavedObject.js +0 -91
- package/esm/SavedObject.js.map +0 -1
- package/esm/StorageManager.js +0 -182
- package/esm/StorageManager.js.map +0 -1
- package/esm/TokenManager.js +0 -455
- package/esm/TokenManager.js.map +0 -1
- package/esm/TransactionManager.js +0 -316
- package/esm/TransactionManager.js.map +0 -1
- package/esm/browser/browserStorage.js +0 -256
- package/esm/browser/browserStorage.js.map +0 -1
- package/esm/browser/fingerprint.js +0 -74
- package/esm/browser/fingerprint.js.map +0 -1
- package/esm/builderUtil.js +0 -56
- package/esm/builderUtil.js.map +0 -1
- package/esm/clock.js.map +0 -1
- package/esm/constants.js +0 -35
- package/esm/constants.js.map +0 -1
- package/esm/crypto/base64.js +0 -66
- package/esm/crypto/base64.js.map +0 -1
- package/esm/crypto/browser.js.map +0 -1
- package/esm/crypto/index.js.map +0 -1
- package/esm/crypto/node.js +0 -54
- package/esm/crypto/node.js.map +0 -1
- package/esm/crypto/oidcHash.js +0 -27
- package/esm/crypto/oidcHash.js.map +0 -1
- package/esm/crypto/verifyToken.js +0 -39
- package/esm/crypto/verifyToken.js.map +0 -1
- package/esm/crypto/webcrypto.js.map +0 -1
- package/esm/errors/AuthApiError.js +0 -30
- package/esm/errors/AuthApiError.js.map +0 -1
- package/esm/errors/AuthPollStopError.js +0 -20
- package/esm/errors/AuthPollStopError.js.map +0 -1
- package/esm/errors/AuthSdkError.js +0 -29
- package/esm/errors/AuthSdkError.js.map +0 -1
- package/esm/errors/CustomError.js +0 -21
- package/esm/errors/CustomError.js.map +0 -1
- package/esm/errors/OAuthError.js +0 -22
- package/esm/errors/OAuthError.js.map +0 -1
- package/esm/errors/index.js +0 -22
- package/esm/errors/index.js.map +0 -1
- package/esm/features.js +0 -64
- package/esm/features.js.map +0 -1
- package/esm/fetch/fetchRequest.js +0 -92
- package/esm/fetch/fetchRequest.js.map +0 -1
- package/esm/http/headers.js +0 -17
- package/esm/http/headers.js.map +0 -1
- package/esm/http/index.js +0 -3
- package/esm/http/index.js.map +0 -1
- package/esm/http/request.js +0 -145
- package/esm/http/request.js.map +0 -1
- package/esm/idx/authenticate.js +0 -47
- package/esm/idx/authenticate.js.map +0 -1
- package/esm/idx/cancel.js +0 -32
- package/esm/idx/cancel.js.map +0 -1
- package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
- package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
- package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
- package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
- package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/index.js +0 -16
- package/esm/idx/flowMonitors/index.js.map +0 -1
- package/esm/idx/handleInteractionCodeRedirect.js +0 -64
- package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
- package/esm/idx/headers.js +0 -39
- package/esm/idx/headers.js.map +0 -1
- package/esm/idx/index.js +0 -20
- package/esm/idx/index.js.map +0 -1
- package/esm/idx/interact.js +0 -83
- package/esm/idx/interact.js.map +0 -1
- package/esm/idx/introspect.js +0 -45
- package/esm/idx/introspect.js.map +0 -1
- package/esm/idx/recoverPassword.js +0 -46
- package/esm/idx/recoverPassword.js.map +0 -1
- package/esm/idx/register.js +0 -63
- package/esm/idx/register.js.map +0 -1
- package/esm/idx/remediate.js +0 -302
- package/esm/idx/remediate.js.map +0 -1
- package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
- package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
- package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
- package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
- package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
- package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
- package/esm/idx/remediators/Base/Remediator.js +0 -221
- package/esm/idx/remediators/Base/Remediator.js.map +0 -1
- package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
- package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
- package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -65
- package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
- package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
- package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
- package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
- package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
- package/esm/idx/remediators/EnrollProfile.js +0 -79
- package/esm/idx/remediators/EnrollProfile.js.map +0 -1
- package/esm/idx/remediators/Identify.js +0 -87
- package/esm/idx/remediators/Identify.js.map +0 -1
- package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
- package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
- package/esm/idx/remediators/RedirectIdp.js.map +0 -1
- package/esm/idx/remediators/ResetAuthenticator.js +0 -18
- package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
- package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
- package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
- package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
- package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
- package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
- package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
- package/esm/idx/remediators/Skip.js +0 -23
- package/esm/idx/remediators/Skip.js.map +0 -1
- package/esm/idx/remediators/index.js +0 -26
- package/esm/idx/remediators/index.js.map +0 -1
- package/esm/idx/remediators/util.js +0 -35
- package/esm/idx/remediators/util.js.map +0 -1
- package/esm/idx/run.js +0 -201
- package/esm/idx/run.js.map +0 -1
- package/esm/idx/startTransaction.js +0 -27
- package/esm/idx/startTransaction.js.map +0 -1
- package/esm/idx/transactionMeta.js +0 -114
- package/esm/idx/transactionMeta.js.map +0 -1
- package/esm/idx/types/idx-js.js +0 -17
- package/esm/idx/types/idx-js.js.map +0 -1
- package/esm/idx/types/index.js +0 -44
- package/esm/idx/types/index.js.map +0 -1
- package/esm/oidc/decodeToken.js +0 -31
- package/esm/oidc/decodeToken.js.map +0 -1
- package/esm/oidc/endpoints/authorize.js +0 -61
- package/esm/oidc/endpoints/authorize.js.map +0 -1
- package/esm/oidc/endpoints/index.js.map +0 -1
- package/esm/oidc/endpoints/token.js +0 -97
- package/esm/oidc/endpoints/token.js.map +0 -1
- package/esm/oidc/endpoints/well-known.js +0 -58
- package/esm/oidc/endpoints/well-known.js.map +0 -1
- package/esm/oidc/exchangeCodeForTokens.js +0 -69
- package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
- package/esm/oidc/getToken.js +0 -180
- package/esm/oidc/getToken.js.map +0 -1
- package/esm/oidc/getUserInfo.js +0 -82
- package/esm/oidc/getUserInfo.js.map +0 -1
- package/esm/oidc/getWithPopup.js +0 -34
- package/esm/oidc/getWithPopup.js.map +0 -1
- package/esm/oidc/getWithRedirect.js +0 -65
- package/esm/oidc/getWithRedirect.js.map +0 -1
- package/esm/oidc/getWithoutPrompt.js +0 -29
- package/esm/oidc/getWithoutPrompt.js.map +0 -1
- package/esm/oidc/handleOAuthResponse.js +0 -148
- package/esm/oidc/handleOAuthResponse.js.map +0 -1
- package/esm/oidc/index.js +0 -29
- package/esm/oidc/index.js.map +0 -1
- package/esm/oidc/parseFromUrl.js +0 -144
- package/esm/oidc/parseFromUrl.js.map +0 -1
- package/esm/oidc/renewToken.js +0 -85
- package/esm/oidc/renewToken.js.map +0 -1
- package/esm/oidc/renewTokens.js +0 -74
- package/esm/oidc/renewTokens.js.map +0 -1
- package/esm/oidc/renewTokensWithRefresh.js +0 -55
- package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
- package/esm/oidc/revokeToken.js +0 -57
- package/esm/oidc/revokeToken.js.map +0 -1
- package/esm/oidc/util/browser.js +0 -74
- package/esm/oidc/util/browser.js.map +0 -1
- package/esm/oidc/util/defaultTokenParams.js +0 -42
- package/esm/oidc/util/defaultTokenParams.js.map +0 -1
- package/esm/oidc/util/errors.js +0 -31
- package/esm/oidc/util/errors.js.map +0 -1
- package/esm/oidc/util/index.js +0 -25
- package/esm/oidc/util/index.js.map +0 -1
- package/esm/oidc/util/loginRedirect.js +0 -84
- package/esm/oidc/util/loginRedirect.js.map +0 -1
- package/esm/oidc/util/oauth.js +0 -70
- package/esm/oidc/util/oauth.js.map +0 -1
- package/esm/oidc/util/pkce.js +0 -55
- package/esm/oidc/util/pkce.js.map +0 -1
- package/esm/oidc/util/prepareTokenParams.js +0 -75
- package/esm/oidc/util/prepareTokenParams.js.map +0 -1
- package/esm/oidc/util/refreshToken.js +0 -24
- package/esm/oidc/util/refreshToken.js.map +0 -1
- package/esm/oidc/util/urlParams.js +0 -54
- package/esm/oidc/util/urlParams.js.map +0 -1
- package/esm/oidc/util/validateClaims.js +0 -53
- package/esm/oidc/util/validateClaims.js.map +0 -1
- package/esm/oidc/util/validateToken.js +0 -21
- package/esm/oidc/util/validateToken.js.map +0 -1
- package/esm/oidc/verifyToken.js +0 -78
- package/esm/oidc/verifyToken.js.map +0 -1
- package/esm/options.js +0 -134
- package/esm/options.js.map +0 -1
- package/esm/server/serverStorage.js +0 -110
- package/esm/server/serverStorage.js.map +0 -1
- package/esm/services/TokenService.js +0 -103
- package/esm/services/TokenService.js.map +0 -1
- package/esm/session.js +0 -81
- package/esm/session.js.map +0 -1
- package/esm/tx/AuthTransaction.js +0 -213
- package/esm/tx/AuthTransaction.js.map +0 -1
- package/esm/tx/TransactionState.js.map +0 -1
- package/esm/tx/api.js +0 -87
- package/esm/tx/api.js.map +0 -1
- package/esm/tx/index.js +0 -18
- package/esm/tx/index.js.map +0 -1
- package/esm/tx/poll.js +0 -124
- package/esm/tx/poll.js.map +0 -1
- package/esm/tx/util.js.map +0 -1
- package/esm/types/AuthState.js +0 -3
- package/esm/types/Cookies.js +0 -3
- package/esm/types/EventEmitter.js +0 -3
- package/esm/types/EventEmitter.js.map +0 -1
- package/esm/types/JWT.js +0 -3
- package/esm/types/JWT.js.map +0 -1
- package/esm/types/OAuth.js +0 -3
- package/esm/types/OAuth.js.map +0 -1
- package/esm/types/OktaAuthOptions.js +0 -3
- package/esm/types/OktaAuthOptions.js.map +0 -1
- package/esm/types/Storage.js +0 -3
- package/esm/types/Storage.js.map +0 -1
- package/esm/types/Token.js +0 -29
- package/esm/types/Token.js.map +0 -1
- package/esm/types/TokenManager.js +0 -3
- package/esm/types/TokenManager.js.map +0 -1
- package/esm/types/Transaction.js +0 -57
- package/esm/types/Transaction.js.map +0 -1
- package/esm/types/UserClaims.js +0 -3
- package/esm/types/UserClaims.js.map +0 -1
- package/esm/types/api.js +0 -3
- package/esm/types/api.js.map +0 -1
- package/esm/types/http.js +0 -3
- package/esm/types/http.js.map +0 -1
- package/esm/types/index.js +0 -27
- package/esm/types/index.js.map +0 -1
- package/esm/util/console.js +0 -53
- package/esm/util/console.js.map +0 -1
- package/esm/util/index.js +0 -17
- package/esm/util/index.js.map +0 -1
- package/esm/util/misc.js +0 -33
- package/esm/util/misc.js.map +0 -1
- package/esm/util/object.js +0 -117
- package/esm/util/object.js.map +0 -1
- package/esm/util/sharedStorage.js +0 -43
- package/esm/util/sharedStorage.js.map +0 -1
- package/esm/util/types.js +0 -27
- package/esm/util/types.js.map +0 -1
- package/esm/util/url.js +0 -64
- package/esm/util/url.js.map +0 -1
- package/lib/idx/flowMonitors/FlowMonitor.d.ts +0 -23
- package/lib/idx/flowMonitors/PasswordRecoveryFlowMonitor.d.ts +0 -16
- package/lib/idx/flowMonitors/RegistrationFlowMonitor.d.ts +0 -15
package/esm/OktaAuth.js
DELETED
|
@@ -1,681 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
|
-
var _excluded = ["originalUri"];
|
|
5
|
-
|
|
6
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
|
-
|
|
10
|
-
/* eslint-disable max-statements */
|
|
11
|
-
|
|
12
|
-
/* eslint-disable complexity */
|
|
13
|
-
|
|
14
|
-
/*!
|
|
15
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
16
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
17
|
-
*
|
|
18
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
21
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
-
*
|
|
23
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/* SDK_VERSION is defined in webpack config */
|
|
27
|
-
|
|
28
|
-
/* global window, SDK_VERSION */
|
|
29
|
-
import { DEFAULT_MAX_CLOCK_SKEW, REFERRER_PATH_STORAGE_KEY } from './constants';
|
|
30
|
-
import * as constants from './constants';
|
|
31
|
-
import { transactionStatus, resumeTransaction, transactionExists, introspect, postToTransaction } from './tx';
|
|
32
|
-
import PKCE from './oidc/util/pkce';
|
|
33
|
-
import { closeSession, sessionExists, getSession, refreshSession, setCookieAndRedirect } from './session';
|
|
34
|
-
import { getOAuthUrls, getWithoutPrompt, getWithPopup, getWithRedirect, isLoginRedirect, parseFromUrl, decodeToken, revokeToken, renewToken, renewTokens, renewTokensWithRefresh, getUserInfo, verifyToken, prepareTokenParams, exchangeCodeForTokens, isInteractionRequiredError, isInteractionRequired } from './oidc';
|
|
35
|
-
import { isBrowser } from './features';
|
|
36
|
-
import * as features from './features';
|
|
37
|
-
import browserStorage from './browser/browserStorage';
|
|
38
|
-
import { toQueryString, toAbsoluteUrl, clone } from './util';
|
|
39
|
-
import { getUserAgent } from './builderUtil';
|
|
40
|
-
import { TokenManager } from './TokenManager';
|
|
41
|
-
import { get, setRequestHeader } from './http';
|
|
42
|
-
import PromiseQueue from './PromiseQueue';
|
|
43
|
-
import fingerprint from './browser/fingerprint';
|
|
44
|
-
import { AuthStateManager } from './AuthStateManager';
|
|
45
|
-
import StorageManager from './StorageManager';
|
|
46
|
-
import TransactionManager from './TransactionManager';
|
|
47
|
-
import { buildOptions } from './options';
|
|
48
|
-
import { interact, introspect as introspectV2, authenticate, cancel, register, recoverPassword, startTransaction, handleInteractionCodeRedirect } from './idx';
|
|
49
|
-
import { createGlobalRequestInterceptor, setGlobalRequestInterceptor } from './idx/headers';
|
|
50
|
-
import { OktaUserAgent } from './OktaUserAgent';
|
|
51
|
-
import { parseOAuthResponseFromUrl } from './oidc/parseFromUrl';
|
|
52
|
-
|
|
53
|
-
var Emitter = require('tiny-emitter');
|
|
54
|
-
|
|
55
|
-
class OktaAuth {
|
|
56
|
-
// keep this field to compatible with released downstream SDK versions
|
|
57
|
-
// TODO: remove in version 6
|
|
58
|
-
// JIRA: https://oktainc.atlassian.net/browse/OKTA-419417
|
|
59
|
-
constructor(args) {
|
|
60
|
-
this.options = buildOptions(args);
|
|
61
|
-
var {
|
|
62
|
-
storageManager,
|
|
63
|
-
cookies,
|
|
64
|
-
storageUtil
|
|
65
|
-
} = this.options;
|
|
66
|
-
this.storageManager = new StorageManager(storageManager, cookies, storageUtil);
|
|
67
|
-
this.transactionManager = new TransactionManager(Object.assign({
|
|
68
|
-
storageManager: this.storageManager
|
|
69
|
-
}, args.transactionManager));
|
|
70
|
-
this._oktaUserAgent = new OktaUserAgent();
|
|
71
|
-
this.tx = {
|
|
72
|
-
status: transactionStatus.bind(null, this),
|
|
73
|
-
resume: resumeTransaction.bind(null, this),
|
|
74
|
-
exists: Object.assign(transactionExists.bind(null, this), {
|
|
75
|
-
_get: name => {
|
|
76
|
-
var storage = storageUtil.storage;
|
|
77
|
-
return storage.get(name);
|
|
78
|
-
}
|
|
79
|
-
}),
|
|
80
|
-
introspect: introspect.bind(null, this)
|
|
81
|
-
};
|
|
82
|
-
this.pkce = {
|
|
83
|
-
DEFAULT_CODE_CHALLENGE_METHOD: PKCE.DEFAULT_CODE_CHALLENGE_METHOD,
|
|
84
|
-
generateVerifier: PKCE.generateVerifier,
|
|
85
|
-
computeChallenge: PKCE.computeChallenge
|
|
86
|
-
}; // Add shims for compatibility, these will be removed in next major version. OKTA-362589
|
|
87
|
-
|
|
88
|
-
Object.assign(this.options.storageUtil, {
|
|
89
|
-
getPKCEStorage: this.storageManager.getLegacyPKCEStorage.bind(this.storageManager),
|
|
90
|
-
getHttpCache: this.storageManager.getHttpCache.bind(this.storageManager)
|
|
91
|
-
});
|
|
92
|
-
this._pending = {
|
|
93
|
-
handleLogin: false
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
if (isBrowser()) {
|
|
97
|
-
this.options = Object.assign(this.options, {
|
|
98
|
-
redirectUri: toAbsoluteUrl(args.redirectUri, window.location.origin) // allow relative URIs
|
|
99
|
-
|
|
100
|
-
});
|
|
101
|
-
this.userAgent = getUserAgent(args, "okta-auth-js/".concat("5.7.0"));
|
|
102
|
-
} else {
|
|
103
|
-
this.userAgent = getUserAgent(args, "okta-auth-js-server/".concat("5.7.0"));
|
|
104
|
-
} // Digital clocks will drift over time, so the server
|
|
105
|
-
// can misalign with the time reported by the browser.
|
|
106
|
-
// The maxClockSkew allows relaxing the time-based
|
|
107
|
-
// validation of tokens (in seconds, not milliseconds).
|
|
108
|
-
// It currently defaults to 300, because 5 min is the
|
|
109
|
-
// default maximum tolerance allowed by Kerberos.
|
|
110
|
-
// (https://technet.microsoft.com/en-us/library/cc976357.aspx)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (!args.maxClockSkew && args.maxClockSkew !== 0) {
|
|
114
|
-
this.options.maxClockSkew = DEFAULT_MAX_CLOCK_SKEW;
|
|
115
|
-
} else {
|
|
116
|
-
this.options.maxClockSkew = args.maxClockSkew;
|
|
117
|
-
} // As some end user's devices can have their date
|
|
118
|
-
// and time incorrectly set, allow for the disabling
|
|
119
|
-
// of the jwt liftetime validation
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this.options.ignoreLifetime = !!args.ignoreLifetime;
|
|
123
|
-
this.session = {
|
|
124
|
-
close: closeSession.bind(null, this),
|
|
125
|
-
exists: sessionExists.bind(null, this),
|
|
126
|
-
get: getSession.bind(null, this),
|
|
127
|
-
refresh: refreshSession.bind(null, this),
|
|
128
|
-
setCookieAndRedirect: setCookieAndRedirect.bind(null, this)
|
|
129
|
-
};
|
|
130
|
-
this._tokenQueue = new PromiseQueue();
|
|
131
|
-
this.token = {
|
|
132
|
-
prepareTokenParams: prepareTokenParams.bind(null, this),
|
|
133
|
-
exchangeCodeForTokens: exchangeCodeForTokens.bind(null, this),
|
|
134
|
-
getWithoutPrompt: getWithoutPrompt.bind(null, this),
|
|
135
|
-
getWithPopup: getWithPopup.bind(null, this),
|
|
136
|
-
getWithRedirect: getWithRedirect.bind(null, this),
|
|
137
|
-
parseFromUrl: parseFromUrl.bind(null, this),
|
|
138
|
-
decode: decodeToken,
|
|
139
|
-
revoke: revokeToken.bind(null, this),
|
|
140
|
-
renew: renewToken.bind(null, this),
|
|
141
|
-
renewTokensWithRefresh: renewTokensWithRefresh.bind(null, this),
|
|
142
|
-
renewTokens: renewTokens.bind(null, this),
|
|
143
|
-
getUserInfo: getUserInfo.bind(null, this),
|
|
144
|
-
verify: verifyToken.bind(null, this),
|
|
145
|
-
isLoginRedirect: isLoginRedirect.bind(null, this)
|
|
146
|
-
}; // Wrap all async token API methods using MethodQueue to avoid issues with concurrency
|
|
147
|
-
|
|
148
|
-
var syncMethods = ['decode', 'isLoginRedirect'];
|
|
149
|
-
Object.keys(this.token).forEach(key => {
|
|
150
|
-
if (syncMethods.indexOf(key) >= 0) {
|
|
151
|
-
// sync methods should not be wrapped
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
var method = this.token[key];
|
|
156
|
-
this.token[key] = PromiseQueue.prototype.push.bind(this._tokenQueue, method, null);
|
|
157
|
-
});
|
|
158
|
-
Object.assign(this.token.getWithRedirect, {
|
|
159
|
-
// This is exposed so we can set window.location in our tests
|
|
160
|
-
_setLocation: function _setLocation(url) {
|
|
161
|
-
window.location = url;
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
Object.assign(this.token.parseFromUrl, {
|
|
165
|
-
// This is exposed so we can mock getting window.history in our tests
|
|
166
|
-
_getHistory: function _getHistory() {
|
|
167
|
-
return window.history;
|
|
168
|
-
},
|
|
169
|
-
// This is exposed so we can mock getting window.location in our tests
|
|
170
|
-
_getLocation: function _getLocation() {
|
|
171
|
-
return window.location;
|
|
172
|
-
},
|
|
173
|
-
// This is exposed so we can mock getting window.document in our tests
|
|
174
|
-
_getDocument: function _getDocument() {
|
|
175
|
-
return window.document;
|
|
176
|
-
}
|
|
177
|
-
}); // IDX
|
|
178
|
-
|
|
179
|
-
this.idx = {
|
|
180
|
-
interact: interact.bind(null, this),
|
|
181
|
-
introspect: introspectV2.bind(null, this),
|
|
182
|
-
authenticate: authenticate.bind(null, this),
|
|
183
|
-
register: register.bind(null, this),
|
|
184
|
-
cancel: cancel.bind(null, this),
|
|
185
|
-
recoverPassword: recoverPassword.bind(null, this),
|
|
186
|
-
handleInteractionCodeRedirect: handleInteractionCodeRedirect.bind(null, this),
|
|
187
|
-
startTransaction: startTransaction.bind(null, this)
|
|
188
|
-
};
|
|
189
|
-
setGlobalRequestInterceptor(createGlobalRequestInterceptor(this)); // to pass custom headers to IDX endpoints
|
|
190
|
-
// HTTP
|
|
191
|
-
|
|
192
|
-
this.http = {
|
|
193
|
-
setRequestHeader: setRequestHeader.bind(null, this)
|
|
194
|
-
}; // Fingerprint API
|
|
195
|
-
|
|
196
|
-
this.fingerprint = fingerprint.bind(null, this);
|
|
197
|
-
this.emitter = new Emitter(); // TokenManager
|
|
198
|
-
|
|
199
|
-
this.tokenManager = new TokenManager(this, args.tokenManager); // AuthStateManager
|
|
200
|
-
|
|
201
|
-
this.authStateManager = new AuthStateManager(this);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
start() {
|
|
205
|
-
this.tokenManager.start();
|
|
206
|
-
|
|
207
|
-
if (!this.token.isLoginRedirect()) {
|
|
208
|
-
this.authStateManager.updateAuthState();
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
stop() {
|
|
213
|
-
this.tokenManager.stop();
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
setHeaders(headers) {
|
|
217
|
-
this.options.headers = Object.assign({}, this.options.headers, headers);
|
|
218
|
-
} // ES6 module users can use named exports to access all symbols
|
|
219
|
-
// CommonJS module users (CDN) need all exports on this object
|
|
220
|
-
// Utility methods for interaction code flow
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
isInteractionRequired() {
|
|
224
|
-
return isInteractionRequired(this);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
isInteractionRequiredError(error) {
|
|
228
|
-
return isInteractionRequiredError(error);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
signIn(opts) {
|
|
232
|
-
var _this = this;
|
|
233
|
-
|
|
234
|
-
return _asyncToGenerator(function* () {
|
|
235
|
-
// TODO: support interaction code flow
|
|
236
|
-
// Authn V1 flow
|
|
237
|
-
return _this.signInWithCredentials(opts);
|
|
238
|
-
})();
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
signInWithCredentials(opts) {
|
|
242
|
-
var _this2 = this;
|
|
243
|
-
|
|
244
|
-
return _asyncToGenerator(function* () {
|
|
245
|
-
opts = clone(opts || {});
|
|
246
|
-
|
|
247
|
-
var _postToTransaction = options => {
|
|
248
|
-
delete opts.sendFingerprint;
|
|
249
|
-
return postToTransaction(_this2, '/api/v1/authn', opts, options);
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
if (!opts.sendFingerprint) {
|
|
253
|
-
return _postToTransaction();
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return _this2.fingerprint().then(function (fingerprint) {
|
|
257
|
-
return _postToTransaction({
|
|
258
|
-
headers: {
|
|
259
|
-
'X-Device-Fingerprint': fingerprint
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
})();
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
signInWithRedirect() {
|
|
267
|
-
var _arguments = arguments,
|
|
268
|
-
_this3 = this;
|
|
269
|
-
|
|
270
|
-
return _asyncToGenerator(function* () {
|
|
271
|
-
var opts = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};
|
|
272
|
-
|
|
273
|
-
var {
|
|
274
|
-
originalUri
|
|
275
|
-
} = opts,
|
|
276
|
-
additionalParams = _objectWithoutProperties(opts, _excluded);
|
|
277
|
-
|
|
278
|
-
if (_this3._pending.handleLogin) {
|
|
279
|
-
// Don't trigger second round
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
_this3._pending.handleLogin = true;
|
|
284
|
-
|
|
285
|
-
try {
|
|
286
|
-
// Trigger default signIn redirect flow
|
|
287
|
-
if (originalUri) {
|
|
288
|
-
_this3.setOriginalUri(originalUri);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
var params = Object.assign({
|
|
292
|
-
// TODO: remove this line when default scopes are changed OKTA-343294
|
|
293
|
-
scopes: _this3.options.scopes || ['openid', 'email', 'profile']
|
|
294
|
-
}, additionalParams);
|
|
295
|
-
yield _this3.token.getWithRedirect(params);
|
|
296
|
-
} finally {
|
|
297
|
-
_this3._pending.handleLogin = false;
|
|
298
|
-
}
|
|
299
|
-
})();
|
|
300
|
-
} // Ends the current Okta SSO session without redirecting to Okta.
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
closeSession() {
|
|
304
|
-
// Clear all local tokens
|
|
305
|
-
this.tokenManager.clear();
|
|
306
|
-
return this.session.close() // DELETE /api/v1/sessions/me
|
|
307
|
-
.catch(function (e) {
|
|
308
|
-
if (e.name === 'AuthApiError' && e.errorCode === 'E0000007') {
|
|
309
|
-
// Session does not exist or has already been closed
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
throw e;
|
|
314
|
-
});
|
|
315
|
-
} // Revokes the access token for the application session
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
revokeAccessToken(accessToken) {
|
|
319
|
-
var _this4 = this;
|
|
320
|
-
|
|
321
|
-
return _asyncToGenerator(function* () {
|
|
322
|
-
if (!accessToken) {
|
|
323
|
-
accessToken = (yield _this4.tokenManager.getTokens()).accessToken;
|
|
324
|
-
|
|
325
|
-
var accessTokenKey = _this4.tokenManager.getStorageKeyByType('accessToken');
|
|
326
|
-
|
|
327
|
-
_this4.tokenManager.remove(accessTokenKey);
|
|
328
|
-
} // Access token may have been removed. In this case, we will silently succeed.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
if (!accessToken) {
|
|
332
|
-
return Promise.resolve(null);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
return _this4.token.revoke(accessToken);
|
|
336
|
-
})();
|
|
337
|
-
} // Revokes the refresh token for the application session
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
revokeRefreshToken(refreshToken) {
|
|
341
|
-
var _this5 = this;
|
|
342
|
-
|
|
343
|
-
return _asyncToGenerator(function* () {
|
|
344
|
-
if (!refreshToken) {
|
|
345
|
-
refreshToken = (yield _this5.tokenManager.getTokens()).refreshToken;
|
|
346
|
-
|
|
347
|
-
var refreshTokenKey = _this5.tokenManager.getStorageKeyByType('refreshToken');
|
|
348
|
-
|
|
349
|
-
_this5.tokenManager.remove(refreshTokenKey);
|
|
350
|
-
} // Refresh token may have been removed. In this case, we will silently succeed.
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
if (!refreshToken) {
|
|
354
|
-
return Promise.resolve(null);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
return _this5.token.revoke(refreshToken);
|
|
358
|
-
})();
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
getSignOutRedirectUrl() {
|
|
362
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
363
|
-
var {
|
|
364
|
-
idToken,
|
|
365
|
-
postLogoutRedirectUri,
|
|
366
|
-
state
|
|
367
|
-
} = options;
|
|
368
|
-
|
|
369
|
-
if (!idToken) {
|
|
370
|
-
idToken = this.tokenManager.getTokensSync().idToken;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
if (!idToken) {
|
|
374
|
-
return '';
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
if (!postLogoutRedirectUri) {
|
|
378
|
-
postLogoutRedirectUri = this.options.postLogoutRedirectUri;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
var logoutUrl = getOAuthUrls(this).logoutUrl;
|
|
382
|
-
var idTokenHint = idToken.idToken; // a string
|
|
383
|
-
|
|
384
|
-
var logoutUri = logoutUrl + '?id_token_hint=' + encodeURIComponent(idTokenHint);
|
|
385
|
-
|
|
386
|
-
if (postLogoutRedirectUri) {
|
|
387
|
-
logoutUri += '&post_logout_redirect_uri=' + encodeURIComponent(postLogoutRedirectUri);
|
|
388
|
-
} // State allows option parameters to be passed to logout redirect uri
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
if (state) {
|
|
392
|
-
logoutUri += '&state=' + encodeURIComponent(state);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return logoutUri;
|
|
396
|
-
} // Revokes refreshToken or accessToken, clears all local tokens, then redirects to Okta to end the SSO session.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
signOut(options) {
|
|
400
|
-
var _this6 = this;
|
|
401
|
-
|
|
402
|
-
return _asyncToGenerator(function* () {
|
|
403
|
-
options = Object.assign({}, options); // postLogoutRedirectUri must be whitelisted in Okta Admin UI
|
|
404
|
-
|
|
405
|
-
var defaultUri = window.location.origin;
|
|
406
|
-
var currentUri = window.location.href;
|
|
407
|
-
var postLogoutRedirectUri = options.postLogoutRedirectUri || _this6.options.postLogoutRedirectUri || defaultUri;
|
|
408
|
-
var accessToken = options.accessToken;
|
|
409
|
-
var refreshToken = options.refreshToken;
|
|
410
|
-
var revokeAccessToken = options.revokeAccessToken !== false;
|
|
411
|
-
var revokeRefreshToken = options.revokeRefreshToken !== false;
|
|
412
|
-
|
|
413
|
-
if (revokeRefreshToken && typeof refreshToken === 'undefined') {
|
|
414
|
-
refreshToken = _this6.tokenManager.getTokensSync().refreshToken;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if (revokeAccessToken && typeof accessToken === 'undefined') {
|
|
418
|
-
accessToken = _this6.tokenManager.getTokensSync().accessToken;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
if (!options.idToken) {
|
|
422
|
-
options.idToken = _this6.tokenManager.getTokensSync().idToken;
|
|
423
|
-
} // Clear all local tokens
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
_this6.tokenManager.clear();
|
|
427
|
-
|
|
428
|
-
if (revokeRefreshToken && refreshToken) {
|
|
429
|
-
yield _this6.revokeRefreshToken(refreshToken);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
if (revokeAccessToken && accessToken) {
|
|
433
|
-
yield _this6.revokeAccessToken(accessToken);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
var logoutUri = _this6.getSignOutRedirectUrl(_objectSpread(_objectSpread({}, options), {}, {
|
|
437
|
-
postLogoutRedirectUri
|
|
438
|
-
})); // No logoutUri? This can happen if the storage was cleared.
|
|
439
|
-
// Fallback to XHR signOut, then simulate a redirect to the post logout uri
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
if (!logoutUri) {
|
|
443
|
-
return _this6.closeSession() // can throw if the user cannot be signed out
|
|
444
|
-
.then(function () {
|
|
445
|
-
if (postLogoutRedirectUri === currentUri) {
|
|
446
|
-
window.location.reload(); // force a hard reload if URI is not changing
|
|
447
|
-
} else {
|
|
448
|
-
window.location.assign(postLogoutRedirectUri);
|
|
449
|
-
}
|
|
450
|
-
});
|
|
451
|
-
} else {
|
|
452
|
-
// Flow ends with logout redirect
|
|
453
|
-
window.location.assign(logoutUri);
|
|
454
|
-
}
|
|
455
|
-
})();
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
webfinger(opts) {
|
|
459
|
-
var url = '/.well-known/webfinger' + toQueryString(opts);
|
|
460
|
-
var options = {
|
|
461
|
-
headers: {
|
|
462
|
-
'Accept': 'application/jrd+json'
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
return get(this, url, options);
|
|
466
|
-
} //
|
|
467
|
-
// Common Methods from downstream SDKs
|
|
468
|
-
//
|
|
469
|
-
// Returns true if both accessToken and idToken are not expired
|
|
470
|
-
// If `autoRenew` option is set, will attempt to renew expired tokens before returning.
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
isAuthenticated() {
|
|
474
|
-
var _this7 = this;
|
|
475
|
-
|
|
476
|
-
return _asyncToGenerator(function* () {
|
|
477
|
-
var {
|
|
478
|
-
accessToken,
|
|
479
|
-
idToken
|
|
480
|
-
} = _this7.tokenManager.getTokensSync();
|
|
481
|
-
|
|
482
|
-
var {
|
|
483
|
-
autoRenew,
|
|
484
|
-
autoRemove
|
|
485
|
-
} = _this7.tokenManager.getOptions();
|
|
486
|
-
|
|
487
|
-
if (accessToken && _this7.tokenManager.hasExpired(accessToken)) {
|
|
488
|
-
accessToken = null;
|
|
489
|
-
|
|
490
|
-
if (autoRenew) {
|
|
491
|
-
accessToken = yield _this7.tokenManager.renew('accessToken');
|
|
492
|
-
} else if (autoRemove) {
|
|
493
|
-
_this7.tokenManager.remove('accessToken');
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
if (idToken && _this7.tokenManager.hasExpired(idToken)) {
|
|
498
|
-
idToken = null;
|
|
499
|
-
|
|
500
|
-
if (autoRenew) {
|
|
501
|
-
idToken = yield _this7.tokenManager.renew('idToken');
|
|
502
|
-
} else if (autoRemove) {
|
|
503
|
-
_this7.tokenManager.remove('idToken');
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
return !!(accessToken && idToken);
|
|
508
|
-
})();
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
getUser() {
|
|
512
|
-
var _this8 = this;
|
|
513
|
-
|
|
514
|
-
return _asyncToGenerator(function* () {
|
|
515
|
-
var {
|
|
516
|
-
idToken,
|
|
517
|
-
accessToken
|
|
518
|
-
} = _this8.tokenManager.getTokensSync();
|
|
519
|
-
|
|
520
|
-
return _this8.token.getUserInfo(accessToken, idToken);
|
|
521
|
-
})();
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
getIdToken() {
|
|
525
|
-
var {
|
|
526
|
-
idToken
|
|
527
|
-
} = this.tokenManager.getTokensSync();
|
|
528
|
-
return idToken ? idToken.idToken : undefined;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
getAccessToken() {
|
|
532
|
-
var {
|
|
533
|
-
accessToken
|
|
534
|
-
} = this.tokenManager.getTokensSync();
|
|
535
|
-
return accessToken ? accessToken.accessToken : undefined;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
getRefreshToken() {
|
|
539
|
-
var {
|
|
540
|
-
refreshToken
|
|
541
|
-
} = this.tokenManager.getTokensSync();
|
|
542
|
-
return refreshToken ? refreshToken.refreshToken : undefined;
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* Store parsed tokens from redirect url
|
|
546
|
-
*/
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
storeTokensFromRedirect() {
|
|
550
|
-
var _this9 = this;
|
|
551
|
-
|
|
552
|
-
return _asyncToGenerator(function* () {
|
|
553
|
-
var {
|
|
554
|
-
tokens
|
|
555
|
-
} = yield _this9.token.parseFromUrl();
|
|
556
|
-
|
|
557
|
-
_this9.tokenManager.setTokens(tokens);
|
|
558
|
-
})();
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
setOriginalUri(originalUri) {
|
|
562
|
-
var storage = browserStorage.getSessionStorage();
|
|
563
|
-
storage.setItem(REFERRER_PATH_STORAGE_KEY, originalUri);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
getOriginalUri(state) {
|
|
567
|
-
if (state) {
|
|
568
|
-
var meta = this.transactionManager.load({
|
|
569
|
-
oauth: true,
|
|
570
|
-
state
|
|
571
|
-
});
|
|
572
|
-
return meta.originalUri;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
var storage = browserStorage.getSessionStorage();
|
|
576
|
-
var originalUri = storage ? storage.getItem(REFERRER_PATH_STORAGE_KEY) : undefined;
|
|
577
|
-
return originalUri;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
removeOriginalUri() {
|
|
581
|
-
var storage = browserStorage.getSessionStorage();
|
|
582
|
-
storage.removeItem(REFERRER_PATH_STORAGE_KEY);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
isLoginRedirect() {
|
|
586
|
-
return isLoginRedirect(this);
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
handleLoginRedirect(tokens, originalUri) {
|
|
590
|
-
var _this10 = this;
|
|
591
|
-
|
|
592
|
-
return _asyncToGenerator(function* () {
|
|
593
|
-
// Store tokens and update AuthState by the emitted events
|
|
594
|
-
if (tokens) {
|
|
595
|
-
_this10.tokenManager.setTokens(tokens);
|
|
596
|
-
|
|
597
|
-
originalUri = originalUri || _this10.getOriginalUri();
|
|
598
|
-
} else if (_this10.isLoginRedirect()) {
|
|
599
|
-
// For redirect flow, get state from the URL and use it to retrieve the originalUri
|
|
600
|
-
var {
|
|
601
|
-
state
|
|
602
|
-
} = yield parseOAuthResponseFromUrl(_this10, {});
|
|
603
|
-
originalUri = originalUri || _this10.getOriginalUri(state);
|
|
604
|
-
yield _this10.storeTokensFromRedirect();
|
|
605
|
-
} else {
|
|
606
|
-
return; // nothing to do
|
|
607
|
-
} // ensure auth state has been updated
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
yield _this10.authStateManager.updateAuthState(); // clear originalUri from storage
|
|
611
|
-
|
|
612
|
-
_this10.removeOriginalUri(); // Redirect to originalUri
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
var {
|
|
616
|
-
restoreOriginalUri
|
|
617
|
-
} = _this10.options;
|
|
618
|
-
|
|
619
|
-
if (restoreOriginalUri) {
|
|
620
|
-
yield restoreOriginalUri(_this10, originalUri);
|
|
621
|
-
} else {
|
|
622
|
-
window.location.replace(originalUri);
|
|
623
|
-
}
|
|
624
|
-
})();
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
isPKCE() {
|
|
628
|
-
return !!this.options.pkce;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
hasResponseType(responseType) {
|
|
632
|
-
var hasResponseType = false;
|
|
633
|
-
|
|
634
|
-
if (Array.isArray(this.options.responseType) && this.options.responseType.length) {
|
|
635
|
-
hasResponseType = this.options.responseType.indexOf(responseType) >= 0;
|
|
636
|
-
} else {
|
|
637
|
-
hasResponseType = this.options.responseType === responseType;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
return hasResponseType;
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
isAuthorizationCodeFlow() {
|
|
644
|
-
return this.hasResponseType('code');
|
|
645
|
-
} // { username, password, (relayState), (context) }
|
|
646
|
-
// signIn(opts: SignInWithCredentialsOptions): Promise<AuthTransaction> {
|
|
647
|
-
// return postToTransaction(this, '/api/v1/authn', opts);
|
|
648
|
-
// }
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
getIssuerOrigin() {
|
|
652
|
-
// Infer the URL from the issuer URL, omitting the /oauth2/{authServerId}
|
|
653
|
-
return this.options.issuer.split('/oauth2/')[0];
|
|
654
|
-
} // { username, (relayState) }
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
forgotPassword(opts) {
|
|
658
|
-
return postToTransaction(this, '/api/v1/authn/recovery/password', opts);
|
|
659
|
-
} // { username, (relayState) }
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
unlockAccount(opts) {
|
|
663
|
-
return postToTransaction(this, '/api/v1/authn/recovery/unlock', opts);
|
|
664
|
-
} // { recoveryToken }
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
verifyRecoveryToken(opts) {
|
|
668
|
-
return postToTransaction(this, '/api/v1/authn/recovery/token', opts);
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
} // Hoist feature detection functions to static type
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
OktaAuth.features = OktaAuth.prototype.features = features; // Also hoist values and utility functions for CommonJS users
|
|
675
|
-
|
|
676
|
-
Object.assign(OktaAuth, {
|
|
677
|
-
constants,
|
|
678
|
-
isInteractionRequiredError
|
|
679
|
-
});
|
|
680
|
-
export default OktaAuth;
|
|
681
|
-
//# sourceMappingURL=OktaAuth.js.map
|