@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,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.createTransactionManager = createTransactionManager;
|
|
4
|
-
|
|
5
4
|
var _types = require("./types");
|
|
6
|
-
|
|
7
5
|
var _util = require("../util");
|
|
8
|
-
|
|
9
6
|
var _sharedStorage = require("./util/sharedStorage");
|
|
10
|
-
|
|
11
7
|
/*!
|
|
12
8
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
13
9
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -19,6 +15,7 @@ var _sharedStorage = require("./util/sharedStorage");
|
|
|
19
15
|
*
|
|
20
16
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
21
17
|
*/
|
|
18
|
+
|
|
22
19
|
function createTransactionManager() {
|
|
23
20
|
return class TransactionManager {
|
|
24
21
|
constructor(options) {
|
|
@@ -27,46 +24,47 @@ function createTransactionManager() {
|
|
|
27
24
|
this.enableSharedStorage = options.enableSharedStorage === false ? false : true;
|
|
28
25
|
this.saveLastResponse = options.saveLastResponse === false ? false : true;
|
|
29
26
|
this.options = options;
|
|
30
|
-
}
|
|
31
|
-
|
|
27
|
+
}
|
|
32
28
|
|
|
29
|
+
// eslint-disable-next-line complexity
|
|
33
30
|
clear(options = {}) {
|
|
34
31
|
const transactionStorage = this.storageManager.getTransactionStorage();
|
|
35
|
-
const meta = transactionStorage.getStorage();
|
|
32
|
+
const meta = transactionStorage.getStorage();
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
// Clear primary storage (by default, sessionStorage on browser)
|
|
35
|
+
transactionStorage.clearStorage();
|
|
38
36
|
|
|
37
|
+
// Usually we want to also clear shared storage unless another tab may need it to continue/complete a flow
|
|
39
38
|
if (this.enableSharedStorage && options.clearSharedStorage !== false) {
|
|
40
39
|
const state = options.state || (meta === null || meta === void 0 ? void 0 : meta.state);
|
|
41
|
-
|
|
42
40
|
if (state) {
|
|
43
41
|
(0, _sharedStorage.clearTransactionFromSharedStorage)(this.storageManager, state);
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
|
-
}
|
|
47
|
-
|
|
44
|
+
}
|
|
48
45
|
|
|
46
|
+
// eslint-disable-next-line complexity
|
|
49
47
|
save(meta, options = {}) {
|
|
50
48
|
// There must be only one transaction executing at a time.
|
|
51
49
|
// Before saving, check to see if a transaction is already stored.
|
|
52
50
|
// An existing transaction indicates a concurrency/race/overlap condition
|
|
51
|
+
|
|
53
52
|
let storage = this.storageManager.getTransactionStorage();
|
|
54
|
-
const obj = storage.getStorage();
|
|
53
|
+
const obj = storage.getStorage();
|
|
54
|
+
// oie process may need to update transaction in the middle of process for tracking purpose
|
|
55
55
|
// false alarm might be caused
|
|
56
56
|
// TODO: revisit for a better solution, https://oktainc.atlassian.net/browse/OKTA-430919
|
|
57
|
-
|
|
58
57
|
if ((0, _types.isTransactionMeta)(obj) && !options.muteWarning) {
|
|
59
58
|
// eslint-disable-next-line max-len
|
|
60
59
|
(0, _util.warn)('a saved auth transaction exists in storage. This may indicate another auth flow is already in progress.');
|
|
61
60
|
}
|
|
61
|
+
storage.setStorage(meta);
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
// Shared storage allows continuation of transaction in another tab
|
|
65
64
|
if (this.enableSharedStorage && meta.state) {
|
|
66
65
|
(0, _sharedStorage.saveTransactionToSharedStorage)(this.storageManager, meta.state, meta);
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
|
|
70
68
|
exists(options = {}) {
|
|
71
69
|
try {
|
|
72
70
|
const meta = this.load(options);
|
|
@@ -74,34 +72,29 @@ function createTransactionManager() {
|
|
|
74
72
|
} catch {
|
|
75
73
|
return false;
|
|
76
74
|
}
|
|
77
|
-
}
|
|
78
|
-
// eslint-disable-next-line complexity,max-statements
|
|
79
|
-
|
|
75
|
+
}
|
|
80
76
|
|
|
77
|
+
// load transaction meta from storage
|
|
78
|
+
// eslint-disable-next-line complexity,max-statements
|
|
81
79
|
load(options = {}) {
|
|
82
|
-
let meta;
|
|
80
|
+
let meta;
|
|
83
81
|
|
|
82
|
+
// If state was passed, try loading transaction data from shared storage
|
|
84
83
|
if (this.enableSharedStorage && options.state) {
|
|
85
84
|
(0, _sharedStorage.pruneSharedStorage)(this.storageManager); // prune before load
|
|
86
|
-
|
|
87
85
|
meta = (0, _sharedStorage.loadTransactionFromSharedStorage)(this.storageManager, options.state);
|
|
88
|
-
|
|
89
86
|
if ((0, _types.isTransactionMeta)(meta)) {
|
|
90
87
|
return meta;
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
|
-
|
|
94
90
|
let storage = this.storageManager.getTransactionStorage();
|
|
95
91
|
meta = storage.getStorage();
|
|
96
|
-
|
|
97
92
|
if ((0, _types.isTransactionMeta)(meta)) {
|
|
98
93
|
// if we have meta in the new location, there is no need to go further
|
|
99
94
|
return meta;
|
|
100
95
|
}
|
|
101
|
-
|
|
102
96
|
return null;
|
|
103
97
|
}
|
|
104
|
-
|
|
105
98
|
};
|
|
106
99
|
}
|
|
107
100
|
//# sourceMappingURL=TransactionManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionManager.js","names":["createTransactionManager","TransactionManager","constructor","options","storageManager","enableSharedStorage","saveLastResponse","clear","transactionStorage","getTransactionStorage","meta","getStorage","clearStorage","clearSharedStorage","state","clearTransactionFromSharedStorage","save","storage","obj","isTransactionMeta","muteWarning","warn","setStorage","saveTransactionToSharedStorage","exists","load","pruneSharedStorage","loadTransactionFromSharedStorage"],"sources":["../../../lib/oidc/TransactionManager.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 { StorageProvider } from '../storage/types';\nimport {\n TransactionMeta,\n isTransactionMeta,\n TransactionMetaOptions,\n TransactionManagerOptions,\n OAuthTransactionMeta,\n OAuthStorageManagerInterface,\n ClearTransactionMetaOptions,\n TransactionManagerInterface,\n PKCETransactionMeta\n} from './types';\nimport { warn } from '../util';\nimport {\n clearTransactionFromSharedStorage,\n loadTransactionFromSharedStorage,\n pruneSharedStorage,\n saveTransactionToSharedStorage\n} from './util/sharedStorage';\n\n\nexport function createTransactionManager\n<\n M extends OAuthTransactionMeta = PKCETransactionMeta,\n S extends OAuthStorageManagerInterface<M> = OAuthStorageManagerInterface<M>\n>\n()\n{\n return class TransactionManager implements TransactionManagerInterface\n {\n options: TransactionManagerOptions;\n storageManager: S;\n enableSharedStorage: boolean;\n saveLastResponse: boolean;\n\n constructor(options: TransactionManagerOptions) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.storageManager = options.storageManager! as S;\n this.enableSharedStorage = options.enableSharedStorage === false ? false : true;\n this.saveLastResponse = options.saveLastResponse === false ? false : true;\n this.options = options;\n }\n\n // eslint-disable-next-line complexity\n clear(options: ClearTransactionMetaOptions = {}) {\n const transactionStorage: StorageProvider = this.storageManager.getTransactionStorage();\n const meta = transactionStorage.getStorage();\n\n // Clear primary storage (by default, sessionStorage on browser)\n transactionStorage.clearStorage();\n\n // Usually we want to also clear shared storage unless another tab may need it to continue/complete a flow\n if (this.enableSharedStorage && options.clearSharedStorage !== false) {\n const state = options.state || meta?.state;\n if (state) {\n clearTransactionFromSharedStorage(this.storageManager, state);\n }\n }\n }\n\n // eslint-disable-next-line complexity\n save(meta: M, options: TransactionMetaOptions = {}) {\n // There must be only one transaction executing at a time.\n // Before saving, check to see if a transaction is already stored.\n // An existing transaction indicates a concurrency/race/overlap condition\n\n let storage: StorageProvider = this.storageManager.getTransactionStorage();\n const obj = storage.getStorage();\n // oie process may need to update transaction in the middle of process for tracking purpose\n // false alarm might be caused \n // TODO: revisit for a better solution, https://oktainc.atlassian.net/browse/OKTA-430919\n if (isTransactionMeta(obj) && !options.muteWarning) {\n // eslint-disable-next-line max-len\n warn('a saved auth transaction exists in storage. This may indicate another auth flow is already in progress.');\n }\n\n storage.setStorage(meta);\n\n // Shared storage allows continuation of transaction in another tab\n if (this.enableSharedStorage && meta.state) {\n saveTransactionToSharedStorage(this.storageManager, meta.state, meta);\n }\n }\n\n exists(options: TransactionMetaOptions = {}): boolean {\n try {\n const meta = this.load(options);\n return !!meta;\n } catch {\n return false;\n }\n }\n\n // load transaction meta from storage\n // eslint-disable-next-line complexity,max-statements\n load(options: TransactionMetaOptions = {}): TransactionMeta | null {\n\n let meta: TransactionMeta;\n\n // If state was passed, try loading transaction data from shared storage\n if (this.enableSharedStorage && options.state) {\n pruneSharedStorage(this.storageManager); // prune before load\n meta = loadTransactionFromSharedStorage(this.storageManager, options.state);\n if (isTransactionMeta(meta)) {\n return meta;\n }\n }\n\n let storage: StorageProvider = this.storageManager.getTransactionStorage();\n meta = storage.getStorage();\n if (isTransactionMeta(meta)) {\n // if we have meta in the new location, there is no need to go further\n return meta;\n }\n\n return null;\n }\n\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TransactionManager.js","names":["createTransactionManager","TransactionManager","constructor","options","storageManager","enableSharedStorage","saveLastResponse","clear","transactionStorage","getTransactionStorage","meta","getStorage","clearStorage","clearSharedStorage","state","clearTransactionFromSharedStorage","save","storage","obj","isTransactionMeta","muteWarning","warn","setStorage","saveTransactionToSharedStorage","exists","load","pruneSharedStorage","loadTransactionFromSharedStorage"],"sources":["../../../lib/oidc/TransactionManager.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 { StorageProvider } from '../storage/types';\nimport {\n TransactionMeta,\n isTransactionMeta,\n TransactionMetaOptions,\n TransactionManagerOptions,\n OAuthTransactionMeta,\n OAuthStorageManagerInterface,\n ClearTransactionMetaOptions,\n TransactionManagerInterface,\n PKCETransactionMeta\n} from './types';\nimport { warn } from '../util';\nimport {\n clearTransactionFromSharedStorage,\n loadTransactionFromSharedStorage,\n pruneSharedStorage,\n saveTransactionToSharedStorage\n} from './util/sharedStorage';\n\n\nexport function createTransactionManager\n<\n M extends OAuthTransactionMeta = PKCETransactionMeta,\n S extends OAuthStorageManagerInterface<M> = OAuthStorageManagerInterface<M>\n>\n()\n{\n return class TransactionManager implements TransactionManagerInterface\n {\n options: TransactionManagerOptions;\n storageManager: S;\n enableSharedStorage: boolean;\n saveLastResponse: boolean;\n\n constructor(options: TransactionManagerOptions) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.storageManager = options.storageManager! as S;\n this.enableSharedStorage = options.enableSharedStorage === false ? false : true;\n this.saveLastResponse = options.saveLastResponse === false ? false : true;\n this.options = options;\n }\n\n // eslint-disable-next-line complexity\n clear(options: ClearTransactionMetaOptions = {}) {\n const transactionStorage: StorageProvider = this.storageManager.getTransactionStorage();\n const meta = transactionStorage.getStorage();\n\n // Clear primary storage (by default, sessionStorage on browser)\n transactionStorage.clearStorage();\n\n // Usually we want to also clear shared storage unless another tab may need it to continue/complete a flow\n if (this.enableSharedStorage && options.clearSharedStorage !== false) {\n const state = options.state || meta?.state;\n if (state) {\n clearTransactionFromSharedStorage(this.storageManager, state);\n }\n }\n }\n\n // eslint-disable-next-line complexity\n save(meta: M, options: TransactionMetaOptions = {}) {\n // There must be only one transaction executing at a time.\n // Before saving, check to see if a transaction is already stored.\n // An existing transaction indicates a concurrency/race/overlap condition\n\n let storage: StorageProvider = this.storageManager.getTransactionStorage();\n const obj = storage.getStorage();\n // oie process may need to update transaction in the middle of process for tracking purpose\n // false alarm might be caused \n // TODO: revisit for a better solution, https://oktainc.atlassian.net/browse/OKTA-430919\n if (isTransactionMeta(obj) && !options.muteWarning) {\n // eslint-disable-next-line max-len\n warn('a saved auth transaction exists in storage. This may indicate another auth flow is already in progress.');\n }\n\n storage.setStorage(meta);\n\n // Shared storage allows continuation of transaction in another tab\n if (this.enableSharedStorage && meta.state) {\n saveTransactionToSharedStorage(this.storageManager, meta.state, meta);\n }\n }\n\n exists(options: TransactionMetaOptions = {}): boolean {\n try {\n const meta = this.load(options);\n return !!meta;\n } catch {\n return false;\n }\n }\n\n // load transaction meta from storage\n // eslint-disable-next-line complexity,max-statements\n load(options: TransactionMetaOptions = {}): TransactionMeta | null {\n\n let meta: TransactionMeta;\n\n // If state was passed, try loading transaction data from shared storage\n if (this.enableSharedStorage && options.state) {\n pruneSharedStorage(this.storageManager); // prune before load\n meta = loadTransactionFromSharedStorage(this.storageManager, options.state);\n if (isTransactionMeta(meta)) {\n return meta;\n }\n }\n\n let storage: StorageProvider = this.storageManager.getTransactionStorage();\n meta = storage.getStorage();\n if (isTransactionMeta(meta)) {\n // if we have meta in the new location, there is no need to go further\n return meta;\n }\n\n return null;\n }\n\n };\n}\n"],"mappings":"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"}
|
package/cjs/oidc/decodeToken.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.decodeToken = decodeToken;
|
|
4
|
-
|
|
5
4
|
var _errors = require("../errors");
|
|
6
|
-
|
|
7
5
|
var _crypto = require("../crypto");
|
|
8
|
-
|
|
9
6
|
/*!
|
|
10
7
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
11
8
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -18,10 +15,10 @@ var _crypto = require("../crypto");
|
|
|
18
15
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
19
16
|
*
|
|
20
17
|
*/
|
|
18
|
+
|
|
21
19
|
function decodeToken(token) {
|
|
22
20
|
var jwt = token.split('.');
|
|
23
21
|
var decodedToken;
|
|
24
|
-
|
|
25
22
|
try {
|
|
26
23
|
decodedToken = {
|
|
27
24
|
header: JSON.parse((0, _crypto.base64UrlToString)(jwt[0])),
|
|
@@ -31,7 +28,6 @@ function decodeToken(token) {
|
|
|
31
28
|
} catch (e) {
|
|
32
29
|
throw new _errors.AuthSdkError('Malformed token');
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
return decodedToken;
|
|
36
32
|
}
|
|
37
33
|
//# sourceMappingURL=decodeToken.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeToken.js","names":["decodeToken","token","jwt","split","decodedToken","header","JSON","parse","base64UrlToString","payload","signature","e","AuthSdkError"],"sources":["../../../lib/oidc/decodeToken.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 { JWTObject } from './types';\nimport { base64UrlToString } from '../crypto';\n\nexport function decodeToken(token: string): JWTObject {\n var jwt = token.split('.');\n var decodedToken: JWTObject;\n\n try {\n decodedToken = {\n header: JSON.parse(base64UrlToString(jwt[0])),\n payload: JSON.parse(base64UrlToString(jwt[1])),\n signature: jwt[2]\n };\n } catch (e) {\n throw new AuthSdkError('Malformed token');\n }\n\n return decodedToken;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"decodeToken.js","names":["decodeToken","token","jwt","split","decodedToken","header","JSON","parse","base64UrlToString","payload","signature","e","AuthSdkError"],"sources":["../../../lib/oidc/decodeToken.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 { JWTObject } from './types';\nimport { base64UrlToString } from '../crypto';\n\nexport function decodeToken(token: string): JWTObject {\n var jwt = token.split('.');\n var decodedToken: JWTObject;\n\n try {\n decodedToken = {\n header: JSON.parse(base64UrlToString(jwt[0])),\n payload: JSON.parse(base64UrlToString(jwt[1])),\n signature: jwt[2]\n };\n } catch (e) {\n throw new AuthSdkError('Malformed token');\n }\n\n return decodedToken;\n}\n"],"mappings":";;;AAYA;AAEA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,SAASA,WAAW,CAACC,KAAa,EAAa;EACpD,IAAIC,GAAG,GAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC;EAC1B,IAAIC,YAAuB;EAE3B,IAAI;IACFA,YAAY,GAAG;MACbC,MAAM,EAAEC,IAAI,CAACC,KAAK,CAAC,IAAAC,yBAAiB,EAACN,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;MAC7CO,OAAO,EAAEH,IAAI,CAACC,KAAK,CAAC,IAAAC,yBAAiB,EAACN,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;MAC9CQ,SAAS,EAAER,GAAG,CAAC,CAAC;IAClB,CAAC;EACH,CAAC,CAAC,OAAOS,CAAC,EAAE;IACV,MAAM,IAAIC,oBAAY,CAAC,iBAAiB,CAAC;EAC3C;EAEA,OAAOR,YAAY;AACrB"}
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.buildAuthorizeParams = buildAuthorizeParams;
|
|
4
4
|
exports.convertTokenParamsToOAuthParams = convertTokenParamsToOAuthParams;
|
|
5
|
-
|
|
6
5
|
var _util = require("../../util");
|
|
7
|
-
|
|
8
6
|
var _errors = require("../../errors");
|
|
9
|
-
|
|
10
7
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
11
|
-
|
|
12
8
|
/*!
|
|
13
9
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
14
10
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -20,17 +16,17 @@ var _errors = require("../../errors");
|
|
|
20
16
|
*
|
|
21
17
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
22
18
|
*/
|
|
19
|
+
|
|
23
20
|
function convertTokenParamsToOAuthParams(tokenParams) {
|
|
24
21
|
// Quick validation
|
|
25
22
|
if (!tokenParams.clientId) {
|
|
26
23
|
throw new _errors.AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
if ((0, _util.isString)(tokenParams.responseType) && tokenParams.responseType.indexOf(' ') !== -1) {
|
|
30
26
|
throw new _errors.AuthSdkError('Multiple OAuth responseTypes must be defined as an array');
|
|
31
|
-
}
|
|
32
|
-
|
|
27
|
+
}
|
|
33
28
|
|
|
29
|
+
// Convert our params to their actual OAuth equivalents
|
|
34
30
|
var oauthParams = {
|
|
35
31
|
'client_id': tokenParams.clientId,
|
|
36
32
|
'code_challenge': tokenParams.codeChallenge,
|
|
@@ -46,7 +42,8 @@ function convertTokenParamsToOAuthParams(tokenParams) {
|
|
|
46
42
|
'response_mode': tokenParams.responseMode,
|
|
47
43
|
'response_type': tokenParams.responseType,
|
|
48
44
|
'sessionToken': tokenParams.sessionToken,
|
|
49
|
-
'state': tokenParams.state
|
|
45
|
+
'state': tokenParams.state,
|
|
46
|
+
'acr_values': tokenParams.acrValues
|
|
50
47
|
};
|
|
51
48
|
oauthParams = (0, _util.removeNils)(oauthParams);
|
|
52
49
|
['idp_scope', 'response_type'].forEach(function (mayBeArray) {
|
|
@@ -54,20 +51,19 @@ function convertTokenParamsToOAuthParams(tokenParams) {
|
|
|
54
51
|
oauthParams[mayBeArray] = oauthParams[mayBeArray].join(' ');
|
|
55
52
|
}
|
|
56
53
|
});
|
|
57
|
-
|
|
58
54
|
if (tokenParams.responseType.indexOf('id_token') !== -1 && tokenParams.scopes.indexOf('openid') === -1) {
|
|
59
55
|
throw new _errors.AuthSdkError('openid scope must be specified in the scopes argument when requesting an id_token');
|
|
60
56
|
} else {
|
|
61
57
|
oauthParams.scope = tokenParams.scopes.join(' ');
|
|
62
58
|
}
|
|
63
|
-
|
|
64
59
|
return oauthParams;
|
|
65
60
|
}
|
|
66
|
-
|
|
67
61
|
function buildAuthorizeParams(tokenParams) {
|
|
68
62
|
var oauthQueryParams = convertTokenParamsToOAuthParams(tokenParams);
|
|
69
|
-
return (0, _util.toQueryString)({
|
|
70
|
-
...
|
|
63
|
+
return (0, _util.toQueryString)({
|
|
64
|
+
...oauthQueryParams,
|
|
65
|
+
...(tokenParams.extraParams && {
|
|
66
|
+
...tokenParams.extraParams
|
|
71
67
|
})
|
|
72
68
|
});
|
|
73
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.js","names":["convertTokenParamsToOAuthParams","tokenParams","clientId","AuthSdkError","isString","responseType","indexOf","oauthParams","codeChallenge","codeChallengeMethod","display","idp","idpScope","loginHint","maxAge","nonce","prompt","redirectUri","responseMode","sessionToken","state","removeNils","forEach","mayBeArray","Array","isArray","join","scopes","scope","buildAuthorizeParams","oauthQueryParams","toQueryString","extraParams"],"sources":["../../../../lib/oidc/endpoints/authorize.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\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\n\nimport { isString, removeNils, toQueryString } from '../../util';\nimport { AuthSdkError } from '../../errors';\nimport { OAuthParams, TokenParams } from '../types';\n\nexport function convertTokenParamsToOAuthParams(tokenParams: TokenParams) {\n // Quick validation\n if (!tokenParams.clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');\n }\n\n if (isString(tokenParams.responseType) && tokenParams.responseType.indexOf(' ') !== -1) {\n throw new AuthSdkError('Multiple OAuth responseTypes must be defined as an array');\n }\n\n // Convert our params to their actual OAuth equivalents\n var oauthParams: OAuthParams = {\n 'client_id': tokenParams.clientId,\n 'code_challenge': tokenParams.codeChallenge,\n 'code_challenge_method': tokenParams.codeChallengeMethod,\n 'display': tokenParams.display,\n 'idp': tokenParams.idp,\n 'idp_scope': tokenParams.idpScope,\n 'login_hint': tokenParams.loginHint,\n 'max_age': tokenParams.maxAge,\n 'nonce': tokenParams.nonce,\n 'prompt': tokenParams.prompt,\n 'redirect_uri': tokenParams.redirectUri,\n 'response_mode': tokenParams.responseMode,\n 'response_type': tokenParams.responseType,\n 'sessionToken': tokenParams.sessionToken,\n 'state': tokenParams.state,\n };\n oauthParams = removeNils(oauthParams) as OAuthParams;\n\n ['idp_scope', 'response_type'].forEach(function (mayBeArray) {\n if (Array.isArray(oauthParams[mayBeArray])) {\n oauthParams[mayBeArray] = oauthParams[mayBeArray].join(' ');\n }\n });\n\n if (tokenParams.responseType!.indexOf('id_token') !== -1 &&\n tokenParams.scopes!.indexOf('openid') === -1) {\n throw new AuthSdkError('openid scope must be specified in the scopes argument when requesting an id_token');\n } else {\n oauthParams.scope = tokenParams.scopes!.join(' ');\n }\n\n return oauthParams;\n}\n\nexport function buildAuthorizeParams(tokenParams: TokenParams) {\n var oauthQueryParams = convertTokenParamsToOAuthParams(tokenParams);\n return toQueryString({ \n ...oauthQueryParams, \n ...(tokenParams.extraParams && { ...tokenParams.extraParams })\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"authorize.js","names":["convertTokenParamsToOAuthParams","tokenParams","clientId","AuthSdkError","isString","responseType","indexOf","oauthParams","codeChallenge","codeChallengeMethod","display","idp","idpScope","loginHint","maxAge","nonce","prompt","redirectUri","responseMode","sessionToken","state","acrValues","removeNils","forEach","mayBeArray","Array","isArray","join","scopes","scope","buildAuthorizeParams","oauthQueryParams","toQueryString","extraParams"],"sources":["../../../../lib/oidc/endpoints/authorize.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\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\n\nimport { isString, removeNils, toQueryString } from '../../util';\nimport { AuthSdkError } from '../../errors';\nimport { OAuthParams, TokenParams } from '../types';\n\nexport function convertTokenParamsToOAuthParams(tokenParams: TokenParams) {\n // Quick validation\n if (!tokenParams.clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');\n }\n\n if (isString(tokenParams.responseType) && tokenParams.responseType.indexOf(' ') !== -1) {\n throw new AuthSdkError('Multiple OAuth responseTypes must be defined as an array');\n }\n\n // Convert our params to their actual OAuth equivalents\n var oauthParams: OAuthParams = {\n 'client_id': tokenParams.clientId,\n 'code_challenge': tokenParams.codeChallenge,\n 'code_challenge_method': tokenParams.codeChallengeMethod,\n 'display': tokenParams.display,\n 'idp': tokenParams.idp,\n 'idp_scope': tokenParams.idpScope,\n 'login_hint': tokenParams.loginHint,\n 'max_age': tokenParams.maxAge,\n 'nonce': tokenParams.nonce,\n 'prompt': tokenParams.prompt,\n 'redirect_uri': tokenParams.redirectUri,\n 'response_mode': tokenParams.responseMode,\n 'response_type': tokenParams.responseType,\n 'sessionToken': tokenParams.sessionToken,\n 'state': tokenParams.state,\n 'acr_values': tokenParams.acrValues,\n };\n oauthParams = removeNils(oauthParams) as OAuthParams;\n\n ['idp_scope', 'response_type'].forEach(function (mayBeArray) {\n if (Array.isArray(oauthParams[mayBeArray])) {\n oauthParams[mayBeArray] = oauthParams[mayBeArray].join(' ');\n }\n });\n\n if (tokenParams.responseType!.indexOf('id_token') !== -1 &&\n tokenParams.scopes!.indexOf('openid') === -1) {\n throw new AuthSdkError('openid scope must be specified in the scopes argument when requesting an id_token');\n } else {\n oauthParams.scope = tokenParams.scopes!.join(' ');\n }\n\n return oauthParams;\n}\n\nexport function buildAuthorizeParams(tokenParams: TokenParams) {\n var oauthQueryParams = convertTokenParamsToOAuthParams(tokenParams);\n return toQueryString({ \n ...oauthQueryParams, \n ...(tokenParams.extraParams && { ...tokenParams.extraParams })\n });\n}\n"],"mappings":";;;;AAcA;AACA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOO,SAASA,+BAA+B,CAACC,WAAwB,EAAE;EACxE;EACA,IAAI,CAACA,WAAW,CAACC,QAAQ,EAAE;IACzB,MAAM,IAAIC,oBAAY,CAAC,yEAAyE,CAAC;EACnG;EAEA,IAAI,IAAAC,cAAQ,EAACH,WAAW,CAACI,YAAY,CAAC,IAAIJ,WAAW,CAACI,YAAY,CAACC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;IACtF,MAAM,IAAIH,oBAAY,CAAC,0DAA0D,CAAC;EACpF;;EAEA;EACA,IAAII,WAAwB,GAAG;IAC7B,WAAW,EAAEN,WAAW,CAACC,QAAQ;IACjC,gBAAgB,EAAED,WAAW,CAACO,aAAa;IAC3C,uBAAuB,EAAEP,WAAW,CAACQ,mBAAmB;IACxD,SAAS,EAAER,WAAW,CAACS,OAAO;IAC9B,KAAK,EAAET,WAAW,CAACU,GAAG;IACtB,WAAW,EAAEV,WAAW,CAACW,QAAQ;IACjC,YAAY,EAAEX,WAAW,CAACY,SAAS;IACnC,SAAS,EAAEZ,WAAW,CAACa,MAAM;IAC7B,OAAO,EAAEb,WAAW,CAACc,KAAK;IAC1B,QAAQ,EAAEd,WAAW,CAACe,MAAM;IAC5B,cAAc,EAAEf,WAAW,CAACgB,WAAW;IACvC,eAAe,EAAEhB,WAAW,CAACiB,YAAY;IACzC,eAAe,EAAEjB,WAAW,CAACI,YAAY;IACzC,cAAc,EAAEJ,WAAW,CAACkB,YAAY;IACxC,OAAO,EAAElB,WAAW,CAACmB,KAAK;IAC1B,YAAY,EAAEnB,WAAW,CAACoB;EAC5B,CAAC;EACDd,WAAW,GAAG,IAAAe,gBAAU,EAACf,WAAW,CAAgB;EAEpD,CAAC,WAAW,EAAE,eAAe,CAAC,CAACgB,OAAO,CAAC,UAAUC,UAAU,EAAE;IAC3D,IAAIC,KAAK,CAACC,OAAO,CAACnB,WAAW,CAACiB,UAAU,CAAC,CAAC,EAAE;MAC1CjB,WAAW,CAACiB,UAAU,CAAC,GAAGjB,WAAW,CAACiB,UAAU,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAC7D;EACF,CAAC,CAAC;EAEF,IAAI1B,WAAW,CAACI,YAAY,CAAEC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IACtDL,WAAW,CAAC2B,MAAM,CAAEtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;IAC9C,MAAM,IAAIH,oBAAY,CAAC,mFAAmF,CAAC;EAC7G,CAAC,MAAM;IACLI,WAAW,CAACsB,KAAK,GAAG5B,WAAW,CAAC2B,MAAM,CAAED,IAAI,CAAC,GAAG,CAAC;EACnD;EAEA,OAAOpB,WAAW;AACpB;AAEO,SAASuB,oBAAoB,CAAC7B,WAAwB,EAAE;EAC7D,IAAI8B,gBAAgB,GAAG/B,+BAA+B,CAACC,WAAW,CAAC;EACnE,OAAO,IAAA+B,mBAAa,EAAC;IACnB,GAAGD,gBAAgB;IACnB,IAAI9B,WAAW,CAACgC,WAAW,IAAI;MAAE,GAAGhC,WAAW,CAACgC;IAAY,CAAC;EAC/D,CAAC,CAAC;AACJ"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _authorize = require("./authorize");
|
|
4
|
-
|
|
5
4
|
Object.keys(_authorize).forEach(function (key) {
|
|
6
5
|
if (key === "default" || key === "__esModule") return;
|
|
7
6
|
if (key in exports && exports[key] === _authorize[key]) return;
|
|
@@ -12,9 +11,7 @@ Object.keys(_authorize).forEach(function (key) {
|
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
13
|
});
|
|
15
|
-
|
|
16
14
|
var _token = require("./token");
|
|
17
|
-
|
|
18
15
|
Object.keys(_token).forEach(function (key) {
|
|
19
16
|
if (key === "default" || key === "__esModule") return;
|
|
20
17
|
if (key in exports && exports[key] === _token[key]) return;
|
|
@@ -25,9 +22,7 @@ Object.keys(_token).forEach(function (key) {
|
|
|
25
22
|
}
|
|
26
23
|
});
|
|
27
24
|
});
|
|
28
|
-
|
|
29
25
|
var _wellKnown = require("./well-known");
|
|
30
|
-
|
|
31
26
|
Object.keys(_wellKnown).forEach(function (key) {
|
|
32
27
|
if (key === "default" || key === "__esModule") return;
|
|
33
28
|
if (key in exports && exports[key] === _wellKnown[key]) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/oidc/endpoints/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nexport * from './authorize';\nexport * from './token';\nexport * from './well-known';\n"],"mappings":";;AAaA
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../lib/oidc/endpoints/index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nexport * from './authorize';\nexport * from './token';\nexport * from './well-known';\n"],"mappings":";;AAaA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.postRefreshToken = postRefreshToken;
|
|
4
4
|
exports.postToTokenEndpoint = postToTokenEndpoint;
|
|
5
|
-
|
|
6
5
|
var _errors = require("../../errors");
|
|
7
|
-
|
|
8
6
|
var _util = require("../../util");
|
|
9
|
-
|
|
10
7
|
var _http = require("../../http");
|
|
11
|
-
|
|
12
8
|
/*!
|
|
13
9
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
14
10
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -20,25 +16,22 @@ var _http = require("../../http");
|
|
|
20
16
|
*
|
|
21
17
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
22
18
|
*/
|
|
19
|
+
|
|
23
20
|
function validateOptions(options) {
|
|
24
21
|
// Quick validation
|
|
25
22
|
if (!options.clientId) {
|
|
26
23
|
throw new _errors.AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
if (!options.redirectUri) {
|
|
30
26
|
throw new _errors.AuthSdkError('The redirectUri passed to /authorize must also be passed to /token');
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
if (!options.authorizationCode && !options.interactionCode) {
|
|
34
29
|
throw new _errors.AuthSdkError('An authorization code (returned from /authorize) must be passed to /token');
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
if (!options.codeVerifier) {
|
|
38
32
|
throw new _errors.AuthSdkError('The "codeVerifier" (generated and saved by your app) must be passed to /token');
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
function getPostData(sdk, options) {
|
|
43
36
|
// Convert Token params to OAuth params, sent to the /token endpoint
|
|
44
37
|
var params = (0, _util.removeNils)({
|
|
@@ -47,26 +40,23 @@ function getPostData(sdk, options) {
|
|
|
47
40
|
'grant_type': options.interactionCode ? 'interaction_code' : 'authorization_code',
|
|
48
41
|
'code_verifier': options.codeVerifier
|
|
49
42
|
});
|
|
50
|
-
|
|
51
43
|
if (options.interactionCode) {
|
|
52
44
|
params['interaction_code'] = options.interactionCode;
|
|
53
45
|
} else if (options.authorizationCode) {
|
|
54
46
|
params.code = options.authorizationCode;
|
|
55
47
|
}
|
|
56
|
-
|
|
57
48
|
const {
|
|
58
49
|
clientSecret
|
|
59
50
|
} = sdk.options;
|
|
60
|
-
|
|
61
51
|
if (clientSecret) {
|
|
62
52
|
params['client_secret'] = clientSecret;
|
|
63
|
-
}
|
|
64
|
-
|
|
53
|
+
}
|
|
65
54
|
|
|
55
|
+
// Encode as URL string
|
|
66
56
|
return (0, _util.toQueryString)(params).slice(1);
|
|
67
|
-
}
|
|
68
|
-
|
|
57
|
+
}
|
|
69
58
|
|
|
59
|
+
// exchange authorization code for an access token
|
|
70
60
|
function postToTokenEndpoint(sdk, options, urls) {
|
|
71
61
|
validateOptions(options);
|
|
72
62
|
var data = getPostData(sdk, options);
|
|
@@ -80,7 +70,6 @@ function postToTokenEndpoint(sdk, options, urls) {
|
|
|
80
70
|
headers
|
|
81
71
|
});
|
|
82
72
|
}
|
|
83
|
-
|
|
84
73
|
function postRefreshToken(sdk, options, refreshToken) {
|
|
85
74
|
return (0, _http.httpRequest)(sdk, {
|
|
86
75
|
url: refreshToken.tokenUrl,
|
|
@@ -95,7 +84,6 @@ function postRefreshToken(sdk, options, refreshToken) {
|
|
|
95
84
|
// eslint-disable-line camelcase
|
|
96
85
|
scope: refreshToken.scopes.join(' '),
|
|
97
86
|
refresh_token: refreshToken.refreshToken // eslint-disable-line camelcase
|
|
98
|
-
|
|
99
87
|
}).map(function ([name, value]) {
|
|
100
88
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
101
89
|
return name + '=' + encodeURIComponent(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","names":["validateOptions","options","clientId","AuthSdkError","redirectUri","authorizationCode","interactionCode","codeVerifier","getPostData","sdk","params","removeNils","code","clientSecret","toQueryString","slice","postToTokenEndpoint","urls","data","headers","httpRequest","url","tokenUrl","method","args","postRefreshToken","refreshToken","Object","entries","client_id","grant_type","scope","scopes","join","refresh_token","map","name","value","encodeURIComponent"],"sources":["../../../../lib/oidc/endpoints/token.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { AuthSdkError } from '../../errors';\nimport { CustomUrls, OAuthParams, OAuthResponse, RefreshToken, TokenParams } from '../types';\nimport { removeNils, toQueryString } from '../../util';\nimport { httpRequest, OktaAuthHttpInterface } from '../../http';\n\nfunction validateOptions(options: TokenParams) {\n // Quick validation\n if (!options.clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');\n }\n\n if (!options.redirectUri) {\n throw new AuthSdkError('The redirectUri passed to /authorize must also be passed to /token');\n }\n\n if (!options.authorizationCode && !options.interactionCode) {\n throw new AuthSdkError('An authorization code (returned from /authorize) must be passed to /token');\n }\n\n if (!options.codeVerifier) {\n throw new AuthSdkError('The \"codeVerifier\" (generated and saved by your app) must be passed to /token');\n }\n}\n\nfunction getPostData(sdk, options: TokenParams): string {\n // Convert Token params to OAuth params, sent to the /token endpoint\n var params: OAuthParams = removeNils({\n 'client_id': options.clientId,\n 'redirect_uri': options.redirectUri,\n 'grant_type': options.interactionCode ? 'interaction_code' : 'authorization_code',\n 'code_verifier': options.codeVerifier\n });\n\n if (options.interactionCode) {\n params['interaction_code'] = options.interactionCode;\n } else if (options.authorizationCode) {\n params.code = options.authorizationCode;\n }\n\n const { clientSecret } = sdk.options;\n if (clientSecret) {\n params['client_secret'] = clientSecret;\n }\n\n // Encode as URL string\n return toQueryString(params).slice(1);\n}\n\n// exchange authorization code for an access token\nexport function postToTokenEndpoint(sdk, options: TokenParams, urls: CustomUrls): Promise<OAuthResponse> {\n validateOptions(options);\n var data = getPostData(sdk, options);\n\n const headers = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n };\n\n return httpRequest(sdk, {\n url: urls.tokenUrl,\n method: 'POST',\n args: data,\n headers\n });\n}\n\nexport function postRefreshToken(\n sdk: OktaAuthHttpInterface,\n options: TokenParams,\n refreshToken: RefreshToken\n): Promise<OAuthResponse> {\n return httpRequest(sdk, {\n url: refreshToken.tokenUrl,\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n\n args: Object.entries({\n client_id: options.clientId, // eslint-disable-line camelcase\n grant_type: 'refresh_token', // eslint-disable-line camelcase\n scope: refreshToken.scopes.join(' '),\n refresh_token: refreshToken.refreshToken, // eslint-disable-line camelcase\n }).map(function ([name, value]) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return name + '=' + encodeURIComponent(value!);\n }).join('&'),\n });\n}"],"mappings":"
|
|
1
|
+
{"version":3,"file":"token.js","names":["validateOptions","options","clientId","AuthSdkError","redirectUri","authorizationCode","interactionCode","codeVerifier","getPostData","sdk","params","removeNils","code","clientSecret","toQueryString","slice","postToTokenEndpoint","urls","data","headers","httpRequest","url","tokenUrl","method","args","postRefreshToken","refreshToken","Object","entries","client_id","grant_type","scope","scopes","join","refresh_token","map","name","value","encodeURIComponent"],"sources":["../../../../lib/oidc/endpoints/token.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { AuthSdkError } from '../../errors';\nimport { CustomUrls, OAuthParams, OAuthResponse, RefreshToken, TokenParams } from '../types';\nimport { removeNils, toQueryString } from '../../util';\nimport { httpRequest, OktaAuthHttpInterface } from '../../http';\n\nfunction validateOptions(options: TokenParams) {\n // Quick validation\n if (!options.clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');\n }\n\n if (!options.redirectUri) {\n throw new AuthSdkError('The redirectUri passed to /authorize must also be passed to /token');\n }\n\n if (!options.authorizationCode && !options.interactionCode) {\n throw new AuthSdkError('An authorization code (returned from /authorize) must be passed to /token');\n }\n\n if (!options.codeVerifier) {\n throw new AuthSdkError('The \"codeVerifier\" (generated and saved by your app) must be passed to /token');\n }\n}\n\nfunction getPostData(sdk, options: TokenParams): string {\n // Convert Token params to OAuth params, sent to the /token endpoint\n var params: OAuthParams = removeNils({\n 'client_id': options.clientId,\n 'redirect_uri': options.redirectUri,\n 'grant_type': options.interactionCode ? 'interaction_code' : 'authorization_code',\n 'code_verifier': options.codeVerifier\n });\n\n if (options.interactionCode) {\n params['interaction_code'] = options.interactionCode;\n } else if (options.authorizationCode) {\n params.code = options.authorizationCode;\n }\n\n const { clientSecret } = sdk.options;\n if (clientSecret) {\n params['client_secret'] = clientSecret;\n }\n\n // Encode as URL string\n return toQueryString(params).slice(1);\n}\n\n// exchange authorization code for an access token\nexport function postToTokenEndpoint(sdk, options: TokenParams, urls: CustomUrls): Promise<OAuthResponse> {\n validateOptions(options);\n var data = getPostData(sdk, options);\n\n const headers = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n };\n\n return httpRequest(sdk, {\n url: urls.tokenUrl,\n method: 'POST',\n args: data,\n headers\n });\n}\n\nexport function postRefreshToken(\n sdk: OktaAuthHttpInterface,\n options: TokenParams,\n refreshToken: RefreshToken\n): Promise<OAuthResponse> {\n return httpRequest(sdk, {\n url: refreshToken.tokenUrl,\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n\n args: Object.entries({\n client_id: options.clientId, // eslint-disable-line camelcase\n grant_type: 'refresh_token', // eslint-disable-line camelcase\n scope: refreshToken.scopes.join(' '),\n refresh_token: refreshToken.refreshToken, // eslint-disable-line camelcase\n }).map(function ([name, value]) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return name + '=' + encodeURIComponent(value!);\n }).join('&'),\n });\n}"],"mappings":"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"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.getKey = getKey;
|
|
6
5
|
exports.getWellKnown = getWellKnown;
|
|
7
|
-
|
|
8
6
|
var _http = require("../../http");
|
|
9
|
-
|
|
10
7
|
var _util = require("../../util");
|
|
11
|
-
|
|
12
8
|
var _AuthSdkError = _interopRequireDefault(require("../../errors/AuthSdkError"));
|
|
13
|
-
|
|
14
9
|
/*!
|
|
15
10
|
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
16
11
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -23,45 +18,43 @@ var _AuthSdkError = _interopRequireDefault(require("../../errors/AuthSdkError"))
|
|
|
23
18
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
24
19
|
*
|
|
25
20
|
*/
|
|
21
|
+
|
|
26
22
|
function getWellKnown(sdk, issuer) {
|
|
27
23
|
var authServerUri = issuer || sdk.options.issuer;
|
|
28
24
|
return (0, _http.get)(sdk, authServerUri + '/.well-known/openid-configuration', {
|
|
29
25
|
cacheResponse: true
|
|
30
26
|
});
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
function getKey(sdk, issuer, kid) {
|
|
34
29
|
var httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);
|
|
35
30
|
return getWellKnown(sdk, issuer).then(function (wellKnown) {
|
|
36
|
-
var jwksUri = wellKnown['jwks_uri'];
|
|
31
|
+
var jwksUri = wellKnown['jwks_uri'];
|
|
37
32
|
|
|
33
|
+
// Check our kid against the cached version (if it exists and isn't expired)
|
|
38
34
|
var cacheContents = httpCache.getStorage();
|
|
39
35
|
var cachedResponse = cacheContents[jwksUri];
|
|
40
|
-
|
|
41
36
|
if (cachedResponse && Date.now() / 1000 < cachedResponse.expiresAt) {
|
|
42
37
|
var cachedKey = (0, _util.find)(cachedResponse.response.keys, {
|
|
43
38
|
kid: kid
|
|
44
39
|
});
|
|
45
|
-
|
|
46
40
|
if (cachedKey) {
|
|
47
41
|
return cachedKey;
|
|
48
42
|
}
|
|
49
|
-
}
|
|
43
|
+
}
|
|
50
44
|
|
|
45
|
+
// Remove cache for the key
|
|
46
|
+
httpCache.clearStorage(jwksUri);
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
// Pull the latest keys if the key wasn't in the cache
|
|
54
49
|
return (0, _http.get)(sdk, jwksUri, {
|
|
55
50
|
cacheResponse: true
|
|
56
51
|
}).then(function (res) {
|
|
57
52
|
var key = (0, _util.find)(res.keys, {
|
|
58
53
|
kid: kid
|
|
59
54
|
});
|
|
60
|
-
|
|
61
55
|
if (key) {
|
|
62
56
|
return key;
|
|
63
57
|
}
|
|
64
|
-
|
|
65
58
|
throw new _AuthSdkError.default('The key id, ' + kid + ', was not found in the server\'s keys');
|
|
66
59
|
});
|
|
67
60
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"well-known.js","names":["getWellKnown","sdk","issuer","authServerUri","options","get","cacheResponse","getKey","kid","httpCache","storageManager","getHttpCache","cookies","then","wellKnown","jwksUri","cacheContents","getStorage","cachedResponse","Date","now","expiresAt","cachedKey","find","response","keys","clearStorage","res","key","AuthSdkError"],"sources":["../../../../lib/oidc/endpoints/well-known.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 { get } from '../../http';\nimport { find } from '../../util';\nimport { OktaAuthOAuthInterface, WellKnownResponse } from '../types';\nimport AuthSdkError from '../../errors/AuthSdkError';\n\nexport function getWellKnown(sdk: OktaAuthOAuthInterface, issuer?: string): Promise<WellKnownResponse> {\n var authServerUri = (issuer || sdk.options.issuer);\n return get(sdk, authServerUri + '/.well-known/openid-configuration', {\n cacheResponse: true\n });\n}\n\nexport function getKey(sdk: OktaAuthOAuthInterface, issuer: string, kid: string): Promise<string> {\n var httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);\n\n return getWellKnown(sdk, issuer)\n .then(function(wellKnown) {\n var jwksUri = wellKnown['jwks_uri'];\n\n // Check our kid against the cached version (if it exists and isn't expired)\n var cacheContents = httpCache.getStorage();\n var cachedResponse = cacheContents[jwksUri];\n if (cachedResponse && Date.now()/1000 < cachedResponse.expiresAt) {\n var cachedKey = find(cachedResponse.response.keys, {\n kid: kid\n });\n\n if (cachedKey) {\n return cachedKey;\n }\n }\n\n // Remove cache for the key\n httpCache.clearStorage(jwksUri);\n\n // Pull the latest keys if the key wasn't in the cache\n return get(sdk, jwksUri, {\n cacheResponse: true\n })\n .then(function(res) {\n var key = find(res.keys, {\n kid: kid\n });\n\n if (key) {\n return key;\n }\n\n throw new AuthSdkError('The key id, ' + kid + ', was not found in the server\\'s keys');\n });\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"well-known.js","names":["getWellKnown","sdk","issuer","authServerUri","options","get","cacheResponse","getKey","kid","httpCache","storageManager","getHttpCache","cookies","then","wellKnown","jwksUri","cacheContents","getStorage","cachedResponse","Date","now","expiresAt","cachedKey","find","response","keys","clearStorage","res","key","AuthSdkError"],"sources":["../../../../lib/oidc/endpoints/well-known.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 { get } from '../../http';\nimport { find } from '../../util';\nimport { OktaAuthOAuthInterface, WellKnownResponse } from '../types';\nimport AuthSdkError from '../../errors/AuthSdkError';\n\nexport function getWellKnown(sdk: OktaAuthOAuthInterface, issuer?: string): Promise<WellKnownResponse> {\n var authServerUri = (issuer || sdk.options.issuer);\n return get(sdk, authServerUri + '/.well-known/openid-configuration', {\n cacheResponse: true\n });\n}\n\nexport function getKey(sdk: OktaAuthOAuthInterface, issuer: string, kid: string): Promise<string> {\n var httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);\n\n return getWellKnown(sdk, issuer)\n .then(function(wellKnown) {\n var jwksUri = wellKnown['jwks_uri'];\n\n // Check our kid against the cached version (if it exists and isn't expired)\n var cacheContents = httpCache.getStorage();\n var cachedResponse = cacheContents[jwksUri];\n if (cachedResponse && Date.now()/1000 < cachedResponse.expiresAt) {\n var cachedKey = find(cachedResponse.response.keys, {\n kid: kid\n });\n\n if (cachedKey) {\n return cachedKey;\n }\n }\n\n // Remove cache for the key\n httpCache.clearStorage(jwksUri);\n\n // Pull the latest keys if the key wasn't in the cache\n return get(sdk, jwksUri, {\n cacheResponse: true\n })\n .then(function(res) {\n var key = find(res.keys, {\n kid: kid\n });\n\n if (key) {\n return key;\n }\n\n throw new AuthSdkError('The key id, ' + kid + ', was not found in the server\\'s keys');\n });\n });\n}\n"],"mappings":";;;;;AAYA;AACA;AAEA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,SAASA,YAAY,CAACC,GAA2B,EAAEC,MAAe,EAA8B;EACrG,IAAIC,aAAa,GAAID,MAAM,IAAID,GAAG,CAACG,OAAO,CAACF,MAAO;EAClD,OAAO,IAAAG,SAAG,EAACJ,GAAG,EAAEE,aAAa,GAAG,mCAAmC,EAAE;IACnEG,aAAa,EAAE;EACjB,CAAC,CAAC;AACJ;AAEO,SAASC,MAAM,CAACN,GAA2B,EAAEC,MAAc,EAAEM,GAAW,EAAmB;EAChG,IAAIC,SAAS,GAAGR,GAAG,CAACS,cAAc,CAACC,YAAY,CAACV,GAAG,CAACG,OAAO,CAACQ,OAAO,CAAC;EAEpE,OAAOZ,YAAY,CAACC,GAAG,EAAEC,MAAM,CAAC,CAC/BW,IAAI,CAAC,UAASC,SAAS,EAAE;IACxB,IAAIC,OAAO,GAAGD,SAAS,CAAC,UAAU,CAAC;;IAEnC;IACA,IAAIE,aAAa,GAAGP,SAAS,CAACQ,UAAU,EAAE;IAC1C,IAAIC,cAAc,GAAGF,aAAa,CAACD,OAAO,CAAC;IAC3C,IAAIG,cAAc,IAAIC,IAAI,CAACC,GAAG,EAAE,GAAC,IAAI,GAAGF,cAAc,CAACG,SAAS,EAAE;MAChE,IAAIC,SAAS,GAAG,IAAAC,UAAI,EAACL,cAAc,CAACM,QAAQ,CAACC,IAAI,EAAE;QACjDjB,GAAG,EAAEA;MACP,CAAC,CAAC;MAEF,IAAIc,SAAS,EAAE;QACb,OAAOA,SAAS;MAClB;IACF;;IAEA;IACAb,SAAS,CAACiB,YAAY,CAACX,OAAO,CAAC;;IAE/B;IACA,OAAO,IAAAV,SAAG,EAACJ,GAAG,EAAEc,OAAO,EAAE;MACvBT,aAAa,EAAE;IACjB,CAAC,CAAC,CACDO,IAAI,CAAC,UAASc,GAAG,EAAE;MAClB,IAAIC,GAAG,GAAG,IAAAL,UAAI,EAACI,GAAG,CAACF,IAAI,EAAE;QACvBjB,GAAG,EAAEA;MACP,CAAC,CAAC;MAEF,IAAIoB,GAAG,EAAE;QACP,OAAOA,GAAG;MACZ;MAEA,MAAM,IAAIC,qBAAY,CAAC,cAAc,GAAGrB,GAAG,GAAG,uCAAuC,CAAC;IACxF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ"}
|