@okta/okta-auth-js 7.0.2 → 7.1.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 +6 -0
- package/README.md +2 -0
- package/cjs/authn/AuthnTransactionImpl.js +6 -8
- package/cjs/authn/AuthnTransactionImpl.js.map +1 -1
- package/cjs/authn/api.js +3 -18
- package/cjs/authn/api.js.map +1 -1
- package/cjs/authn/factory.js +1 -7
- package/cjs/authn/factory.js.map +1 -1
- package/cjs/authn/index.js +0 -5
- package/cjs/authn/index.js.map +1 -1
- package/cjs/authn/mixin.js +14 -22
- package/cjs/authn/mixin.js.map +1 -1
- package/cjs/authn/util/flattenEmbedded.js +5 -12
- package/cjs/authn/util/flattenEmbedded.js.map +1 -1
- package/cjs/authn/util/link2fn.js +0 -22
- package/cjs/authn/util/link2fn.js.map +1 -1
- package/cjs/authn/util/links2fns.js +0 -12
- package/cjs/authn/util/links2fns.js.map +1 -1
- package/cjs/authn/util/poll.js +9 -27
- package/cjs/authn/util/poll.js.map +1 -1
- package/cjs/authn/util/stateToken.js +3 -4
- package/cjs/authn/util/stateToken.js.map +1 -1
- package/cjs/base/factory.js +6 -14
- package/cjs/base/factory.js.map +1 -1
- package/cjs/base/index.js +0 -5
- package/cjs/base/index.js.map +1 -1
- package/cjs/base/options.js +1 -2
- package/cjs/base/options.js.map +1 -1
- package/cjs/browser/browserStorage.js +15 -43
- package/cjs/browser/browserStorage.js.map +1 -1
- package/cjs/browser/fingerprint.js +3 -15
- package/cjs/browser/fingerprint.js.map +1 -1
- package/cjs/clock.js +5 -7
- package/cjs/clock.js.map +1 -1
- package/cjs/constants.js +4 -3
- package/cjs/constants.js.map +1 -1
- package/cjs/core/AuthStateManager.js +24 -48
- package/cjs/core/AuthStateManager.js.map +1 -1
- package/cjs/core/ServiceManager/browser.js +13 -33
- package/cjs/core/ServiceManager/browser.js.map +1 -1
- package/cjs/core/ServiceManager/index.js +0 -1
- package/cjs/core/ServiceManager/index.js.map +1 -1
- package/cjs/core/ServiceManager/node.js +3 -9
- package/cjs/core/ServiceManager/node.js.map +1 -1
- package/cjs/core/factory.js +0 -7
- package/cjs/core/factory.js.map +1 -1
- package/cjs/core/index.js +0 -13
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/mixin.js +16 -20
- package/cjs/core/mixin.js.map +1 -1
- package/cjs/core/options.js +1 -3
- package/cjs/core/options.js.map +1 -1
- package/cjs/core/storage.js +0 -2
- package/cjs/core/storage.js.map +1 -1
- package/cjs/core/types/index.js +0 -5
- package/cjs/core/types/index.js.map +1 -1
- package/cjs/crypto/base64.js +9 -22
- package/cjs/crypto/base64.js.map +1 -1
- package/cjs/crypto/browser.js +0 -4
- package/cjs/crypto/browser.js.map +1 -1
- package/cjs/crypto/index.js +0 -9
- package/cjs/crypto/index.js.map +1 -1
- package/cjs/crypto/node.js +0 -13
- package/cjs/crypto/node.js.map +1 -1
- package/cjs/crypto/oidcHash.js +1 -4
- package/cjs/crypto/oidcHash.js.map +1 -1
- package/cjs/crypto/verifyToken.js +6 -7
- package/cjs/crypto/verifyToken.js.map +1 -1
- package/cjs/crypto/webcrypto.js +0 -1
- package/cjs/crypto/webcrypto.js.map +1 -1
- package/cjs/errors/AuthApiError.js +1 -7
- package/cjs/errors/AuthApiError.js.map +1 -1
- package/cjs/errors/AuthPollStopError.js +1 -5
- package/cjs/errors/AuthPollStopError.js.map +1 -1
- package/cjs/errors/AuthSdkError.js +1 -6
- package/cjs/errors/AuthSdkError.js.map +1 -1
- package/cjs/errors/CustomError.js +1 -4
- package/cjs/errors/CustomError.js.map +1 -1
- package/cjs/errors/OAuthError.js +4 -7
- package/cjs/errors/OAuthError.js.map +1 -1
- package/cjs/errors/index.js +1 -9
- package/cjs/errors/index.js.map +1 -1
- package/cjs/exports/authn.js +0 -9
- package/cjs/exports/authn.js.map +1 -1
- package/cjs/exports/cdn/authn.js +0 -2
- package/cjs/exports/cdn/authn.js.map +1 -1
- package/cjs/exports/cdn/core.js +0 -2
- package/cjs/exports/cdn/core.js.map +1 -1
- package/cjs/exports/cdn/default.js +0 -2
- package/cjs/exports/cdn/default.js.map +1 -1
- package/cjs/exports/cdn/idx.js +0 -2
- package/cjs/exports/cdn/idx.js.map +1 -1
- package/cjs/exports/cdn/myaccount.js +0 -2
- package/cjs/exports/cdn/myaccount.js.map +1 -1
- package/cjs/exports/common.js +0 -22
- package/cjs/exports/common.js.map +1 -1
- package/cjs/exports/core.js +0 -9
- package/cjs/exports/core.js.map +1 -1
- package/cjs/exports/default.js +2 -12
- package/cjs/exports/default.js.map +1 -1
- package/cjs/exports/idx.js +3 -7
- package/cjs/exports/idx.js.map +1 -1
- package/cjs/exports/myaccount.js +0 -9
- package/cjs/exports/myaccount.js.map +1 -1
- package/cjs/features.js +1 -18
- package/cjs/features.js.map +1 -1
- package/cjs/fetch/fetchRequest.js +6 -20
- package/cjs/fetch/fetchRequest.js.map +1 -1
- package/cjs/http/OktaUserAgent.js +3 -11
- package/cjs/http/OktaUserAgent.js.map +1 -1
- package/cjs/http/headers.js +1 -1
- package/cjs/http/headers.js.map +1 -1
- package/cjs/http/index.js +0 -11
- package/cjs/http/index.js.map +1 -1
- package/cjs/http/mixin.js +2 -10
- package/cjs/http/mixin.js.map +1 -1
- package/cjs/http/options.js +1 -5
- package/cjs/http/options.js.map +1 -1
- package/cjs/http/request.js +75 -57
- package/cjs/http/request.js.map +1 -1
- package/cjs/idx/IdxTransactionManager.js +2 -22
- package/cjs/idx/IdxTransactionManager.js.map +1 -1
- package/cjs/idx/authenticate.js +3 -5
- package/cjs/idx/authenticate.js.map +1 -1
- package/cjs/idx/authenticator/Authenticator.js +2 -4
- package/cjs/idx/authenticator/Authenticator.js.map +1 -1
- package/cjs/idx/authenticator/OktaPassword.js +2 -10
- package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
- package/cjs/idx/authenticator/OktaVerifyTotp.js +0 -6
- package/cjs/idx/authenticator/OktaVerifyTotp.js.map +1 -1
- package/cjs/idx/authenticator/SecurityQuestionEnrollment.js +0 -10
- package/cjs/idx/authenticator/SecurityQuestionEnrollment.js.map +1 -1
- package/cjs/idx/authenticator/SecurityQuestionVerification.js +1 -10
- package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
- package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +2 -10
- package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
- package/cjs/idx/authenticator/WebauthnEnrollment.js +0 -8
- package/cjs/idx/authenticator/WebauthnEnrollment.js.map +1 -1
- package/cjs/idx/authenticator/WebauthnVerification.js +0 -8
- package/cjs/idx/authenticator/WebauthnVerification.js.map +1 -1
- package/cjs/idx/authenticator/getAuthenticator.js +0 -15
- package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
- package/cjs/idx/authenticator/index.js +0 -15
- package/cjs/idx/authenticator/index.js.map +1 -1
- package/cjs/idx/authenticator/util.js +8 -18
- package/cjs/idx/authenticator/util.js.map +1 -1
- package/cjs/idx/cancel.js +3 -4
- package/cjs/idx/cancel.js.map +1 -1
- package/cjs/idx/emailVerify.js +5 -13
- package/cjs/idx/emailVerify.js.map +1 -1
- package/cjs/idx/factory/OktaAuthIdx.js +0 -3
- package/cjs/idx/factory/OktaAuthIdx.js.map +1 -1
- package/cjs/idx/factory/api.js +1 -17
- package/cjs/idx/factory/api.js.map +1 -1
- package/cjs/idx/factory/index.js +0 -3
- package/cjs/idx/factory/index.js.map +1 -1
- package/cjs/idx/flow/AccountUnlockFlow.js +1 -2
- package/cjs/idx/flow/AccountUnlockFlow.js.map +1 -1
- package/cjs/idx/flow/AuthenticationFlow.js +1 -2
- package/cjs/idx/flow/AuthenticationFlow.js.map +1 -1
- package/cjs/idx/flow/FlowSpecification.js +2 -13
- package/cjs/idx/flow/FlowSpecification.js.map +1 -1
- package/cjs/idx/flow/PasswordRecoveryFlow.js +1 -2
- package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -1
- package/cjs/idx/flow/RegistrationFlow.js +1 -2
- package/cjs/idx/flow/RegistrationFlow.js.map +1 -1
- package/cjs/idx/flow/index.js +0 -11
- package/cjs/idx/flow/index.js.map +1 -1
- package/cjs/idx/handleInteractionCodeRedirect.js +7 -12
- package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
- package/cjs/idx/idxState/index.js +1 -11
- package/cjs/idx/idxState/index.js.map +1 -1
- package/cjs/idx/idxState/v1/actionParser.js +1 -12
- package/cjs/idx/idxState/v1/actionParser.js.map +1 -1
- package/cjs/idx/idxState/v1/generateIdxAction.js +10 -15
- package/cjs/idx/idxState/v1/generateIdxAction.js.map +1 -1
- package/cjs/idx/idxState/v1/idxResponseParser.js +7 -23
- package/cjs/idx/idxState/v1/idxResponseParser.js.map +1 -1
- package/cjs/idx/idxState/v1/makeIdxState.js +2 -10
- package/cjs/idx/idxState/v1/makeIdxState.js.map +1 -1
- package/cjs/idx/idxState/v1/parsers.js +0 -2
- package/cjs/idx/idxState/v1/parsers.js.map +1 -1
- package/cjs/idx/idxState/v1/remediationParser.js +2 -4
- package/cjs/idx/idxState/v1/remediationParser.js.map +1 -1
- package/cjs/idx/index.js +0 -26
- package/cjs/idx/index.js.map +1 -1
- package/cjs/idx/interact.js +18 -18
- package/cjs/idx/interact.js.map +1 -1
- package/cjs/idx/introspect.js +5 -14
- package/cjs/idx/introspect.js.map +1 -1
- package/cjs/idx/mixin.js +0 -9
- package/cjs/idx/mixin.js.map +1 -1
- package/cjs/idx/options.js +2 -3
- package/cjs/idx/options.js.map +1 -1
- package/cjs/idx/poll.js +1 -10
- package/cjs/idx/poll.js.map +1 -1
- package/cjs/idx/proceed.js +3 -9
- package/cjs/idx/proceed.js.map +1 -1
- package/cjs/idx/recoverPassword.js +3 -4
- package/cjs/idx/recoverPassword.js.map +1 -1
- package/cjs/idx/register.js +5 -10
- package/cjs/idx/register.js.map +1 -1
- package/cjs/idx/remediate.js +24 -45
- package/cjs/idx/remediate.js.map +1 -1
- package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +7 -16
- package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
- package/cjs/idx/remediators/AuthenticatorVerificationData.js +7 -15
- package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
- package/cjs/idx/remediators/Base/AuthenticatorData.js +7 -22
- package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
- package/cjs/idx/remediators/Base/Remediator.js +38 -67
- package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
- package/cjs/idx/remediators/Base/SelectAuthenticator.js +13 -30
- package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js +5 -13
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/ChallengeAuthenticator.js +1 -5
- package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/ChallengePoll.js +1 -6
- package/cjs/idx/remediators/ChallengePoll.js.map +1 -1
- package/cjs/idx/remediators/EnrollAuthenticator.js +1 -5
- package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/EnrollPoll.js +5 -12
- package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
- package/cjs/idx/remediators/EnrollProfile.js +8 -30
- package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
- package/cjs/idx/remediators/EnrollmentChannelData.js +5 -13
- package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -1
- package/cjs/idx/remediators/GenericRemediator/GenericRemediator.js +13 -19
- package/cjs/idx/remediators/GenericRemediator/GenericRemediator.js.map +1 -1
- package/cjs/idx/remediators/GenericRemediator/index.js +0 -1
- package/cjs/idx/remediators/GenericRemediator/index.js.map +1 -1
- package/cjs/idx/remediators/GenericRemediator/util.js +19 -31
- package/cjs/idx/remediators/GenericRemediator/util.js.map +1 -1
- package/cjs/idx/remediators/Identify.js +3 -12
- package/cjs/idx/remediators/Identify.js.map +1 -1
- package/cjs/idx/remediators/ReEnrollAuthenticator.js +3 -10
- package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/RedirectIdp.js +1 -7
- package/cjs/idx/remediators/RedirectIdp.js.map +1 -1
- package/cjs/idx/remediators/ResetAuthenticator.js +1 -5
- package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +3 -11
- package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
- package/cjs/idx/remediators/SelectAuthenticatorEnroll.js +1 -5
- package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
- package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js +6 -15
- package/cjs/idx/remediators/SelectAuthenticatorUnlockAccount.js.map +1 -1
- package/cjs/idx/remediators/SelectEnrollProfile.js +1 -6
- package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
- package/cjs/idx/remediators/SelectEnrollmentChannel.js +5 -16
- package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -1
- package/cjs/idx/remediators/Skip.js +1 -6
- package/cjs/idx/remediators/Skip.js.map +1 -1
- package/cjs/idx/remediators/index.js +0 -39
- package/cjs/idx/remediators/index.js.map +1 -1
- package/cjs/idx/remediators/util.js +1 -7
- package/cjs/idx/remediators/util.js.map +1 -1
- package/cjs/idx/run.js +37 -52
- package/cjs/idx/run.js.map +1 -1
- package/cjs/idx/startTransaction.js +1 -2
- package/cjs/idx/startTransaction.js.map +1 -1
- package/cjs/idx/storage.js +3 -22
- package/cjs/idx/storage.js.map +1 -1
- package/cjs/idx/transactionMeta.js +24 -42
- package/cjs/idx/transactionMeta.js.map +1 -1
- package/cjs/idx/types/api.js +1 -9
- package/cjs/idx/types/api.js.map +1 -1
- package/cjs/idx/types/idx-js.js +3 -3
- package/cjs/idx/types/idx-js.js.map +1 -1
- package/cjs/idx/types/index.js +0 -7
- package/cjs/idx/types/index.js.map +1 -1
- package/cjs/idx/types/meta.js.map +1 -1
- package/cjs/idx/types/options.js.map +1 -1
- package/cjs/idx/unlockAccount.js +7 -11
- package/cjs/idx/unlockAccount.js.map +1 -1
- package/cjs/idx/util.js +24 -76
- package/cjs/idx/util.js.map +1 -1
- package/cjs/idx/webauthn.js +13 -18
- package/cjs/idx/webauthn.js.map +1 -1
- package/cjs/myaccount/api.js +0 -5
- package/cjs/myaccount/api.js.map +1 -1
- package/cjs/myaccount/emailApi.js +6 -21
- package/cjs/myaccount/emailApi.js.map +1 -1
- package/cjs/myaccount/factory.js +0 -3
- package/cjs/myaccount/factory.js.map +1 -1
- package/cjs/myaccount/index.js +0 -7
- package/cjs/myaccount/index.js.map +1 -1
- package/cjs/myaccount/mixin.js +0 -5
- package/cjs/myaccount/mixin.js.map +1 -1
- package/cjs/myaccount/phoneApi.js +5 -18
- package/cjs/myaccount/phoneApi.js.map +1 -1
- package/cjs/myaccount/profileApi.js +2 -9
- package/cjs/myaccount/profileApi.js.map +1 -1
- package/cjs/myaccount/request.js +12 -78
- package/cjs/myaccount/request.js.map +1 -1
- package/cjs/myaccount/transactions/Base.js +5 -7
- package/cjs/myaccount/transactions/Base.js.map +1 -1
- package/cjs/myaccount/transactions/EmailChallengeTransaction.js +5 -10
- package/cjs/myaccount/transactions/EmailChallengeTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/EmailStatusTransaction.js +2 -7
- package/cjs/myaccount/transactions/EmailStatusTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/EmailTransaction.js +5 -13
- package/cjs/myaccount/transactions/EmailTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/PhoneTransaction.js +5 -12
- package/cjs/myaccount/transactions/PhoneTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/ProfileSchemaTransaction.js +0 -5
- package/cjs/myaccount/transactions/ProfileSchemaTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/ProfileTransaction.js +0 -5
- package/cjs/myaccount/transactions/ProfileTransaction.js.map +1 -1
- package/cjs/myaccount/transactions/index.js +0 -8
- package/cjs/myaccount/transactions/index.js.map +1 -1
- package/cjs/myaccount/types.js +0 -5
- package/cjs/myaccount/types.js.map +1 -1
- package/cjs/oidc/TokenManager.js +39 -100
- package/cjs/oidc/TokenManager.js.map +1 -1
- package/cjs/oidc/TransactionManager.js +19 -26
- package/cjs/oidc/TransactionManager.js.map +1 -1
- package/cjs/oidc/decodeToken.js +1 -5
- package/cjs/oidc/decodeToken.js.map +1 -1
- package/cjs/oidc/endpoints/authorize.js +9 -13
- package/cjs/oidc/endpoints/authorize.js.map +1 -1
- package/cjs/oidc/endpoints/index.js +0 -5
- package/cjs/oidc/endpoints/index.js.map +1 -1
- package/cjs/oidc/endpoints/token.js +5 -17
- package/cjs/oidc/endpoints/token.js.map +1 -1
- package/cjs/oidc/endpoints/well-known.js +7 -14
- package/cjs/oidc/endpoints/well-known.js.map +1 -1
- package/cjs/oidc/exchangeCodeForTokens.js +7 -12
- package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
- package/cjs/oidc/factory/OktaAuthOAuth.js +0 -6
- package/cjs/oidc/factory/OktaAuthOAuth.js.map +1 -1
- package/cjs/oidc/factory/api.js +6 -20
- package/cjs/oidc/factory/api.js.map +1 -1
- package/cjs/oidc/factory/index.js +0 -3
- package/cjs/oidc/factory/index.js.map +1 -1
- package/cjs/oidc/getToken.js +18 -30
- package/cjs/oidc/getToken.js.map +1 -1
- package/cjs/oidc/getUserInfo.js +1 -15
- package/cjs/oidc/getUserInfo.js.map +1 -1
- package/cjs/oidc/getWithPopup.js +4 -8
- package/cjs/oidc/getWithPopup.js.map +1 -1
- package/cjs/oidc/getWithRedirect.js +1 -8
- package/cjs/oidc/getWithRedirect.js.map +1 -1
- package/cjs/oidc/getWithoutPrompt.js +1 -5
- package/cjs/oidc/getWithoutPrompt.js.map +1 -1
- package/cjs/oidc/handleOAuthResponse.js +23 -40
- package/cjs/oidc/handleOAuthResponse.js.map +1 -1
- package/cjs/oidc/index.js +0 -32
- package/cjs/oidc/index.js.map +1 -1
- package/cjs/oidc/mixin/browser.js +6 -18
- package/cjs/oidc/mixin/browser.js.map +1 -1
- package/cjs/oidc/mixin/index.js +37 -89
- package/cjs/oidc/mixin/index.js.map +1 -1
- package/cjs/oidc/mixin/node.js +2 -9
- package/cjs/oidc/mixin/node.js.map +1 -1
- package/cjs/oidc/options/OAuthOptionsConstructor.js +17 -24
- package/cjs/oidc/options/OAuthOptionsConstructor.js.map +1 -1
- package/cjs/oidc/options/browser.js.map +1 -1
- package/cjs/oidc/options/index.js +0 -1
- package/cjs/oidc/options/index.js.map +1 -1
- package/cjs/oidc/options/node.js.map +1 -1
- package/cjs/oidc/parseFromUrl.js +1 -32
- package/cjs/oidc/parseFromUrl.js.map +1 -1
- package/cjs/oidc/renewToken.js +5 -16
- package/cjs/oidc/renewToken.js.map +1 -1
- package/cjs/oidc/renewTokens.js +3 -15
- package/cjs/oidc/renewTokens.js.map +1 -1
- package/cjs/oidc/renewTokensWithRefresh.js +3 -13
- package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
- package/cjs/oidc/revokeToken.js +3 -14
- package/cjs/oidc/revokeToken.js.map +1 -1
- package/cjs/oidc/storage.js +0 -8
- package/cjs/oidc/storage.js.map +1 -1
- package/cjs/oidc/types/Token.js +1 -5
- package/cjs/oidc/types/Token.js.map +1 -1
- package/cjs/oidc/types/TokenManager.js +1 -1
- package/cjs/oidc/types/TokenManager.js.map +1 -1
- package/cjs/oidc/types/Transaction.js +1 -12
- package/cjs/oidc/types/Transaction.js.map +1 -1
- package/cjs/oidc/types/UserClaims.js.map +1 -1
- package/cjs/oidc/types/api.js.map +1 -1
- package/cjs/oidc/types/index.js +0 -21
- package/cjs/oidc/types/index.js.map +1 -1
- package/cjs/oidc/types/meta.js.map +1 -1
- package/cjs/oidc/types/options.js.map +1 -1
- package/cjs/oidc/types/proto.js.map +1 -1
- package/cjs/oidc/util/browser.js +4 -13
- package/cjs/oidc/util/browser.js.map +1 -1
- package/cjs/oidc/util/defaultTokenParams.js +5 -5
- package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
- package/cjs/oidc/util/errors.js +3 -8
- package/cjs/oidc/util/errors.js.map +1 -1
- package/cjs/oidc/util/index.js +0 -24
- package/cjs/oidc/util/index.js.map +1 -1
- package/cjs/oidc/util/loginRedirect.js +11 -25
- package/cjs/oidc/util/loginRedirect.js.map +1 -1
- package/cjs/oidc/util/oauth.js +3 -12
- package/cjs/oidc/util/oauth.js.map +1 -1
- package/cjs/oidc/util/oauthMeta.js +5 -6
- package/cjs/oidc/util/oauthMeta.js.map +1 -1
- package/cjs/oidc/util/pkce.js +1 -12
- package/cjs/oidc/util/pkce.js.map +1 -1
- package/cjs/oidc/util/prepareTokenParams.js +13 -26
- package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
- package/cjs/oidc/util/refreshToken.js +0 -7
- package/cjs/oidc/util/refreshToken.js.map +1 -1
- package/cjs/oidc/util/sharedStorage.js +0 -8
- package/cjs/oidc/util/sharedStorage.js.map +1 -1
- package/cjs/oidc/util/urlParams.js +9 -12
- package/cjs/oidc/util/urlParams.js.map +1 -1
- package/cjs/oidc/util/validateClaims.js +9 -17
- package/cjs/oidc/util/validateClaims.js.map +1 -1
- package/cjs/oidc/util/validateToken.js +1 -6
- package/cjs/oidc/util/validateToken.js.map +1 -1
- package/cjs/oidc/verifyToken.js +13 -23
- package/cjs/oidc/verifyToken.js.map +1 -1
- package/cjs/server/serverStorage.js +9 -27
- package/cjs/server/serverStorage.js.map +1 -1
- package/cjs/services/AutoRenewService.js +1 -17
- package/cjs/services/AutoRenewService.js.map +1 -1
- package/cjs/services/LeaderElectionService.js +1 -23
- package/cjs/services/LeaderElectionService.js.map +1 -1
- package/cjs/services/SyncStorageService.js +3 -37
- package/cjs/services/SyncStorageService.js.map +1 -1
- package/cjs/services/index.js +0 -5
- package/cjs/services/index.js.map +1 -1
- package/cjs/session/api.js +1 -12
- package/cjs/session/api.js.map +1 -1
- package/cjs/session/factory.js +0 -2
- package/cjs/session/factory.js.map +1 -1
- package/cjs/session/index.js +0 -7
- package/cjs/session/index.js.map +1 -1
- package/cjs/session/mixin.js +2 -6
- package/cjs/session/mixin.js.map +1 -1
- package/cjs/storage/BaseStorageManager.js +13 -25
- package/cjs/storage/BaseStorageManager.js.map +1 -1
- package/cjs/storage/SavedObject.js +7 -19
- package/cjs/storage/SavedObject.js.map +1 -1
- package/cjs/storage/index.js +0 -9
- package/cjs/storage/index.js.map +1 -1
- package/cjs/storage/mixin.js +2 -4
- package/cjs/storage/mixin.js.map +1 -1
- package/cjs/storage/options/StorageOptionsConstructor.js +3 -6
- package/cjs/storage/options/StorageOptionsConstructor.js.map +1 -1
- package/cjs/storage/options/browser.js +7 -15
- package/cjs/storage/options/browser.js.map +1 -1
- package/cjs/storage/options/node.js +3 -6
- package/cjs/storage/options/node.js.map +1 -1
- package/cjs/util/PromiseQueue.js +7 -15
- package/cjs/util/PromiseQueue.js.map +1 -1
- package/cjs/util/console.js +3 -7
- package/cjs/util/console.js.map +1 -1
- package/cjs/util/index.js +0 -11
- package/cjs/util/index.js.map +1 -1
- package/cjs/util/misc.js +3 -8
- package/cjs/util/misc.js.map +1 -1
- package/cjs/util/object.js +9 -23
- package/cjs/util/object.js.map +1 -1
- package/cjs/util/types.js +1 -5
- package/cjs/util/types.js.map +1 -1
- package/cjs/util/url.js +5 -14
- package/cjs/util/url.js.map +1 -1
- package/dist/okta-auth-js.authn.min.analyzer.html +3 -3
- package/dist/okta-auth-js.authn.min.js +1 -1
- package/dist/okta-auth-js.authn.min.js.LICENSE.txt +2 -0
- package/dist/okta-auth-js.authn.min.js.map +1 -1
- package/dist/okta-auth-js.core.min.analyzer.html +3 -3
- package/dist/okta-auth-js.core.min.js +1 -1
- package/dist/okta-auth-js.core.min.js.LICENSE.txt +2 -0
- package/dist/okta-auth-js.core.min.js.map +1 -1
- package/dist/okta-auth-js.idx.min.analyzer.html +3 -3
- package/dist/okta-auth-js.idx.min.js +1 -1
- package/dist/okta-auth-js.idx.min.js.LICENSE.txt +2 -0
- package/dist/okta-auth-js.idx.min.js.map +1 -1
- package/dist/okta-auth-js.min.analyzer.html +3 -3
- package/dist/okta-auth-js.min.js +1 -1
- package/dist/okta-auth-js.min.js.LICENSE.txt +2 -0
- package/dist/okta-auth-js.min.js.map +1 -1
- package/dist/okta-auth-js.myaccount.min.analyzer.html +3 -3
- package/dist/okta-auth-js.myaccount.min.js +1 -1
- package/dist/okta-auth-js.myaccount.min.js.LICENSE.txt +2 -0
- package/dist/okta-auth-js.myaccount.min.js.map +1 -1
- package/dist/okta-auth-js.polyfill.js +1 -1
- package/dist/okta-auth-js.polyfill.js.map +1 -1
- package/esm/browser/http/OktaUserAgent.js +2 -2
- package/esm/browser/http/request.js +56 -23
- package/esm/browser/http/request.js.map +1 -1
- package/esm/browser/idx/interact.js +2 -2
- package/esm/browser/idx/interact.js.map +1 -1
- package/esm/browser/idx/run.js +2 -1
- package/esm/browser/idx/run.js.map +1 -1
- package/esm/browser/idx/transactionMeta.js +3 -2
- package/esm/browser/idx/transactionMeta.js.map +1 -1
- package/esm/browser/idx/types/idx-js.js.map +1 -1
- package/esm/browser/myaccount/request.js +2 -43
- package/esm/browser/myaccount/request.js.map +1 -1
- package/esm/browser/oidc/endpoints/authorize.js +1 -0
- package/esm/browser/oidc/endpoints/authorize.js.map +1 -1
- package/esm/browser/oidc/exchangeCodeForTokens.js +2 -1
- package/esm/browser/oidc/exchangeCodeForTokens.js.map +1 -1
- package/esm/browser/oidc/handleOAuthResponse.js +17 -16
- package/esm/browser/oidc/handleOAuthResponse.js.map +1 -1
- package/esm/browser/oidc/options/OAuthOptionsConstructor.js +2 -0
- package/esm/browser/oidc/options/OAuthOptionsConstructor.js.map +1 -1
- package/esm/browser/oidc/util/defaultTokenParams.js +3 -1
- package/esm/browser/oidc/util/defaultTokenParams.js.map +1 -1
- package/esm/browser/oidc/util/oauthMeta.js +1 -0
- package/esm/browser/oidc/util/oauthMeta.js.map +1 -1
- package/esm/browser/oidc/util/validateClaims.js +9 -4
- package/esm/browser/oidc/util/validateClaims.js.map +1 -1
- package/esm/browser/oidc/verifyToken.js +2 -2
- package/esm/browser/oidc/verifyToken.js.map +1 -1
- package/esm/browser/package.json +1 -1
- package/esm/node/http/OktaUserAgent.js +2 -2
- package/esm/node/http/request.js +56 -23
- package/esm/node/http/request.js.map +1 -1
- package/esm/node/idx/interact.js +2 -2
- package/esm/node/idx/interact.js.map +1 -1
- package/esm/node/idx/run.js +2 -1
- package/esm/node/idx/run.js.map +1 -1
- package/esm/node/idx/transactionMeta.js +3 -2
- package/esm/node/idx/transactionMeta.js.map +1 -1
- package/esm/node/idx/types/idx-js.js.map +1 -1
- package/esm/node/myaccount/request.js +2 -43
- package/esm/node/myaccount/request.js.map +1 -1
- package/esm/node/oidc/endpoints/authorize.js +1 -0
- package/esm/node/oidc/endpoints/authorize.js.map +1 -1
- package/esm/node/oidc/exchangeCodeForTokens.js +2 -1
- package/esm/node/oidc/exchangeCodeForTokens.js.map +1 -1
- package/esm/node/oidc/handleOAuthResponse.js +17 -16
- package/esm/node/oidc/handleOAuthResponse.js.map +1 -1
- package/esm/node/oidc/options/OAuthOptionsConstructor.js +2 -0
- package/esm/node/oidc/options/OAuthOptionsConstructor.js.map +1 -1
- package/esm/node/oidc/util/defaultTokenParams.js +3 -1
- package/esm/node/oidc/util/defaultTokenParams.js.map +1 -1
- package/esm/node/oidc/util/oauthMeta.js +1 -0
- package/esm/node/oidc/util/oauthMeta.js.map +1 -1
- package/esm/node/oidc/util/validateClaims.js +9 -4
- package/esm/node/oidc/util/validateClaims.js.map +1 -1
- package/esm/node/oidc/verifyToken.js +2 -2
- package/esm/node/oidc/verifyToken.js.map +1 -1
- package/esm/node/package.json +1 -1
- package/package.json +12 -13
- package/polyfill/index.js +8 -5
- package/types/lib/core/options.d.ts +2 -0
- package/types/lib/idx/interact.d.ts +1 -0
- package/types/lib/idx/options.d.ts +2 -0
- package/types/lib/idx/types/idx-js.d.ts +4 -0
- package/types/lib/idx/types/meta.d.ts +1 -0
- package/types/lib/idx/types/options.d.ts +1 -0
- package/types/lib/oidc/options/OAuthOptionsConstructor.d.ts +2 -0
- package/types/lib/oidc/types/UserClaims.d.ts +1 -0
- package/types/lib/oidc/types/api.d.ts +1 -0
- package/types/lib/oidc/types/meta.d.ts +1 -1
- package/types/lib/oidc/types/options.d.ts +2 -1
- package/types/lib/oidc/types/proto.d.ts +1 -0
- package/umd/authn.js +1 -1
- package/umd/authn.js.LICENSE.txt +2 -0
- package/umd/authn.js.map +1 -1
- package/umd/core.js +1 -1
- package/umd/core.js.LICENSE.txt +2 -0
- package/umd/core.js.map +1 -1
- package/umd/default.js +1 -1
- package/umd/default.js.LICENSE.txt +2 -0
- package/umd/default.js.map +1 -1
- package/umd/idx.js +1 -1
- package/umd/idx.js.LICENSE.txt +2 -0
- package/umd/idx.js.map +1 -1
- package/umd/myaccount.js +1 -1
- package/umd/myaccount.js.LICENSE.txt +2 -0
- package/umd/myaccount.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthOptionsConstructor.js","names":["assertValidConfig","args","scopes","Array","isArray","AuthSdkError","issuer","isUrlRegex","RegExp","test","indexOf","createOAuthOptionsConstructor","HttpOptionsConstructor","createHttpOptionsConstructor","OAuthOptionsConstructor","constructor","options","removeTrailingSlash","tokenUrl","authorizeUrl","userinfoUrl","revokeUrl","logoutUrl","pkce","clientId","redirectUri","isBrowser","toAbsoluteUrl","window","location","origin","responseType","responseMode","state","ignoreSignature","codeChallenge","codeChallengeMethod","tokenManager","postLogoutRedirectUri","restoreOriginalUri","transactionManager","enableSharedStorage","clientSecret","setLocation","ignoreLifetime","maxClockSkew","DEFAULT_MAX_CLOCK_SKEW"],"sources":["../../../../lib/oidc/options/OAuthOptionsConstructor.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { DEFAULT_MAX_CLOCK_SKEW } from '../../constants';\nimport { removeTrailingSlash, toAbsoluteUrl } from '../../util/url';\nimport { isBrowser } from '../../features';\nimport { createHttpOptionsConstructor } from '../../http/options';\nimport {\n OAuthResponseMode,\n OAuthResponseType,\n OktaAuthOAuthInterface,\n OktaAuthOAuthOptions,\n SetLocationFunction,\n TokenManagerOptions,\n TransactionManagerOptions\n} from '../types';\nimport { enableSharedStorage } from './node';\nimport AuthSdkError from '../../errors/AuthSdkError';\n\nfunction assertValidConfig(args) {\n args = args || {};\n\n var scopes = args.scopes;\n if (scopes && !Array.isArray(scopes)) {\n throw new AuthSdkError('scopes must be a array of strings. ' +\n 'Required usage: new OktaAuth({scopes: [\"openid\", \"email\"]})');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n var issuer = args.issuer!;\n if (!issuer) {\n throw new AuthSdkError('No issuer passed to constructor. ' + \n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com/oauth2/{authServerId}\"})');\n }\n\n var isUrlRegex = new RegExp('^http?s?://.+');\n if (!isUrlRegex.test(issuer)) {\n throw new AuthSdkError('Issuer must be a valid URL. ' + \n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com/oauth2/{authServerId}\"})');\n }\n\n if (issuer.indexOf('-admin.') !== -1) {\n throw new AuthSdkError('Issuer URL passed to constructor contains \"-admin\" in subdomain. ' +\n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com})');\n }\n}\n\nexport function createOAuthOptionsConstructor() {\n const HttpOptionsConstructor = createHttpOptionsConstructor();\n return class OAuthOptionsConstructor\n extends HttpOptionsConstructor\n implements Required<OktaAuthOAuthOptions>\n {\n // CustomUrls\n issuer: string;\n authorizeUrl: string;\n userinfoUrl: string;\n tokenUrl: string;\n revokeUrl: string;\n logoutUrl: string;\n \n // TokenParams\n pkce: boolean;\n clientId: string;\n redirectUri: string;\n responseType: OAuthResponseType | OAuthResponseType[];\n responseMode: OAuthResponseMode;\n state: string;\n scopes: string[];\n ignoreSignature: boolean;\n codeChallenge: string;\n codeChallengeMethod: string;\n\n // Additional options\n tokenManager: TokenManagerOptions;\n postLogoutRedirectUri: string;\n restoreOriginalUri: (oktaAuth: OktaAuthOAuthInterface, originalUri?: string) => Promise<void>;\n transactionManager: TransactionManagerOptions;\n\n // For server-side web applications ONLY!\n clientSecret: string;\n setLocation: SetLocationFunction;\n\n // Workaround for bad client time/clock\n ignoreLifetime: boolean;\n maxClockSkew: number;\n\n\n // eslint-disable-next-line max-statements\n constructor(options: any) {\n super(options);\n \n assertValidConfig(options);\n \n this.issuer = removeTrailingSlash(options.issuer);\n this.tokenUrl = removeTrailingSlash(options.tokenUrl);\n this.authorizeUrl = removeTrailingSlash(options.authorizeUrl);\n this.userinfoUrl = removeTrailingSlash(options.userinfoUrl);\n this.revokeUrl = removeTrailingSlash(options.revokeUrl);\n this.logoutUrl = removeTrailingSlash(options.logoutUrl);\n\n this.pkce = options.pkce === false ? false : true; // PKCE defaults to true\n this.clientId = options.clientId;\n this.redirectUri = options.redirectUri;\n if (isBrowser()) {\n this.redirectUri = toAbsoluteUrl(options.redirectUri, window.location.origin); // allow relative URIs\n }\n this.responseType = options.responseType;\n this.responseMode = options.responseMode;\n this.state = options.state;\n this.scopes = options.scopes;\n // Give the developer the ability to disable token signature validation.\n this.ignoreSignature = !!options.ignoreSignature;\n this.codeChallenge = options.codeChallenge;\n this.codeChallengeMethod = options.codeChallengeMethod;\n\n this.tokenManager = options.tokenManager;\n this.postLogoutRedirectUri = options.postLogoutRedirectUri;\n this.restoreOriginalUri = options.restoreOriginalUri;\n this.transactionManager = { enableSharedStorage, ...options.transactionManager };\n \n this.clientSecret = options.clientSecret;\n this.setLocation = options.setLocation;\n \n // As some end user's devices can have their date \n // and time incorrectly set, allow for the disabling\n // of the jwt liftetime validation\n this.ignoreLifetime = !!options.ignoreLifetime;\n\n // Digital clocks will drift over time, so the server\n // can misalign with the time reported by the browser.\n // The maxClockSkew allows relaxing the time-based\n // validation of tokens (in seconds, not milliseconds).\n // It currently defaults to 300, because 5 min is the\n // default maximum tolerance allowed by Kerberos.\n // (https://technet.microsoft.com/en-us/library/cc976357.aspx)\n if (!options.maxClockSkew && options.maxClockSkew !== 0) {\n this.maxClockSkew = DEFAULT_MAX_CLOCK_SKEW;\n } else {\n this.maxClockSkew = options.maxClockSkew;\n }\n\n }\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OAuthOptionsConstructor.js","names":["assertValidConfig","args","scopes","Array","isArray","AuthSdkError","issuer","isUrlRegex","RegExp","test","indexOf","createOAuthOptionsConstructor","HttpOptionsConstructor","createHttpOptionsConstructor","OAuthOptionsConstructor","constructor","options","removeTrailingSlash","tokenUrl","authorizeUrl","userinfoUrl","revokeUrl","logoutUrl","pkce","clientId","redirectUri","isBrowser","toAbsoluteUrl","window","location","origin","responseType","responseMode","state","ignoreSignature","codeChallenge","codeChallengeMethod","acrValues","maxAge","tokenManager","postLogoutRedirectUri","restoreOriginalUri","transactionManager","enableSharedStorage","clientSecret","setLocation","ignoreLifetime","maxClockSkew","DEFAULT_MAX_CLOCK_SKEW"],"sources":["../../../../lib/oidc/options/OAuthOptionsConstructor.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { DEFAULT_MAX_CLOCK_SKEW } from '../../constants';\nimport { removeTrailingSlash, toAbsoluteUrl } from '../../util/url';\nimport { isBrowser } from '../../features';\nimport { createHttpOptionsConstructor } from '../../http/options';\nimport {\n OAuthResponseMode,\n OAuthResponseType,\n OktaAuthOAuthInterface,\n OktaAuthOAuthOptions,\n SetLocationFunction,\n TokenManagerOptions,\n TransactionManagerOptions\n} from '../types';\nimport { enableSharedStorage } from './node';\nimport AuthSdkError from '../../errors/AuthSdkError';\n\nfunction assertValidConfig(args) {\n args = args || {};\n\n var scopes = args.scopes;\n if (scopes && !Array.isArray(scopes)) {\n throw new AuthSdkError('scopes must be a array of strings. ' +\n 'Required usage: new OktaAuth({scopes: [\"openid\", \"email\"]})');\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n var issuer = args.issuer!;\n if (!issuer) {\n throw new AuthSdkError('No issuer passed to constructor. ' + \n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com/oauth2/{authServerId}\"})');\n }\n\n var isUrlRegex = new RegExp('^http?s?://.+');\n if (!isUrlRegex.test(issuer)) {\n throw new AuthSdkError('Issuer must be a valid URL. ' + \n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com/oauth2/{authServerId}\"})');\n }\n\n if (issuer.indexOf('-admin.') !== -1) {\n throw new AuthSdkError('Issuer URL passed to constructor contains \"-admin\" in subdomain. ' +\n 'Required usage: new OktaAuth({issuer: \"https://{yourOktaDomain}.com})');\n }\n}\n\nexport function createOAuthOptionsConstructor() {\n const HttpOptionsConstructor = createHttpOptionsConstructor();\n return class OAuthOptionsConstructor\n extends HttpOptionsConstructor\n implements Required<OktaAuthOAuthOptions>\n {\n // CustomUrls\n issuer: string;\n authorizeUrl: string;\n userinfoUrl: string;\n tokenUrl: string;\n revokeUrl: string;\n logoutUrl: string;\n \n // TokenParams\n pkce: boolean;\n clientId: string;\n redirectUri: string;\n responseType: OAuthResponseType | OAuthResponseType[];\n responseMode: OAuthResponseMode;\n state: string;\n scopes: string[];\n ignoreSignature: boolean;\n codeChallenge: string;\n codeChallengeMethod: string;\n acrValues: string;\n maxAge: string | number;\n\n // Additional options\n tokenManager: TokenManagerOptions;\n postLogoutRedirectUri: string;\n restoreOriginalUri: (oktaAuth: OktaAuthOAuthInterface, originalUri?: string) => Promise<void>;\n transactionManager: TransactionManagerOptions;\n\n // For server-side web applications ONLY!\n clientSecret: string;\n setLocation: SetLocationFunction;\n\n // Workaround for bad client time/clock\n ignoreLifetime: boolean;\n maxClockSkew: number;\n\n\n // eslint-disable-next-line max-statements\n constructor(options: any) {\n super(options);\n \n assertValidConfig(options);\n \n this.issuer = removeTrailingSlash(options.issuer);\n this.tokenUrl = removeTrailingSlash(options.tokenUrl);\n this.authorizeUrl = removeTrailingSlash(options.authorizeUrl);\n this.userinfoUrl = removeTrailingSlash(options.userinfoUrl);\n this.revokeUrl = removeTrailingSlash(options.revokeUrl);\n this.logoutUrl = removeTrailingSlash(options.logoutUrl);\n\n this.pkce = options.pkce === false ? false : true; // PKCE defaults to true\n this.clientId = options.clientId;\n this.redirectUri = options.redirectUri;\n if (isBrowser()) {\n this.redirectUri = toAbsoluteUrl(options.redirectUri, window.location.origin); // allow relative URIs\n }\n this.responseType = options.responseType;\n this.responseMode = options.responseMode;\n this.state = options.state;\n this.scopes = options.scopes;\n // Give the developer the ability to disable token signature validation.\n this.ignoreSignature = !!options.ignoreSignature;\n this.codeChallenge = options.codeChallenge;\n this.codeChallengeMethod = options.codeChallengeMethod;\n this.acrValues = options.acrValues;\n this.maxAge = options.maxAge;\n\n this.tokenManager = options.tokenManager;\n this.postLogoutRedirectUri = options.postLogoutRedirectUri;\n this.restoreOriginalUri = options.restoreOriginalUri;\n this.transactionManager = { enableSharedStorage, ...options.transactionManager };\n \n this.clientSecret = options.clientSecret;\n this.setLocation = options.setLocation;\n \n // As some end user's devices can have their date \n // and time incorrectly set, allow for the disabling\n // of the jwt liftetime validation\n this.ignoreLifetime = !!options.ignoreLifetime;\n\n // Digital clocks will drift over time, so the server\n // can misalign with the time reported by the browser.\n // The maxClockSkew allows relaxing the time-based\n // validation of tokens (in seconds, not milliseconds).\n // It currently defaults to 300, because 5 min is the\n // default maximum tolerance allowed by Kerberos.\n // (https://technet.microsoft.com/en-us/library/cc976357.aspx)\n if (!options.maxClockSkew && options.maxClockSkew !== 0) {\n this.maxClockSkew = DEFAULT_MAX_CLOCK_SKEW;\n } else {\n this.maxClockSkew = options.maxClockSkew;\n }\n\n }\n };\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","names":["enableSharedStorage"],"sources":["../../../../lib/oidc/options/browser.ts"],"sourcesContent":["export const enableSharedStorage = true;\n"],"mappings":";;;AAAO,MAAMA,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"browser.js","names":["enableSharedStorage"],"sources":["../../../../lib/oidc/options/browser.ts"],"sourcesContent":["export const enableSharedStorage = true;\n"],"mappings":";;;AAAO,MAAMA,mBAAmB,GAAG,IAAI;AAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _OAuthOptionsConstructor = require("./OAuthOptionsConstructor");
|
|
4
|
-
|
|
5
4
|
Object.keys(_OAuthOptionsConstructor).forEach(function (key) {
|
|
6
5
|
if (key === "default" || key === "__esModule") return;
|
|
7
6
|
if (key in exports && exports[key] === _OAuthOptionsConstructor[key]) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/oidc/options/index.ts"],"sourcesContent":["export * from './OAuthOptionsConstructor';\n"],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/oidc/options/index.ts"],"sourcesContent":["export * from './OAuthOptionsConstructor';\n"],"mappings":";;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","names":["enableSharedStorage"],"sources":["../../../../lib/oidc/options/node.ts"],"sourcesContent":["\nexport const enableSharedStorage = false;\n"],"mappings":";;;AACO,MAAMA,mBAAmB,GAAG,
|
|
1
|
+
{"version":3,"file":"node.js","names":["enableSharedStorage"],"sources":["../../../../lib/oidc/options/node.ts"],"sourcesContent":["\nexport const enableSharedStorage = false;\n"],"mappings":";;;AACO,MAAMA,mBAAmB,GAAG,KAAK;AAAC"}
|
package/cjs/oidc/parseFromUrl.js
CHANGED
|
@@ -4,17 +4,11 @@ exports.cleanOAuthResponseFromUrl = cleanOAuthResponseFromUrl;
|
|
|
4
4
|
exports.getResponseMode = getResponseMode;
|
|
5
5
|
exports.parseFromUrl = parseFromUrl;
|
|
6
6
|
exports.parseOAuthResponseFromUrl = parseOAuthResponseFromUrl;
|
|
7
|
-
|
|
8
7
|
var _errors = require("../errors");
|
|
9
|
-
|
|
10
8
|
var _util = require("./util");
|
|
11
|
-
|
|
12
9
|
var _util2 = require("../util");
|
|
13
|
-
|
|
14
10
|
var _handleOAuthResponse = require("./handleOAuthResponse");
|
|
15
|
-
|
|
16
11
|
/* eslint-disable complexity */
|
|
17
|
-
|
|
18
12
|
/*!
|
|
19
13
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
20
14
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -27,44 +21,35 @@ var _handleOAuthResponse = require("./handleOAuthResponse");
|
|
|
27
21
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
28
22
|
*
|
|
29
23
|
*/
|
|
24
|
+
|
|
30
25
|
function removeHash(sdk) {
|
|
31
26
|
var nativeHistory = sdk.token.parseFromUrl._getHistory();
|
|
32
|
-
|
|
33
27
|
var nativeDoc = sdk.token.parseFromUrl._getDocument();
|
|
34
|
-
|
|
35
28
|
var nativeLoc = sdk.token.parseFromUrl._getLocation();
|
|
36
|
-
|
|
37
29
|
if (nativeHistory && nativeHistory.replaceState) {
|
|
38
30
|
nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.search);
|
|
39
31
|
} else {
|
|
40
32
|
nativeLoc.hash = '';
|
|
41
33
|
}
|
|
42
34
|
}
|
|
43
|
-
|
|
44
35
|
function removeSearch(sdk) {
|
|
45
36
|
var nativeHistory = sdk.token.parseFromUrl._getHistory();
|
|
46
|
-
|
|
47
37
|
var nativeDoc = sdk.token.parseFromUrl._getDocument();
|
|
48
|
-
|
|
49
38
|
var nativeLoc = sdk.token.parseFromUrl._getLocation();
|
|
50
|
-
|
|
51
39
|
if (nativeHistory && nativeHistory.replaceState) {
|
|
52
40
|
nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.hash);
|
|
53
41
|
} else {
|
|
54
42
|
nativeLoc.search = '';
|
|
55
43
|
}
|
|
56
44
|
}
|
|
57
|
-
|
|
58
45
|
function getResponseMode(sdk) {
|
|
59
46
|
// https://openid.net/specs/openid-connect-core-1_0.html#Authentication
|
|
60
47
|
var defaultResponseMode = sdk.options.pkce ? 'query' : 'fragment';
|
|
61
48
|
var responseMode = sdk.options.responseMode || defaultResponseMode;
|
|
62
49
|
return responseMode;
|
|
63
50
|
}
|
|
64
|
-
|
|
65
51
|
function parseOAuthResponseFromUrl(sdk, options) {
|
|
66
52
|
options = options || {};
|
|
67
|
-
|
|
68
53
|
if ((0, _util2.isString)(options)) {
|
|
69
54
|
options = {
|
|
70
55
|
url: options
|
|
@@ -72,36 +57,27 @@ function parseOAuthResponseFromUrl(sdk, options) {
|
|
|
72
57
|
} else {
|
|
73
58
|
options = options;
|
|
74
59
|
}
|
|
75
|
-
|
|
76
60
|
var url = options.url;
|
|
77
61
|
var responseMode = options.responseMode || getResponseMode(sdk);
|
|
78
|
-
|
|
79
62
|
var nativeLoc = sdk.token.parseFromUrl._getLocation();
|
|
80
|
-
|
|
81
63
|
var paramStr;
|
|
82
|
-
|
|
83
64
|
if (responseMode === 'query') {
|
|
84
65
|
paramStr = url ? url.substring(url.indexOf('?')) : nativeLoc.search;
|
|
85
66
|
} else {
|
|
86
67
|
paramStr = url ? url.substring(url.indexOf('#')) : nativeLoc.hash;
|
|
87
68
|
}
|
|
88
|
-
|
|
89
69
|
if (!paramStr) {
|
|
90
70
|
throw new _errors.AuthSdkError('Unable to parse a token from the url');
|
|
91
71
|
}
|
|
92
|
-
|
|
93
72
|
return (0, _util.urlParamsToObject)(paramStr);
|
|
94
73
|
}
|
|
95
|
-
|
|
96
74
|
function cleanOAuthResponseFromUrl(sdk, options) {
|
|
97
75
|
// Clean hash or search from the url
|
|
98
76
|
const responseMode = options.responseMode || getResponseMode(sdk);
|
|
99
77
|
responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);
|
|
100
78
|
}
|
|
101
|
-
|
|
102
79
|
async function parseFromUrl(sdk, options) {
|
|
103
80
|
options = options || {};
|
|
104
|
-
|
|
105
81
|
if ((0, _util2.isString)(options)) {
|
|
106
82
|
options = {
|
|
107
83
|
url: options
|
|
@@ -109,37 +85,30 @@ async function parseFromUrl(sdk, options) {
|
|
|
109
85
|
} else {
|
|
110
86
|
options = options;
|
|
111
87
|
}
|
|
112
|
-
|
|
113
88
|
const res = parseOAuthResponseFromUrl(sdk, options);
|
|
114
89
|
const state = res.state;
|
|
115
90
|
const oauthParams = sdk.transactionManager.load({
|
|
116
91
|
state
|
|
117
92
|
});
|
|
118
|
-
|
|
119
93
|
if (!oauthParams) {
|
|
120
94
|
if (sdk.options.pkce) {
|
|
121
95
|
// eslint-disable-next-line max-len
|
|
122
96
|
throw new _errors.AuthSdkError('Could not load PKCE codeVerifier from storage. This may indicate the auth flow has already completed or multiple auth flows are executing concurrently.', undefined);
|
|
123
97
|
}
|
|
124
|
-
|
|
125
98
|
throw new _errors.AuthSdkError('Unable to retrieve OAuth redirect params from storage');
|
|
126
99
|
}
|
|
127
|
-
|
|
128
100
|
const urls = oauthParams.urls;
|
|
129
101
|
delete oauthParams.urls;
|
|
130
|
-
|
|
131
102
|
if (!options.url) {
|
|
132
103
|
// Clean hash or search from the url
|
|
133
104
|
cleanOAuthResponseFromUrl(sdk, options);
|
|
134
105
|
}
|
|
135
|
-
|
|
136
106
|
return (0, _handleOAuthResponse.handleOAuthResponse)(sdk, oauthParams, res, urls).catch(err => {
|
|
137
107
|
if (!(0, _util.isInteractionRequiredError)(err)) {
|
|
138
108
|
sdk.transactionManager.clear({
|
|
139
109
|
state
|
|
140
110
|
});
|
|
141
111
|
}
|
|
142
|
-
|
|
143
112
|
throw err;
|
|
144
113
|
}).then(res => {
|
|
145
114
|
sdk.transactionManager.clear({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseFromUrl.js","names":["removeHash","sdk","nativeHistory","token","parseFromUrl","_getHistory","nativeDoc","_getDocument","nativeLoc","_getLocation","replaceState","title","pathname","search","hash","removeSearch","getResponseMode","defaultResponseMode","options","pkce","responseMode","parseOAuthResponseFromUrl","isString","url","paramStr","substring","indexOf","AuthSdkError","urlParamsToObject","cleanOAuthResponseFromUrl","res","state","oauthParams","transactionManager","load","undefined","urls","handleOAuthResponse","catch","err","isInteractionRequiredError","clear","then"],"sources":["../../../lib/oidc/parseFromUrl.ts"],"sourcesContent":["/* eslint-disable complexity */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { isInteractionRequiredError, urlParamsToObject } from './util';\nimport {\n ParseFromUrlOptions,\n TokenResponse,\n CustomUrls,\n TransactionMeta,\n OAuthResponse\n} from './types';\nimport { isString } from '../util';\nimport { handleOAuthResponse } from './handleOAuthResponse';\n\nfunction removeHash(sdk) {\n var nativeHistory = sdk.token.parseFromUrl._getHistory();\n var nativeDoc = sdk.token.parseFromUrl._getDocument();\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n if (nativeHistory && nativeHistory.replaceState) {\n nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.search);\n } else {\n nativeLoc.hash = '';\n }\n}\n\nfunction removeSearch(sdk) {\n var nativeHistory = sdk.token.parseFromUrl._getHistory();\n var nativeDoc = sdk.token.parseFromUrl._getDocument();\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n if (nativeHistory && nativeHistory.replaceState) {\n nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.hash);\n } else {\n nativeLoc.search = '';\n }\n}\n\nexport function getResponseMode(sdk): 'query' | 'fragment' {\n // https://openid.net/specs/openid-connect-core-1_0.html#Authentication\n var defaultResponseMode = sdk.options.pkce ? 'query' : 'fragment';\n var responseMode = sdk.options.responseMode || defaultResponseMode;\n return responseMode;\n}\n\nexport function parseOAuthResponseFromUrl(sdk, options: string | ParseFromUrlOptions): OAuthResponse {\n options = options || {};\n if (isString(options)) {\n options = { url: options } as ParseFromUrlOptions;\n } else {\n options = options as ParseFromUrlOptions;\n }\n\n var url = options.url;\n var responseMode = options.responseMode || getResponseMode(sdk);\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n var paramStr;\n\n if (responseMode === 'query') {\n paramStr = url ? url.substring(url.indexOf('?')) : nativeLoc.search;\n } else {\n paramStr = url ? url.substring(url.indexOf('#')) : nativeLoc.hash;\n }\n\n if (!paramStr) {\n throw new AuthSdkError('Unable to parse a token from the url');\n }\n\n return urlParamsToObject(paramStr);\n}\n\nexport function cleanOAuthResponseFromUrl(sdk, options: ParseFromUrlOptions) {\n // Clean hash or search from the url\n const responseMode = options.responseMode || getResponseMode(sdk);\n responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);\n}\n\nexport async function parseFromUrl(sdk, options?: string | ParseFromUrlOptions): Promise<TokenResponse> {\n options = options || {};\n if (isString(options)) {\n options = { url: options } as ParseFromUrlOptions;\n } else {\n options = options as ParseFromUrlOptions;\n }\n\n const res: OAuthResponse = parseOAuthResponseFromUrl(sdk, options);\n const state = res.state;\n const oauthParams: TransactionMeta = sdk.transactionManager.load({\n state\n });\n if (!oauthParams) {\n if (sdk.options.pkce) {\n // eslint-disable-next-line max-len\n throw new AuthSdkError('Could not load PKCE codeVerifier from storage. This may indicate the auth flow has already completed or multiple auth flows are executing concurrently.', undefined);\n }\n throw new AuthSdkError('Unable to retrieve OAuth redirect params from storage');\n }\n const urls: CustomUrls = oauthParams.urls as CustomUrls;\n delete oauthParams.urls;\n\n if (!options.url) {\n // Clean hash or search from the url\n cleanOAuthResponseFromUrl(sdk, options);\n }\n\n return handleOAuthResponse(sdk, oauthParams, res, urls)\n .catch(err => {\n if (!isInteractionRequiredError(err)) {\n sdk.transactionManager.clear({\n state\n });\n }\n throw err;\n })\n .then(res => {\n sdk.transactionManager.clear({\n state\n });\n return res;\n });\n\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"parseFromUrl.js","names":["removeHash","sdk","nativeHistory","token","parseFromUrl","_getHistory","nativeDoc","_getDocument","nativeLoc","_getLocation","replaceState","title","pathname","search","hash","removeSearch","getResponseMode","defaultResponseMode","options","pkce","responseMode","parseOAuthResponseFromUrl","isString","url","paramStr","substring","indexOf","AuthSdkError","urlParamsToObject","cleanOAuthResponseFromUrl","res","state","oauthParams","transactionManager","load","undefined","urls","handleOAuthResponse","catch","err","isInteractionRequiredError","clear","then"],"sources":["../../../lib/oidc/parseFromUrl.ts"],"sourcesContent":["/* eslint-disable complexity */\n/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { isInteractionRequiredError, urlParamsToObject } from './util';\nimport {\n ParseFromUrlOptions,\n TokenResponse,\n CustomUrls,\n TransactionMeta,\n OAuthResponse\n} from './types';\nimport { isString } from '../util';\nimport { handleOAuthResponse } from './handleOAuthResponse';\n\nfunction removeHash(sdk) {\n var nativeHistory = sdk.token.parseFromUrl._getHistory();\n var nativeDoc = sdk.token.parseFromUrl._getDocument();\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n if (nativeHistory && nativeHistory.replaceState) {\n nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.search);\n } else {\n nativeLoc.hash = '';\n }\n}\n\nfunction removeSearch(sdk) {\n var nativeHistory = sdk.token.parseFromUrl._getHistory();\n var nativeDoc = sdk.token.parseFromUrl._getDocument();\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n if (nativeHistory && nativeHistory.replaceState) {\n nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.hash);\n } else {\n nativeLoc.search = '';\n }\n}\n\nexport function getResponseMode(sdk): 'query' | 'fragment' {\n // https://openid.net/specs/openid-connect-core-1_0.html#Authentication\n var defaultResponseMode = sdk.options.pkce ? 'query' : 'fragment';\n var responseMode = sdk.options.responseMode || defaultResponseMode;\n return responseMode;\n}\n\nexport function parseOAuthResponseFromUrl(sdk, options: string | ParseFromUrlOptions): OAuthResponse {\n options = options || {};\n if (isString(options)) {\n options = { url: options } as ParseFromUrlOptions;\n } else {\n options = options as ParseFromUrlOptions;\n }\n\n var url = options.url;\n var responseMode = options.responseMode || getResponseMode(sdk);\n var nativeLoc = sdk.token.parseFromUrl._getLocation();\n var paramStr;\n\n if (responseMode === 'query') {\n paramStr = url ? url.substring(url.indexOf('?')) : nativeLoc.search;\n } else {\n paramStr = url ? url.substring(url.indexOf('#')) : nativeLoc.hash;\n }\n\n if (!paramStr) {\n throw new AuthSdkError('Unable to parse a token from the url');\n }\n\n return urlParamsToObject(paramStr);\n}\n\nexport function cleanOAuthResponseFromUrl(sdk, options: ParseFromUrlOptions) {\n // Clean hash or search from the url\n const responseMode = options.responseMode || getResponseMode(sdk);\n responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk);\n}\n\nexport async function parseFromUrl(sdk, options?: string | ParseFromUrlOptions): Promise<TokenResponse> {\n options = options || {};\n if (isString(options)) {\n options = { url: options } as ParseFromUrlOptions;\n } else {\n options = options as ParseFromUrlOptions;\n }\n\n const res: OAuthResponse = parseOAuthResponseFromUrl(sdk, options);\n const state = res.state;\n const oauthParams: TransactionMeta = sdk.transactionManager.load({\n state\n });\n if (!oauthParams) {\n if (sdk.options.pkce) {\n // eslint-disable-next-line max-len\n throw new AuthSdkError('Could not load PKCE codeVerifier from storage. This may indicate the auth flow has already completed or multiple auth flows are executing concurrently.', undefined);\n }\n throw new AuthSdkError('Unable to retrieve OAuth redirect params from storage');\n }\n const urls: CustomUrls = oauthParams.urls as CustomUrls;\n delete oauthParams.urls;\n\n if (!options.url) {\n // Clean hash or search from the url\n cleanOAuthResponseFromUrl(sdk, options);\n }\n\n return handleOAuthResponse(sdk, oauthParams, res, urls)\n .catch(err => {\n if (!isInteractionRequiredError(err)) {\n sdk.transactionManager.clear({\n state\n });\n }\n throw err;\n })\n .then(res => {\n sdk.transactionManager.clear({\n state\n });\n return res;\n });\n\n}\n"],"mappings":"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"}
|
package/cjs/oidc/renewToken.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.renewToken = renewToken;
|
|
4
|
-
|
|
5
4
|
var _errors = require("../errors");
|
|
6
|
-
|
|
7
5
|
var _types = require("./types");
|
|
8
|
-
|
|
9
6
|
var _getWithoutPrompt = require("./getWithoutPrompt");
|
|
10
|
-
|
|
11
7
|
var _renewTokensWithRefresh = require("./renewTokensWithRefresh");
|
|
12
|
-
|
|
13
8
|
/*!
|
|
14
9
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
15
10
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -22,40 +17,35 @@ var _renewTokensWithRefresh = require("./renewTokensWithRefresh");
|
|
|
22
17
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
23
18
|
*
|
|
24
19
|
*/
|
|
20
|
+
|
|
25
21
|
function throwInvalidTokenError() {
|
|
26
22
|
throw new _errors.AuthSdkError('Renew must be passed a token with an array of scopes and an accessToken or idToken');
|
|
27
|
-
}
|
|
28
|
-
|
|
23
|
+
}
|
|
29
24
|
|
|
25
|
+
// Multiple tokens may have come back. Return only the token which was requested.
|
|
30
26
|
function getSingleToken(originalToken, tokens) {
|
|
31
27
|
if ((0, _types.isIDToken)(originalToken)) {
|
|
32
28
|
return tokens.idToken;
|
|
33
29
|
}
|
|
34
|
-
|
|
35
30
|
if ((0, _types.isAccessToken)(originalToken)) {
|
|
36
31
|
return tokens.accessToken;
|
|
37
32
|
}
|
|
38
|
-
|
|
39
33
|
throwInvalidTokenError();
|
|
40
|
-
}
|
|
41
|
-
|
|
34
|
+
}
|
|
42
35
|
|
|
36
|
+
// If we have a refresh token, renew using that, otherwise getWithoutPrompt
|
|
43
37
|
async function renewToken(sdk, token) {
|
|
44
38
|
if (!(0, _types.isIDToken)(token) && !(0, _types.isAccessToken)(token)) {
|
|
45
39
|
throwInvalidTokenError();
|
|
46
40
|
}
|
|
47
|
-
|
|
48
41
|
let tokens = sdk.tokenManager.getTokensSync();
|
|
49
|
-
|
|
50
42
|
if (tokens.refreshToken) {
|
|
51
43
|
tokens = await (0, _renewTokensWithRefresh.renewTokensWithRefresh)(sdk, {
|
|
52
44
|
scopes: token.scopes
|
|
53
45
|
}, tokens.refreshToken);
|
|
54
46
|
return getSingleToken(token, tokens);
|
|
55
47
|
}
|
|
56
|
-
|
|
57
48
|
var responseType;
|
|
58
|
-
|
|
59
49
|
if (sdk.options.pkce) {
|
|
60
50
|
responseType = 'code';
|
|
61
51
|
} else if ((0, _types.isAccessToken)(token)) {
|
|
@@ -63,7 +53,6 @@ async function renewToken(sdk, token) {
|
|
|
63
53
|
} else {
|
|
64
54
|
responseType = 'id_token';
|
|
65
55
|
}
|
|
66
|
-
|
|
67
56
|
const {
|
|
68
57
|
scopes,
|
|
69
58
|
authorizeUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renewToken.js","names":["throwInvalidTokenError","AuthSdkError","getSingleToken","originalToken","tokens","isIDToken","idToken","isAccessToken","accessToken","renewToken","sdk","token","tokenManager","getTokensSync","refreshToken","renewTokensWithRefresh","scopes","responseType","options","pkce","authorizeUrl","userinfoUrl","issuer","getWithoutPrompt","then","res"],"sources":["../../../lib/oidc/renewToken.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { OktaAuthOAuthInterface, Token, Tokens, isAccessToken, AccessToken, IDToken, isIDToken } from './types';\nimport { getWithoutPrompt } from './getWithoutPrompt';\nimport { renewTokensWithRefresh } from './renewTokensWithRefresh';\n\nfunction throwInvalidTokenError() {\n throw new AuthSdkError(\n 'Renew must be passed a token with an array of scopes and an accessToken or idToken'\n );\n}\n\n// Multiple tokens may have come back. Return only the token which was requested.\nfunction getSingleToken(originalToken: Token, tokens: Tokens) {\n if (isIDToken(originalToken)) {\n return tokens.idToken;\n }\n if (isAccessToken(originalToken)) {\n return tokens.accessToken;\n }\n throwInvalidTokenError();\n}\n\n// If we have a refresh token, renew using that, otherwise getWithoutPrompt\nexport async function renewToken(sdk: OktaAuthOAuthInterface, token: Token): Promise<Token | undefined> {\n if (!isIDToken(token) && !isAccessToken(token)) {\n throwInvalidTokenError();\n }\n\n let tokens = sdk.tokenManager.getTokensSync();\n if (tokens.refreshToken) {\n tokens = await renewTokensWithRefresh(sdk, {\n scopes: token.scopes,\n }, tokens.refreshToken);\n return getSingleToken(token, tokens);\n }\n\n var responseType;\n if (sdk.options.pkce) {\n responseType = 'code';\n } else if (isAccessToken(token)) {\n responseType = 'token';\n } else {\n responseType = 'id_token';\n }\n\n const { scopes, authorizeUrl, userinfoUrl, issuer } = token as (AccessToken & IDToken);\n return getWithoutPrompt(sdk, {\n responseType,\n scopes,\n authorizeUrl,\n userinfoUrl,\n issuer\n })\n .then(function (res) {\n return getSingleToken(token, res.tokens);\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"renewToken.js","names":["throwInvalidTokenError","AuthSdkError","getSingleToken","originalToken","tokens","isIDToken","idToken","isAccessToken","accessToken","renewToken","sdk","token","tokenManager","getTokensSync","refreshToken","renewTokensWithRefresh","scopes","responseType","options","pkce","authorizeUrl","userinfoUrl","issuer","getWithoutPrompt","then","res"],"sources":["../../../lib/oidc/renewToken.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { OktaAuthOAuthInterface, Token, Tokens, isAccessToken, AccessToken, IDToken, isIDToken } from './types';\nimport { getWithoutPrompt } from './getWithoutPrompt';\nimport { renewTokensWithRefresh } from './renewTokensWithRefresh';\n\nfunction throwInvalidTokenError() {\n throw new AuthSdkError(\n 'Renew must be passed a token with an array of scopes and an accessToken or idToken'\n );\n}\n\n// Multiple tokens may have come back. Return only the token which was requested.\nfunction getSingleToken(originalToken: Token, tokens: Tokens) {\n if (isIDToken(originalToken)) {\n return tokens.idToken;\n }\n if (isAccessToken(originalToken)) {\n return tokens.accessToken;\n }\n throwInvalidTokenError();\n}\n\n// If we have a refresh token, renew using that, otherwise getWithoutPrompt\nexport async function renewToken(sdk: OktaAuthOAuthInterface, token: Token): Promise<Token | undefined> {\n if (!isIDToken(token) && !isAccessToken(token)) {\n throwInvalidTokenError();\n }\n\n let tokens = sdk.tokenManager.getTokensSync();\n if (tokens.refreshToken) {\n tokens = await renewTokensWithRefresh(sdk, {\n scopes: token.scopes,\n }, tokens.refreshToken);\n return getSingleToken(token, tokens);\n }\n\n var responseType;\n if (sdk.options.pkce) {\n responseType = 'code';\n } else if (isAccessToken(token)) {\n responseType = 'token';\n } else {\n responseType = 'id_token';\n }\n\n const { scopes, authorizeUrl, userinfoUrl, issuer } = token as (AccessToken & IDToken);\n return getWithoutPrompt(sdk, {\n responseType,\n scopes,\n authorizeUrl,\n userinfoUrl,\n issuer\n })\n .then(function (res) {\n return getSingleToken(token, res.tokens);\n });\n}\n"],"mappings":";;;AAYA;AACA;AACA;AACA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,sBAAsB,GAAG;EAChC,MAAM,IAAIC,oBAAY,CACpB,oFAAoF,CACrF;AACH;;AAEA;AACA,SAASC,cAAc,CAACC,aAAoB,EAAEC,MAAc,EAAE;EAC5D,IAAI,IAAAC,gBAAS,EAACF,aAAa,CAAC,EAAE;IAC5B,OAAOC,MAAM,CAACE,OAAO;EACvB;EACA,IAAI,IAAAC,oBAAa,EAACJ,aAAa,CAAC,EAAE;IAChC,OAAOC,MAAM,CAACI,WAAW;EAC3B;EACAR,sBAAsB,EAAE;AAC1B;;AAEA;AACO,eAAeS,UAAU,CAACC,GAA2B,EAAEC,KAAY,EAA8B;EACtG,IAAI,CAAC,IAAAN,gBAAS,EAACM,KAAK,CAAC,IAAI,CAAC,IAAAJ,oBAAa,EAACI,KAAK,CAAC,EAAE;IAC9CX,sBAAsB,EAAE;EAC1B;EAEA,IAAII,MAAM,GAAGM,GAAG,CAACE,YAAY,CAACC,aAAa,EAAE;EAC7C,IAAIT,MAAM,CAACU,YAAY,EAAE;IACvBV,MAAM,GAAG,MAAM,IAAAW,8CAAsB,EAACL,GAAG,EAAE;MACzCM,MAAM,EAAEL,KAAK,CAACK;IAChB,CAAC,EAAEZ,MAAM,CAACU,YAAY,CAAC;IACvB,OAAOZ,cAAc,CAACS,KAAK,EAAEP,MAAM,CAAC;EACtC;EAEA,IAAIa,YAAY;EAChB,IAAIP,GAAG,CAACQ,OAAO,CAACC,IAAI,EAAE;IACpBF,YAAY,GAAG,MAAM;EACvB,CAAC,MAAM,IAAI,IAAAV,oBAAa,EAACI,KAAK,CAAC,EAAE;IAC/BM,YAAY,GAAG,OAAO;EACxB,CAAC,MAAM;IACLA,YAAY,GAAG,UAAU;EAC3B;EAEA,MAAM;IAAED,MAAM;IAAEI,YAAY;IAAEC,WAAW;IAAEC;EAAO,CAAC,GAAGX,KAAgC;EACtF,OAAO,IAAAY,kCAAgB,EAACb,GAAG,EAAE;IAC3BO,YAAY;IACZD,MAAM;IACNI,YAAY;IACZC,WAAW;IACXC;EACF,CAAC,CAAC,CACCE,IAAI,CAAC,UAAUC,GAAG,EAAE;IACnB,OAAOvB,cAAc,CAACS,KAAK,EAAEc,GAAG,CAACrB,MAAM,CAAC;EAC1C,CAAC,CAAC;AACN"}
|
package/cjs/oidc/renewTokens.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.renewTokens = renewTokens;
|
|
4
|
-
|
|
5
4
|
var _errors = require("../errors");
|
|
6
|
-
|
|
7
5
|
var _getWithoutPrompt = require("./getWithoutPrompt");
|
|
8
|
-
|
|
9
6
|
var _renewTokensWithRefresh = require("./renewTokensWithRefresh");
|
|
10
|
-
|
|
11
7
|
var _util = require("./util");
|
|
12
|
-
|
|
13
8
|
/*!
|
|
14
9
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
15
10
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -22,43 +17,37 @@ var _util = require("./util");
|
|
|
22
17
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
23
18
|
*
|
|
24
19
|
*/
|
|
20
|
+
|
|
25
21
|
// If we have a refresh token, renew using that, otherwise getWithoutPrompt
|
|
26
22
|
// eslint-disable-next-line complexity
|
|
27
23
|
async function renewTokens(sdk, options) {
|
|
28
24
|
const tokens = sdk.tokenManager.getTokensSync();
|
|
29
|
-
|
|
30
25
|
if (tokens.refreshToken) {
|
|
31
26
|
return (0, _renewTokensWithRefresh.renewTokensWithRefresh)(sdk, options || {}, tokens.refreshToken);
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
if (!tokens.accessToken && !tokens.idToken) {
|
|
35
29
|
throw new _errors.AuthSdkError('renewTokens() was called but there is no existing token');
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
const accessToken = tokens.accessToken || {};
|
|
39
32
|
const idToken = tokens.idToken || {};
|
|
40
33
|
const scopes = accessToken.scopes || idToken.scopes;
|
|
41
|
-
|
|
42
34
|
if (!scopes) {
|
|
43
35
|
throw new _errors.AuthSdkError('renewTokens: invalid tokens: could not read scopes');
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
const authorizeUrl = accessToken.authorizeUrl || idToken.authorizeUrl;
|
|
47
|
-
|
|
48
38
|
if (!authorizeUrl) {
|
|
49
39
|
throw new _errors.AuthSdkError('renewTokens: invalid tokens: could not read authorizeUrl');
|
|
50
40
|
}
|
|
51
|
-
|
|
52
41
|
const userinfoUrl = accessToken.userinfoUrl || sdk.options.userinfoUrl;
|
|
53
|
-
const issuer = idToken.issuer || sdk.options.issuer;
|
|
42
|
+
const issuer = idToken.issuer || sdk.options.issuer;
|
|
54
43
|
|
|
44
|
+
// Get tokens using the SSO cookie
|
|
55
45
|
options = Object.assign({
|
|
56
46
|
scopes,
|
|
57
47
|
authorizeUrl,
|
|
58
48
|
userinfoUrl,
|
|
59
49
|
issuer
|
|
60
50
|
}, options);
|
|
61
|
-
|
|
62
51
|
if (sdk.options.pkce) {
|
|
63
52
|
options.responseType = 'code';
|
|
64
53
|
} else {
|
|
@@ -67,7 +56,6 @@ async function renewTokens(sdk, options) {
|
|
|
67
56
|
} = (0, _util.getDefaultTokenParams)(sdk);
|
|
68
57
|
options.responseType = responseType;
|
|
69
58
|
}
|
|
70
|
-
|
|
71
59
|
return (0, _getWithoutPrompt.getWithoutPrompt)(sdk, options).then(res => res.tokens);
|
|
72
60
|
}
|
|
73
61
|
//# sourceMappingURL=renewTokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renewTokens.js","names":["renewTokens","sdk","options","tokens","tokenManager","getTokensSync","refreshToken","renewTokensWithRefresh","accessToken","idToken","AuthSdkError","scopes","authorizeUrl","userinfoUrl","issuer","Object","assign","pkce","responseType","getDefaultTokenParams","getWithoutPrompt","then","res"],"sources":["../../../lib/oidc/renewTokens.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { TokenParams, Tokens } from './types';\nimport { getWithoutPrompt } from './getWithoutPrompt';\nimport { renewTokensWithRefresh } from './renewTokensWithRefresh';\nimport { getDefaultTokenParams } from './util';\n\n// If we have a refresh token, renew using that, otherwise getWithoutPrompt\n// eslint-disable-next-line complexity\nexport async function renewTokens(sdk, options?: TokenParams): Promise<Tokens> {\n const tokens = sdk.tokenManager.getTokensSync();\n if (tokens.refreshToken) {\n return renewTokensWithRefresh(sdk, options || {}, tokens.refreshToken);\n }\n\n if (!tokens.accessToken && !tokens.idToken) {\n throw new AuthSdkError('renewTokens() was called but there is no existing token');\n }\n\n const accessToken = tokens.accessToken || {};\n const idToken = tokens.idToken || {};\n const scopes = accessToken.scopes || idToken.scopes;\n if (!scopes) {\n throw new AuthSdkError('renewTokens: invalid tokens: could not read scopes');\n }\n const authorizeUrl = accessToken.authorizeUrl || idToken.authorizeUrl;\n if (!authorizeUrl) {\n throw new AuthSdkError('renewTokens: invalid tokens: could not read authorizeUrl');\n }\n const userinfoUrl = accessToken.userinfoUrl || sdk.options.userinfoUrl;\n const issuer = idToken.issuer || sdk.options.issuer;\n\n // Get tokens using the SSO cookie\n options = Object.assign({\n scopes,\n authorizeUrl,\n userinfoUrl,\n issuer\n }, options);\n\n if (sdk.options.pkce) {\n options.responseType = 'code';\n } else {\n const { responseType } = getDefaultTokenParams(sdk);\n options.responseType = responseType;\n }\n\n return getWithoutPrompt(sdk, options)\n .then(res => res.tokens);\n \n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"renewTokens.js","names":["renewTokens","sdk","options","tokens","tokenManager","getTokensSync","refreshToken","renewTokensWithRefresh","accessToken","idToken","AuthSdkError","scopes","authorizeUrl","userinfoUrl","issuer","Object","assign","pkce","responseType","getDefaultTokenParams","getWithoutPrompt","then","res"],"sources":["../../../lib/oidc/renewTokens.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { TokenParams, Tokens } from './types';\nimport { getWithoutPrompt } from './getWithoutPrompt';\nimport { renewTokensWithRefresh } from './renewTokensWithRefresh';\nimport { getDefaultTokenParams } from './util';\n\n// If we have a refresh token, renew using that, otherwise getWithoutPrompt\n// eslint-disable-next-line complexity\nexport async function renewTokens(sdk, options?: TokenParams): Promise<Tokens> {\n const tokens = sdk.tokenManager.getTokensSync();\n if (tokens.refreshToken) {\n return renewTokensWithRefresh(sdk, options || {}, tokens.refreshToken);\n }\n\n if (!tokens.accessToken && !tokens.idToken) {\n throw new AuthSdkError('renewTokens() was called but there is no existing token');\n }\n\n const accessToken = tokens.accessToken || {};\n const idToken = tokens.idToken || {};\n const scopes = accessToken.scopes || idToken.scopes;\n if (!scopes) {\n throw new AuthSdkError('renewTokens: invalid tokens: could not read scopes');\n }\n const authorizeUrl = accessToken.authorizeUrl || idToken.authorizeUrl;\n if (!authorizeUrl) {\n throw new AuthSdkError('renewTokens: invalid tokens: could not read authorizeUrl');\n }\n const userinfoUrl = accessToken.userinfoUrl || sdk.options.userinfoUrl;\n const issuer = idToken.issuer || sdk.options.issuer;\n\n // Get tokens using the SSO cookie\n options = Object.assign({\n scopes,\n authorizeUrl,\n userinfoUrl,\n issuer\n }, options);\n\n if (sdk.options.pkce) {\n options.responseType = 'code';\n } else {\n const { responseType } = getDefaultTokenParams(sdk);\n options.responseType = responseType;\n }\n\n return getWithoutPrompt(sdk, options)\n .then(res => res.tokens);\n \n}\n"],"mappings":";;;AAYA;AAEA;AACA;AACA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACO,eAAeA,WAAW,CAACC,GAAG,EAAEC,OAAqB,EAAmB;EAC7E,MAAMC,MAAM,GAAGF,GAAG,CAACG,YAAY,CAACC,aAAa,EAAE;EAC/C,IAAIF,MAAM,CAACG,YAAY,EAAE;IACvB,OAAO,IAAAC,8CAAsB,EAACN,GAAG,EAAEC,OAAO,IAAI,CAAC,CAAC,EAAEC,MAAM,CAACG,YAAY,CAAC;EACxE;EAEA,IAAI,CAACH,MAAM,CAACK,WAAW,IAAI,CAACL,MAAM,CAACM,OAAO,EAAE;IAC1C,MAAM,IAAIC,oBAAY,CAAC,yDAAyD,CAAC;EACnF;EAEA,MAAMF,WAAW,GAAGL,MAAM,CAACK,WAAW,IAAI,CAAC,CAAC;EAC5C,MAAMC,OAAO,GAAGN,MAAM,CAACM,OAAO,IAAI,CAAC,CAAC;EACpC,MAAME,MAAM,GAAGH,WAAW,CAACG,MAAM,IAAIF,OAAO,CAACE,MAAM;EACnD,IAAI,CAACA,MAAM,EAAE;IACX,MAAM,IAAID,oBAAY,CAAC,oDAAoD,CAAC;EAC9E;EACA,MAAME,YAAY,GAAGJ,WAAW,CAACI,YAAY,IAAIH,OAAO,CAACG,YAAY;EACrE,IAAI,CAACA,YAAY,EAAE;IACjB,MAAM,IAAIF,oBAAY,CAAC,0DAA0D,CAAC;EACpF;EACA,MAAMG,WAAW,GAAGL,WAAW,CAACK,WAAW,IAAIZ,GAAG,CAACC,OAAO,CAACW,WAAW;EACtE,MAAMC,MAAM,GAAGL,OAAO,CAACK,MAAM,IAAIb,GAAG,CAACC,OAAO,CAACY,MAAM;;EAEnD;EACAZ,OAAO,GAAGa,MAAM,CAACC,MAAM,CAAC;IACtBL,MAAM;IACNC,YAAY;IACZC,WAAW;IACXC;EACF,CAAC,EAAEZ,OAAO,CAAC;EAEX,IAAID,GAAG,CAACC,OAAO,CAACe,IAAI,EAAE;IACpBf,OAAO,CAACgB,YAAY,GAAG,MAAM;EAC/B,CAAC,MAAM;IACL,MAAM;MAAEA;IAAa,CAAC,GAAG,IAAAC,2BAAqB,EAAClB,GAAG,CAAC;IACnDC,OAAO,CAACgB,YAAY,GAAGA,YAAY;EACrC;EAEA,OAAO,IAAAE,kCAAgB,EAACnB,GAAG,EAAEC,OAAO,CAAC,CAClCmB,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACnB,MAAM,CAAC;AAE5B"}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.renewTokensWithRefresh = renewTokensWithRefresh;
|
|
4
|
-
|
|
5
4
|
var _errors = require("../errors");
|
|
6
|
-
|
|
7
5
|
var _oauth = require("./util/oauth");
|
|
8
|
-
|
|
9
6
|
var _refreshToken = require("./util/refreshToken");
|
|
10
|
-
|
|
11
7
|
var _handleOAuthResponse = require("./handleOAuthResponse");
|
|
12
|
-
|
|
13
8
|
var _token = require("./endpoints/token");
|
|
14
|
-
|
|
15
9
|
var _errors2 = require("./util/errors");
|
|
16
|
-
|
|
17
10
|
/*!
|
|
18
11
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
19
12
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -26,15 +19,14 @@ var _errors2 = require("./util/errors");
|
|
|
26
19
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
27
20
|
*
|
|
28
21
|
*/
|
|
22
|
+
|
|
29
23
|
async function renewTokensWithRefresh(sdk, tokenParams, refreshTokenObject) {
|
|
30
24
|
const {
|
|
31
25
|
clientId
|
|
32
26
|
} = sdk.options;
|
|
33
|
-
|
|
34
27
|
if (!clientId) {
|
|
35
28
|
throw new _errors.AuthSdkError('A clientId must be specified in the OktaAuth constructor to renew tokens');
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
try {
|
|
39
31
|
const renewTokenParams = Object.assign({}, tokenParams, {
|
|
40
32
|
clientId
|
|
@@ -43,23 +35,21 @@ async function renewTokensWithRefresh(sdk, tokenParams, refreshTokenObject) {
|
|
|
43
35
|
const urls = (0, _oauth.getOAuthUrls)(sdk, tokenParams);
|
|
44
36
|
const {
|
|
45
37
|
tokens
|
|
46
|
-
} = await (0, _handleOAuthResponse.handleOAuthResponse)(sdk, renewTokenParams, tokenResponse, urls);
|
|
38
|
+
} = await (0, _handleOAuthResponse.handleOAuthResponse)(sdk, renewTokenParams, tokenResponse, urls);
|
|
47
39
|
|
|
40
|
+
// Support rotating refresh tokens
|
|
48
41
|
const {
|
|
49
42
|
refreshToken
|
|
50
43
|
} = tokens;
|
|
51
|
-
|
|
52
44
|
if (refreshToken && !(0, _refreshToken.isSameRefreshToken)(refreshToken, refreshTokenObject)) {
|
|
53
45
|
sdk.tokenManager.updateRefreshToken(refreshToken);
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
return tokens;
|
|
57
48
|
} catch (err) {
|
|
58
49
|
if ((0, _errors2.isRefreshTokenInvalidError)(err)) {
|
|
59
50
|
// if the refresh token is invalid, remove it from storage
|
|
60
51
|
sdk.tokenManager.removeRefreshToken();
|
|
61
52
|
}
|
|
62
|
-
|
|
63
53
|
throw err;
|
|
64
54
|
}
|
|
65
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renewTokensWithRefresh.js","names":["renewTokensWithRefresh","sdk","tokenParams","refreshTokenObject","clientId","options","AuthSdkError","renewTokenParams","Object","assign","tokenResponse","postRefreshToken","urls","getOAuthUrls","tokens","handleOAuthResponse","refreshToken","isSameRefreshToken","tokenManager","updateRefreshToken","err","isRefreshTokenInvalidError","removeRefreshToken"],"sources":["../../../lib/oidc/renewTokensWithRefresh.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { getOAuthUrls } from './util/oauth';\nimport { isSameRefreshToken } from './util/refreshToken';\nimport { OktaAuthOAuthInterface, TokenParams, RefreshToken, Tokens } from './types';\nimport { handleOAuthResponse } from './handleOAuthResponse';\nimport { postRefreshToken } from './endpoints/token';\nimport { isRefreshTokenInvalidError } from './util/errors';\n\nexport async function renewTokensWithRefresh(\n sdk: OktaAuthOAuthInterface,\n tokenParams: TokenParams,\n refreshTokenObject: RefreshToken\n): Promise<Tokens> {\n const { clientId } = sdk.options;\n if (!clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to renew tokens');\n }\n\n try {\n const renewTokenParams: TokenParams = Object.assign({}, tokenParams, {\n clientId,\n });\n const tokenResponse = await postRefreshToken(sdk, renewTokenParams, refreshTokenObject);\n const urls = getOAuthUrls(sdk, tokenParams);\n const { tokens } = await handleOAuthResponse(sdk, renewTokenParams, tokenResponse, urls);\n\n // Support rotating refresh tokens\n const { refreshToken } = tokens;\n if (refreshToken && !isSameRefreshToken(refreshToken, refreshTokenObject)) {\n sdk.tokenManager.updateRefreshToken(refreshToken);\n }\n\n return tokens;\n }\n catch (err) {\n if (isRefreshTokenInvalidError(err)) {\n // if the refresh token is invalid, remove it from storage\n sdk.tokenManager.removeRefreshToken();\n }\n throw err;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"renewTokensWithRefresh.js","names":["renewTokensWithRefresh","sdk","tokenParams","refreshTokenObject","clientId","options","AuthSdkError","renewTokenParams","Object","assign","tokenResponse","postRefreshToken","urls","getOAuthUrls","tokens","handleOAuthResponse","refreshToken","isSameRefreshToken","tokenManager","updateRefreshToken","err","isRefreshTokenInvalidError","removeRefreshToken"],"sources":["../../../lib/oidc/renewTokensWithRefresh.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { getOAuthUrls } from './util/oauth';\nimport { isSameRefreshToken } from './util/refreshToken';\nimport { OktaAuthOAuthInterface, TokenParams, RefreshToken, Tokens } from './types';\nimport { handleOAuthResponse } from './handleOAuthResponse';\nimport { postRefreshToken } from './endpoints/token';\nimport { isRefreshTokenInvalidError } from './util/errors';\n\nexport async function renewTokensWithRefresh(\n sdk: OktaAuthOAuthInterface,\n tokenParams: TokenParams,\n refreshTokenObject: RefreshToken\n): Promise<Tokens> {\n const { clientId } = sdk.options;\n if (!clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to renew tokens');\n }\n\n try {\n const renewTokenParams: TokenParams = Object.assign({}, tokenParams, {\n clientId,\n });\n const tokenResponse = await postRefreshToken(sdk, renewTokenParams, refreshTokenObject);\n const urls = getOAuthUrls(sdk, tokenParams);\n const { tokens } = await handleOAuthResponse(sdk, renewTokenParams, tokenResponse, urls);\n\n // Support rotating refresh tokens\n const { refreshToken } = tokens;\n if (refreshToken && !isSameRefreshToken(refreshToken, refreshTokenObject)) {\n sdk.tokenManager.updateRefreshToken(refreshToken);\n }\n\n return tokens;\n }\n catch (err) {\n if (isRefreshTokenInvalidError(err)) {\n // if the refresh token is invalid, remove it from storage\n sdk.tokenManager.removeRefreshToken();\n }\n throw err;\n }\n}\n"],"mappings":";;;AAYA;AACA;AACA;AAEA;AACA;AACA;AAlBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASO,eAAeA,sBAAsB,CAC1CC,GAA2B,EAC3BC,WAAwB,EACxBC,kBAAgC,EACf;EACjB,MAAM;IAAEC;EAAS,CAAC,GAAGH,GAAG,CAACI,OAAO;EAChC,IAAI,CAACD,QAAQ,EAAE;IACb,MAAM,IAAIE,oBAAY,CAAC,0EAA0E,CAAC;EACpG;EAEA,IAAI;IACF,MAAMC,gBAA6B,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEP,WAAW,EAAE;MACnEE;IACF,CAAC,CAAC;IACF,MAAMM,aAAa,GAAG,MAAM,IAAAC,uBAAgB,EAACV,GAAG,EAAEM,gBAAgB,EAAEJ,kBAAkB,CAAC;IACvF,MAAMS,IAAI,GAAG,IAAAC,mBAAY,EAACZ,GAAG,EAAEC,WAAW,CAAC;IAC3C,MAAM;MAAEY;IAAO,CAAC,GAAG,MAAM,IAAAC,wCAAmB,EAACd,GAAG,EAAEM,gBAAgB,EAAEG,aAAa,EAAEE,IAAI,CAAC;;IAExF;IACA,MAAM;MAAEI;IAAa,CAAC,GAAGF,MAAM;IAC/B,IAAIE,YAAY,IAAI,CAAC,IAAAC,gCAAkB,EAACD,YAAY,EAAEb,kBAAkB,CAAC,EAAE;MACzEF,GAAG,CAACiB,YAAY,CAACC,kBAAkB,CAACH,YAAY,CAAC;IACnD;IAEA,OAAOF,MAAM;EACf,CAAC,CACD,OAAOM,GAAG,EAAE;IACV,IAAI,IAAAC,mCAA0B,EAACD,GAAG,CAAC,EAAE;MACnC;MACAnB,GAAG,CAACiB,YAAY,CAACI,kBAAkB,EAAE;IACvC;IACA,MAAMF,GAAG;EACX;AACF"}
|
package/cjs/oidc/revokeToken.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.revokeToken = revokeToken;
|
|
6
|
-
|
|
7
5
|
var _http = require("../http");
|
|
8
|
-
|
|
9
6
|
var _util = require("../util");
|
|
10
|
-
|
|
11
7
|
var _oauth = require("./util/oauth");
|
|
12
|
-
|
|
13
8
|
var _crypto = require("../crypto");
|
|
14
|
-
|
|
15
9
|
var _AuthSdkError = _interopRequireDefault(require("../errors/AuthSdkError"));
|
|
16
|
-
|
|
17
10
|
/*!
|
|
18
11
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
19
12
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -28,28 +21,24 @@ var _AuthSdkError = _interopRequireDefault(require("../errors/AuthSdkError"));
|
|
|
28
21
|
*/
|
|
29
22
|
|
|
30
23
|
/* eslint complexity:[0,8] */
|
|
24
|
+
|
|
31
25
|
// refresh tokens have precedence to be revoked if no token is specified
|
|
32
26
|
async function revokeToken(sdk, token) {
|
|
33
27
|
let accessToken = '';
|
|
34
28
|
let refreshToken = '';
|
|
35
|
-
|
|
36
29
|
if (token) {
|
|
37
30
|
accessToken = token.accessToken;
|
|
38
31
|
refreshToken = token.refreshToken;
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
if (!accessToken && !refreshToken) {
|
|
42
34
|
throw new _AuthSdkError.default('A valid access or refresh token object is required');
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
var clientId = sdk.options.clientId;
|
|
46
37
|
var clientSecret = sdk.options.clientSecret;
|
|
47
|
-
|
|
48
38
|
if (!clientId) {
|
|
49
39
|
throw new _AuthSdkError.default('A clientId must be specified in the OktaAuth constructor to revoke a token');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
}
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
53
42
|
var revokeUrl = (0, _oauth.getOAuthUrls)(sdk).revokeUrl;
|
|
54
43
|
var args = (0, _util.toQueryString)({
|
|
55
44
|
// eslint-disable-next-line camelcase
|