@okta/okta-auth-js 7.6.0 → 7.7.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 +15 -0
- package/README.md +142 -0
- package/cjs/base/types.js.map +1 -1
- package/cjs/errors/OAuthError.js +9 -1
- package/cjs/errors/OAuthError.js.map +1 -1
- package/cjs/errors/WWWAuthError.js +98 -0
- package/cjs/errors/WWWAuthError.js.map +1 -0
- package/cjs/errors/index.js +14 -1
- package/cjs/errors/index.js.map +1 -1
- package/cjs/features.js +10 -1
- package/cjs/features.js.map +1 -1
- package/cjs/http/OktaUserAgent.js +2 -2
- package/cjs/http/request.js +24 -25
- package/cjs/http/request.js.map +1 -1
- package/cjs/idx/IdxTransactionManager.js +5 -0
- package/cjs/idx/IdxTransactionManager.js.map +1 -1
- package/cjs/idx/run.js +6 -3
- package/cjs/idx/run.js.map +1 -1
- package/cjs/idx/types/options.js.map +1 -1
- package/cjs/oidc/dpop.js +231 -0
- package/cjs/oidc/dpop.js.map +1 -0
- package/cjs/oidc/endpoints/token.js +82 -28
- package/cjs/oidc/endpoints/token.js.map +1 -1
- package/cjs/oidc/exchangeCodeForTokens.js +53 -28
- package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
- package/cjs/oidc/getUserInfo.js +32 -17
- package/cjs/oidc/getUserInfo.js.map +1 -1
- package/cjs/oidc/handleOAuthResponse.js +21 -0
- package/cjs/oidc/handleOAuthResponse.js.map +1 -1
- package/cjs/oidc/mixin/index.js +63 -2
- package/cjs/oidc/mixin/index.js.map +1 -1
- package/cjs/oidc/options/OAuthOptionsConstructor.js +2 -0
- package/cjs/oidc/options/OAuthOptionsConstructor.js.map +1 -1
- package/cjs/oidc/renewToken.js +6 -2
- package/cjs/oidc/renewToken.js.map +1 -1
- package/cjs/oidc/renewTokens.js +5 -1
- package/cjs/oidc/renewTokens.js.map +1 -1
- package/cjs/oidc/renewTokensWithRefresh.js +17 -2
- package/cjs/oidc/renewTokensWithRefresh.js.map +1 -1
- package/cjs/oidc/types/Token.js.map +1 -1
- package/cjs/oidc/types/api.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/util/defaultTokenParams.js +4 -2
- package/cjs/oidc/util/defaultTokenParams.js.map +1 -1
- package/cjs/oidc/util/oauthMeta.js +2 -1
- package/cjs/oidc/util/oauthMeta.js.map +1 -1
- package/cjs/oidc/util/prepareTokenParams.js +3 -0
- package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
- package/dist/okta-auth-js.authn.min.analyzer.html +2 -2
- package/dist/okta-auth-js.authn.min.js +1 -1
- package/dist/okta-auth-js.authn.min.js.map +1 -1
- package/dist/okta-auth-js.core.min.analyzer.html +2 -2
- package/dist/okta-auth-js.core.min.js +1 -1
- package/dist/okta-auth-js.core.min.js.map +1 -1
- package/dist/okta-auth-js.idx.min.analyzer.html +2 -2
- package/dist/okta-auth-js.idx.min.js +1 -1
- package/dist/okta-auth-js.idx.min.js.map +1 -1
- package/dist/okta-auth-js.min.analyzer.html +2 -2
- package/dist/okta-auth-js.min.js +1 -1
- package/dist/okta-auth-js.min.js.map +1 -1
- package/dist/okta-auth-js.myaccount.min.analyzer.html +2 -2
- package/dist/okta-auth-js.myaccount.min.js +1 -1
- package/dist/okta-auth-js.myaccount.min.js.map +1 -1
- package/esm/browser/authn/api.js +1 -0
- package/esm/browser/authn/api.js.map +1 -1
- package/esm/browser/authn/util/link2fn.js +1 -0
- package/esm/browser/authn/util/link2fn.js.map +1 -1
- package/esm/browser/authn/util/poll.js +1 -0
- package/esm/browser/authn/util/poll.js.map +1 -1
- package/esm/browser/browser/fingerprint.js +1 -0
- package/esm/browser/browser/fingerprint.js.map +1 -1
- package/esm/browser/core/AuthStateManager.js +1 -0
- package/esm/browser/core/AuthStateManager.js.map +1 -1
- package/esm/browser/core/options.js +1 -0
- package/esm/browser/core/options.js.map +1 -1
- package/esm/browser/crypto/base64.js +1 -0
- package/esm/browser/crypto/base64.js.map +1 -1
- package/esm/browser/errors/OAuthError.js +5 -1
- package/esm/browser/errors/OAuthError.js.map +1 -1
- package/esm/browser/errors/WWWAuthError.js +61 -0
- package/esm/browser/errors/WWWAuthError.js.map +1 -0
- package/esm/browser/errors/index.js +6 -1
- package/esm/browser/errors/index.js.map +1 -1
- package/esm/browser/exports/exports/authn.js +2 -1
- package/esm/browser/exports/exports/authn.js.map +1 -1
- package/esm/browser/exports/exports/core.js +2 -1
- package/esm/browser/exports/exports/core.js.map +1 -1
- package/esm/browser/exports/exports/default.js +2 -1
- package/esm/browser/exports/exports/default.js.map +1 -1
- package/esm/browser/exports/exports/idx.js +2 -1
- package/esm/browser/exports/exports/idx.js.map +1 -1
- package/esm/browser/exports/exports/myaccount.js +2 -1
- package/esm/browser/exports/exports/myaccount.js.map +1 -1
- package/esm/browser/features.js +12 -2
- package/esm/browser/features.js.map +1 -1
- package/esm/browser/http/OktaUserAgent.js +2 -2
- package/esm/browser/http/options.js +1 -0
- package/esm/browser/http/options.js.map +1 -1
- package/esm/browser/http/request.js +14 -25
- package/esm/browser/http/request.js.map +1 -1
- package/esm/browser/idx/IdxTransactionManager.js +4 -1
- package/esm/browser/idx/IdxTransactionManager.js.map +1 -1
- package/esm/browser/idx/cancel.js +1 -0
- package/esm/browser/idx/cancel.js.map +1 -1
- package/esm/browser/idx/factory/api.js +1 -0
- package/esm/browser/idx/factory/api.js.map +1 -1
- package/esm/browser/idx/flow/AccountUnlockFlow.js +1 -0
- package/esm/browser/idx/flow/AccountUnlockFlow.js.map +1 -1
- package/esm/browser/idx/flow/AuthenticationFlow.js +1 -0
- package/esm/browser/idx/flow/AuthenticationFlow.js.map +1 -1
- package/esm/browser/idx/flow/PasswordRecoveryFlow.js +1 -0
- package/esm/browser/idx/flow/PasswordRecoveryFlow.js.map +1 -1
- package/esm/browser/idx/flow/RegistrationFlow.js +1 -0
- package/esm/browser/idx/flow/RegistrationFlow.js.map +1 -1
- package/esm/browser/idx/handleInteractionCodeRedirect.js +1 -0
- package/esm/browser/idx/handleInteractionCodeRedirect.js.map +1 -1
- package/esm/browser/idx/idxState/v1/generateIdxAction.js +1 -0
- package/esm/browser/idx/idxState/v1/generateIdxAction.js.map +1 -1
- package/esm/browser/idx/idxState/v1/idxResponseParser.js +1 -0
- package/esm/browser/idx/idxState/v1/idxResponseParser.js.map +1 -1
- package/esm/browser/idx/interact.js +1 -0
- package/esm/browser/idx/interact.js.map +1 -1
- package/esm/browser/idx/proceed.js +1 -0
- package/esm/browser/idx/proceed.js.map +1 -1
- package/esm/browser/idx/recoverPassword.js +1 -0
- package/esm/browser/idx/recoverPassword.js.map +1 -1
- package/esm/browser/idx/register.js +1 -0
- package/esm/browser/idx/register.js.map +1 -1
- package/esm/browser/idx/remediate.js +1 -0
- package/esm/browser/idx/remediate.js.map +1 -1
- package/esm/browser/idx/remediators/GenericRemediator/util.js +2 -0
- package/esm/browser/idx/remediators/GenericRemediator/util.js.map +1 -1
- package/esm/browser/idx/run.js +3 -3
- package/esm/browser/idx/run.js.map +1 -1
- package/esm/browser/idx/transactionMeta.js +1 -0
- package/esm/browser/idx/transactionMeta.js.map +1 -1
- package/esm/browser/idx/unlockAccount.js +1 -0
- package/esm/browser/idx/unlockAccount.js.map +1 -1
- package/esm/browser/myaccount/request.js +1 -0
- package/esm/browser/myaccount/request.js.map +1 -1
- package/esm/browser/oidc/TokenManager.js +1 -0
- package/esm/browser/oidc/TokenManager.js.map +1 -1
- package/esm/browser/oidc/decodeToken.js +1 -0
- package/esm/browser/oidc/decodeToken.js.map +1 -1
- package/esm/browser/oidc/dpop.js +160 -0
- package/esm/browser/oidc/dpop.js.map +1 -0
- package/esm/browser/oidc/endpoints/authorize.js +1 -0
- package/esm/browser/oidc/endpoints/authorize.js.map +1 -1
- package/esm/browser/oidc/endpoints/token.js +62 -25
- package/esm/browser/oidc/endpoints/token.js.map +1 -1
- package/esm/browser/oidc/endpoints/well-known.js +1 -0
- package/esm/browser/oidc/endpoints/well-known.js.map +1 -1
- package/esm/browser/oidc/enrollAuthenticator.js +1 -0
- package/esm/browser/oidc/enrollAuthenticator.js.map +1 -1
- package/esm/browser/oidc/exchangeCodeForTokens.js +41 -25
- package/esm/browser/oidc/exchangeCodeForTokens.js.map +1 -1
- package/esm/browser/oidc/factory/api.js +1 -0
- package/esm/browser/oidc/factory/api.js.map +1 -1
- package/esm/browser/oidc/factory/baseApi.js +1 -0
- package/esm/browser/oidc/factory/baseApi.js.map +1 -1
- package/esm/browser/oidc/getToken.js +1 -0
- package/esm/browser/oidc/getToken.js.map +1 -1
- package/esm/browser/oidc/getUserInfo.js +22 -18
- package/esm/browser/oidc/getUserInfo.js.map +1 -1
- package/esm/browser/oidc/getWithPopup.js +1 -0
- package/esm/browser/oidc/getWithPopup.js.map +1 -1
- package/esm/browser/oidc/getWithRedirect.js +1 -0
- package/esm/browser/oidc/getWithRedirect.js.map +1 -1
- package/esm/browser/oidc/getWithoutPrompt.js +1 -0
- package/esm/browser/oidc/getWithoutPrompt.js.map +1 -1
- package/esm/browser/oidc/handleOAuthResponse.js +19 -0
- package/esm/browser/oidc/handleOAuthResponse.js.map +1 -1
- package/esm/browser/oidc/introspect.js +1 -0
- package/esm/browser/oidc/introspect.js.map +1 -1
- package/esm/browser/oidc/mixin/index.js +62 -2
- package/esm/browser/oidc/mixin/index.js.map +1 -1
- package/esm/browser/oidc/mixin/minimal.js +1 -0
- package/esm/browser/oidc/mixin/minimal.js.map +1 -1
- package/esm/browser/oidc/options/OAuthOptionsConstructor.js +1 -0
- package/esm/browser/oidc/options/OAuthOptionsConstructor.js.map +1 -1
- package/esm/browser/oidc/parseFromUrl.js +1 -0
- package/esm/browser/oidc/parseFromUrl.js.map +1 -1
- package/esm/browser/oidc/renewToken.js +5 -2
- package/esm/browser/oidc/renewToken.js.map +1 -1
- package/esm/browser/oidc/renewTokens.js +6 -1
- package/esm/browser/oidc/renewTokens.js.map +1 -1
- package/esm/browser/oidc/renewTokensWithRefresh.js +15 -5
- package/esm/browser/oidc/renewTokensWithRefresh.js.map +1 -1
- package/esm/browser/oidc/revokeToken.js +1 -0
- package/esm/browser/oidc/revokeToken.js.map +1 -1
- package/esm/browser/oidc/storage.js +1 -0
- package/esm/browser/oidc/storage.js.map +1 -1
- package/esm/browser/oidc/types/Token.js.map +1 -1
- package/esm/browser/oidc/util/browser.js +1 -0
- package/esm/browser/oidc/util/browser.js.map +1 -1
- package/esm/browser/oidc/util/defaultTokenParams.js +3 -2
- 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/prepareEnrollAuthenticatorParams.js +1 -0
- package/esm/browser/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -1
- package/esm/browser/oidc/util/prepareTokenParams.js +4 -0
- package/esm/browser/oidc/util/prepareTokenParams.js.map +1 -1
- package/esm/browser/oidc/util/validateToken.js +1 -0
- package/esm/browser/oidc/util/validateToken.js.map +1 -1
- package/esm/browser/oidc/verifyToken.js +1 -0
- package/esm/browser/oidc/verifyToken.js.map +1 -1
- package/esm/browser/package.json +1 -1
- package/esm/browser/services/AutoRenewService.js +1 -0
- package/esm/browser/services/AutoRenewService.js.map +1 -1
- package/esm/browser/services/SyncStorageService.js +1 -0
- package/esm/browser/services/SyncStorageService.js.map +1 -1
- package/esm/browser/session/api.js +1 -0
- package/esm/browser/session/api.js.map +1 -1
- package/esm/node/authn/api.js +1 -0
- package/esm/node/authn/api.js.map +1 -1
- package/esm/node/authn/util/link2fn.js +1 -0
- package/esm/node/authn/util/link2fn.js.map +1 -1
- package/esm/node/authn/util/poll.js +1 -0
- package/esm/node/authn/util/poll.js.map +1 -1
- package/esm/node/browser/fingerprint.js +1 -0
- package/esm/node/browser/fingerprint.js.map +1 -1
- package/esm/node/core/AuthStateManager.js +1 -0
- package/esm/node/core/AuthStateManager.js.map +1 -1
- package/esm/node/core/options.js +1 -0
- package/esm/node/core/options.js.map +1 -1
- package/esm/node/crypto/base64.js +1 -0
- package/esm/node/crypto/base64.js.map +1 -1
- package/esm/node/errors/OAuthError.js +5 -1
- package/esm/node/errors/OAuthError.js.map +1 -1
- package/esm/node/errors/WWWAuthError.js +61 -0
- package/esm/node/errors/WWWAuthError.js.map +1 -0
- package/esm/node/errors/index.js +6 -1
- package/esm/node/errors/index.js.map +1 -1
- package/esm/node/exports/exports/authn.js +2 -1
- package/esm/node/exports/exports/authn.js.map +1 -1
- package/esm/node/exports/exports/core.js +2 -1
- package/esm/node/exports/exports/core.js.map +1 -1
- package/esm/node/exports/exports/default.js +2 -1
- package/esm/node/exports/exports/default.js.map +1 -1
- package/esm/node/exports/exports/idx.js +2 -1
- package/esm/node/exports/exports/idx.js.map +1 -1
- package/esm/node/exports/exports/myaccount.js +2 -1
- package/esm/node/exports/exports/myaccount.js.map +1 -1
- package/esm/node/features.js +12 -2
- package/esm/node/features.js.map +1 -1
- package/esm/node/http/OktaUserAgent.js +2 -2
- package/esm/node/http/options.js +1 -0
- package/esm/node/http/options.js.map +1 -1
- package/esm/node/http/request.js +14 -25
- package/esm/node/http/request.js.map +1 -1
- package/esm/node/idx/IdxTransactionManager.js +4 -1
- package/esm/node/idx/IdxTransactionManager.js.map +1 -1
- package/esm/node/idx/cancel.js +1 -0
- package/esm/node/idx/cancel.js.map +1 -1
- package/esm/node/idx/factory/api.js +1 -0
- package/esm/node/idx/factory/api.js.map +1 -1
- package/esm/node/idx/flow/AccountUnlockFlow.js +1 -0
- package/esm/node/idx/flow/AccountUnlockFlow.js.map +1 -1
- package/esm/node/idx/flow/AuthenticationFlow.js +1 -0
- package/esm/node/idx/flow/AuthenticationFlow.js.map +1 -1
- package/esm/node/idx/flow/PasswordRecoveryFlow.js +1 -0
- package/esm/node/idx/flow/PasswordRecoveryFlow.js.map +1 -1
- package/esm/node/idx/flow/RegistrationFlow.js +1 -0
- package/esm/node/idx/flow/RegistrationFlow.js.map +1 -1
- package/esm/node/idx/handleInteractionCodeRedirect.js +1 -0
- package/esm/node/idx/handleInteractionCodeRedirect.js.map +1 -1
- package/esm/node/idx/idxState/v1/generateIdxAction.js +1 -0
- package/esm/node/idx/idxState/v1/generateIdxAction.js.map +1 -1
- package/esm/node/idx/idxState/v1/idxResponseParser.js +1 -0
- package/esm/node/idx/idxState/v1/idxResponseParser.js.map +1 -1
- package/esm/node/idx/interact.js +1 -0
- package/esm/node/idx/interact.js.map +1 -1
- package/esm/node/idx/proceed.js +1 -0
- package/esm/node/idx/proceed.js.map +1 -1
- package/esm/node/idx/recoverPassword.js +1 -0
- package/esm/node/idx/recoverPassword.js.map +1 -1
- package/esm/node/idx/register.js +1 -0
- package/esm/node/idx/register.js.map +1 -1
- package/esm/node/idx/remediate.js +1 -0
- package/esm/node/idx/remediate.js.map +1 -1
- package/esm/node/idx/remediators/GenericRemediator/util.js +2 -0
- package/esm/node/idx/remediators/GenericRemediator/util.js.map +1 -1
- package/esm/node/idx/run.js +3 -3
- package/esm/node/idx/run.js.map +1 -1
- package/esm/node/idx/transactionMeta.js +1 -0
- package/esm/node/idx/transactionMeta.js.map +1 -1
- package/esm/node/idx/unlockAccount.js +1 -0
- package/esm/node/idx/unlockAccount.js.map +1 -1
- package/esm/node/myaccount/request.js +1 -0
- package/esm/node/myaccount/request.js.map +1 -1
- package/esm/node/oidc/TokenManager.js +1 -0
- package/esm/node/oidc/TokenManager.js.map +1 -1
- package/esm/node/oidc/decodeToken.js +1 -0
- package/esm/node/oidc/decodeToken.js.map +1 -1
- package/esm/node/oidc/dpop.js +160 -0
- package/esm/node/oidc/dpop.js.map +1 -0
- package/esm/node/oidc/endpoints/authorize.js +1 -0
- package/esm/node/oidc/endpoints/authorize.js.map +1 -1
- package/esm/node/oidc/endpoints/token.js +62 -25
- package/esm/node/oidc/endpoints/token.js.map +1 -1
- package/esm/node/oidc/endpoints/well-known.js +1 -0
- package/esm/node/oidc/endpoints/well-known.js.map +1 -1
- package/esm/node/oidc/enrollAuthenticator.js +1 -0
- package/esm/node/oidc/enrollAuthenticator.js.map +1 -1
- package/esm/node/oidc/exchangeCodeForTokens.js +41 -25
- package/esm/node/oidc/exchangeCodeForTokens.js.map +1 -1
- package/esm/node/oidc/factory/api.js +1 -0
- package/esm/node/oidc/factory/api.js.map +1 -1
- package/esm/node/oidc/factory/baseApi.js +1 -0
- package/esm/node/oidc/factory/baseApi.js.map +1 -1
- package/esm/node/oidc/getToken.js +1 -0
- package/esm/node/oidc/getToken.js.map +1 -1
- package/esm/node/oidc/getUserInfo.js +22 -18
- package/esm/node/oidc/getUserInfo.js.map +1 -1
- package/esm/node/oidc/getWithPopup.js +1 -0
- package/esm/node/oidc/getWithPopup.js.map +1 -1
- package/esm/node/oidc/getWithRedirect.js +1 -0
- package/esm/node/oidc/getWithRedirect.js.map +1 -1
- package/esm/node/oidc/getWithoutPrompt.js +1 -0
- package/esm/node/oidc/getWithoutPrompt.js.map +1 -1
- package/esm/node/oidc/handleOAuthResponse.js +19 -0
- package/esm/node/oidc/handleOAuthResponse.js.map +1 -1
- package/esm/node/oidc/introspect.js +1 -0
- package/esm/node/oidc/introspect.js.map +1 -1
- package/esm/node/oidc/mixin/index.js +62 -2
- package/esm/node/oidc/mixin/index.js.map +1 -1
- package/esm/node/oidc/mixin/minimal.js +1 -0
- package/esm/node/oidc/mixin/minimal.js.map +1 -1
- package/esm/node/oidc/options/OAuthOptionsConstructor.js +1 -0
- package/esm/node/oidc/options/OAuthOptionsConstructor.js.map +1 -1
- package/esm/node/oidc/parseFromUrl.js +1 -0
- package/esm/node/oidc/parseFromUrl.js.map +1 -1
- package/esm/node/oidc/renewToken.js +5 -2
- package/esm/node/oidc/renewToken.js.map +1 -1
- package/esm/node/oidc/renewTokens.js +6 -1
- package/esm/node/oidc/renewTokens.js.map +1 -1
- package/esm/node/oidc/renewTokensWithRefresh.js +15 -5
- package/esm/node/oidc/renewTokensWithRefresh.js.map +1 -1
- package/esm/node/oidc/revokeToken.js +1 -0
- package/esm/node/oidc/revokeToken.js.map +1 -1
- package/esm/node/oidc/storage.js +1 -0
- package/esm/node/oidc/storage.js.map +1 -1
- package/esm/node/oidc/types/Token.js.map +1 -1
- package/esm/node/oidc/util/browser.js +1 -0
- package/esm/node/oidc/util/browser.js.map +1 -1
- package/esm/node/oidc/util/defaultTokenParams.js +3 -2
- 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/prepareEnrollAuthenticatorParams.js +1 -0
- package/esm/node/oidc/util/prepareEnrollAuthenticatorParams.js.map +1 -1
- package/esm/node/oidc/util/prepareTokenParams.js +4 -0
- package/esm/node/oidc/util/prepareTokenParams.js.map +1 -1
- package/esm/node/oidc/util/validateToken.js +1 -0
- package/esm/node/oidc/util/validateToken.js.map +1 -1
- package/esm/node/oidc/verifyToken.js +1 -0
- package/esm/node/oidc/verifyToken.js.map +1 -1
- package/esm/node/package.json +1 -1
- package/esm/node/server/serverStorage.js +1 -0
- package/esm/node/server/serverStorage.js.map +1 -1
- package/esm/node/session/api.js +1 -0
- package/esm/node/session/api.js.map +1 -1
- package/esm/node/storage/options/StorageOptionsConstructor.js +1 -0
- package/esm/node/storage/options/StorageOptionsConstructor.js.map +1 -1
- package/package.json +4 -3
- package/types/lib/base/types.d.ts +1 -0
- package/types/lib/core/options.d.ts +1 -0
- package/types/lib/errors/OAuthError.d.ts +3 -1
- package/types/lib/errors/WWWAuthError.d.ts +29 -0
- package/types/lib/errors/index.d.ts +3 -1
- package/types/lib/features.d.ts +1 -0
- package/types/lib/idx/options.d.ts +1 -0
- package/types/lib/idx/types/options.d.ts +1 -0
- package/types/lib/oidc/dpop.d.ts +35 -0
- package/types/lib/oidc/endpoints/token.d.ts +5 -2
- package/types/lib/oidc/options/OAuthOptionsConstructor.d.ts +1 -0
- package/types/lib/oidc/types/Token.d.ts +3 -0
- package/types/lib/oidc/types/api.d.ts +13 -0
- package/types/lib/oidc/types/meta.d.ts +1 -1
- package/types/lib/oidc/types/options.d.ts +3 -0
- package/umd/authn.js +1 -1
- package/umd/authn.js.map +1 -1
- package/umd/core.js +1 -1
- package/umd/core.js.map +1 -1
- package/umd/default.js +1 -1
- package/umd/default.js.map +1 -1
- package/umd/idx.js +1 -1
- package/umd/idx.js.map +1 -1
- package/umd/myaccount.js +1 -1
- package/umd/myaccount.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# 7.7.1
|
|
4
|
+
|
|
5
|
+
- [#1529](https://github.com/okta/okta-auth-js/pull/1529) fix: persist `extraParams` passed to `/authorize` and include them during token refresh
|
|
6
|
+
|
|
7
|
+
## 7.7.0
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- [#1495](https://github.com/okta/okta-auth-js/pull/1495) add: DPoP support
|
|
12
|
+
|
|
13
|
+
### Fixes
|
|
14
|
+
|
|
15
|
+
- [#1508](https://github.com/okta/okta-auth-js/pull/1508) IDX: add condition to compare stateHandles when loading saved idxResponse only when useGenericRemediator option is false or undefined
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
## 7.6.0
|
|
4
19
|
|
|
5
20
|
### Features
|
package/README.md
CHANGED
|
@@ -399,6 +399,105 @@ Additionally, if using hash routing, we recommend using PKCE and responseMode "q
|
|
|
399
399
|
2. Add tokens to the `TokenManager`: [tokenManager.setTokens](#tokenmanagersettokenstokens)
|
|
400
400
|
6. Read saved route and redirect to it: [getOriginalUri](#getoriginaluristate)
|
|
401
401
|
|
|
402
|
+
### Enabling DPoP
|
|
403
|
+
<sub><sup>*Reference: DPoP (Demonstrating Proof-of-Possession) - [RFC9449](https://datatracker.ietf.org/doc/html/rfc9449)*</sub></sup>
|
|
404
|
+
|
|
405
|
+
#### Requirements
|
|
406
|
+
* `DPoP` must be enabled in your Okta application ([Guide: Configure DPoP](https://developer.okta.com/docs/guides/dpop/main/))
|
|
407
|
+
* Only supported on web (browser)
|
|
408
|
+
* `https` is required. A [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts) is required for `WebCrypto.subtle`
|
|
409
|
+
* Targeted browsers must support `IndexedDB` ([MDN](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API), [caniuse](https://caniuse.com/indexeddb))
|
|
410
|
+
* :warning: IE11 (and lower) is not supported!
|
|
411
|
+
|
|
412
|
+
#### Configuration
|
|
413
|
+
```javascript
|
|
414
|
+
const config = {
|
|
415
|
+
// other configurations
|
|
416
|
+
pkce: true, // required
|
|
417
|
+
dpop: true,
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const authClient = new OktaAuth(config);
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
#### Providing DPoP Proof to Resource Requests
|
|
424
|
+
<sub><sup>*Reference: **The DPoP Authentication Scheme** ([RFC9449](https://datatracker.ietf.org/doc/html/rfc9449#name-the-dpop-authentication-sch))*</sub></sup>
|
|
425
|
+
|
|
426
|
+
##### DPoP-Protected Resource Request ([link](https://datatracker.ietf.org/doc/html/rfc9449#name-dpop-protected-resource-req))
|
|
427
|
+
```
|
|
428
|
+
GET /protectedresource HTTP/1.1
|
|
429
|
+
Host: resource.example.org
|
|
430
|
+
Authorization: DPoP Kz~8mXK1EalYznwH-LC-1fBAo.4Ljp~zsPE_NeO.gxU
|
|
431
|
+
DPoP: eyJ0eXAiOiJkcG9wK2p3dCIsIm...
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
##### Fetching DPoP-Protected Resource
|
|
435
|
+
```javascript
|
|
436
|
+
async function dpopAuthenticatedFetch (url, options) {
|
|
437
|
+
const { method } = options;
|
|
438
|
+
const dpop = await authClient.getDPoPAuthorizationHeaders({ url, method });
|
|
439
|
+
// dpop = { Authorization: "DPoP token****", Dpop: "proof****" }
|
|
440
|
+
const headers = new Headers({...options.headers, ...dpop});
|
|
441
|
+
return fetch(url, {...options, headers });
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
#### Handling `use_dpop_nonce`
|
|
446
|
+
<sub><sup>*Reference: **Resource Server-Provided Nonce** ([RFC9449](https://datatracker.ietf.org/doc/html/rfc9449#name-resource-server-provided-no))*</sub></sup>
|
|
447
|
+
|
|
448
|
+
> Resource servers can also choose to provide a nonce value to be included in DPoP proofs sent to them. They provide the nonce using the DPoP-Nonce header in the same way that authorization servers do...
|
|
449
|
+
|
|
450
|
+
##### Resource Server Response
|
|
451
|
+
```
|
|
452
|
+
HTTP/1.1 401 Unauthorized
|
|
453
|
+
WWW-Authenticate: DPoP error="use_dpop_nonce", \
|
|
454
|
+
error_description="Resource server requires nonce in DPoP proof"
|
|
455
|
+
DPoP-Nonce: eyJ7S_zG.eyJH0-Z.HX4w-7v
|
|
456
|
+
```
|
|
457
|
+
##### Handling Response
|
|
458
|
+
```javascript
|
|
459
|
+
async function dpopAuthenticatedFetch (url, options) {
|
|
460
|
+
// ...previous example...
|
|
461
|
+
const resp = await fetch(url, {...options, headers });
|
|
462
|
+
// resp = HTTP/1.1 401 Unauthorized...
|
|
463
|
+
|
|
464
|
+
if (!resp.ok) {
|
|
465
|
+
const nonce = authClient.parseUseDPoPNonceError(resp.headers);
|
|
466
|
+
if (nonce) {
|
|
467
|
+
const retryDpop = await authClient.getDPoPAuthorizationHeaders({ url, method, nonce });
|
|
468
|
+
const retryHeaders = new Headers({...options.headers, ...retryDpop});
|
|
469
|
+
return fetch(url, {...options, headers: retryHeaders });
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return resp;
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
#### Ensure browser can support DPoP (*Recommended*)
|
|
478
|
+
DPoP requires certain browser features. A user using a browser without the required features will unable to complete a request for tokens. It's recommended to verify browser support during application bootstrapping.
|
|
479
|
+
|
|
480
|
+
```javascript
|
|
481
|
+
// App.tsx
|
|
482
|
+
useEffect(() => {
|
|
483
|
+
if (!authClient.features.isDPoPSupported()) {
|
|
484
|
+
// user will be unable to request tokens
|
|
485
|
+
navigate('/unsupported-error-page');
|
|
486
|
+
}
|
|
487
|
+
}, []);
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
#### Clear DPoP Storage (*Recommended*)
|
|
491
|
+
DPoP requires the generation of a `CryptoKeyPair` which needs to be persisted in storage. Methods like `signOut()` or `revokeAccessToken()` will clear the key pair, however users don't always explicitly logout. It's therefore good practice to clear storage before login to flush any orphaned key pairs generated from previously requested tokens.
|
|
492
|
+
|
|
493
|
+
```javascript
|
|
494
|
+
async function login (options) {
|
|
495
|
+
await authClient.clearDPoPStorage(); // clear possibly orphaned key pairs
|
|
496
|
+
|
|
497
|
+
return authClient.signInWithRedirect(options);
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
402
501
|
## Configuration reference
|
|
403
502
|
|
|
404
503
|
Whether you are using this SDK to implement an OIDC flow or for communicating with the [Authentication API](https://developer.okta.com/docs/api/resources/authn), the only required configuration option is `issuer`, which is the URL to an Okta [Authorization Server](https://developer.okta.com/docs/guides/customize-authz-server/overview/)
|
|
@@ -470,6 +569,13 @@ A client-provided string that will be passed to the server endpoint and returned
|
|
|
470
569
|
|
|
471
570
|
Default value is `true` which enables the [PKCE OAuth Flow](#pkce-oauth-20-flow). To use the [Implicit Flow](#implicit-oauth-20-flow) or [Authorization Code Flow](#authorization-code-flow-for-web-and-native-client-types), set `pkce` to `false`.
|
|
472
571
|
|
|
572
|
+
#### `dpop`
|
|
573
|
+
|
|
574
|
+
Default value is `false`. Set to `true` to enable `DPoP` (Demonstrating Proof-of-Possession ([RFC9449](https://datatracker.ietf.org/doc/html/rfc9449)))
|
|
575
|
+
|
|
576
|
+
See Guide: [Enabling DPoP](#enabling-dpop)
|
|
577
|
+
|
|
578
|
+
|
|
473
579
|
#### responseMode
|
|
474
580
|
|
|
475
581
|
When requesting tokens using [token.getWithRedirect](#tokengetwithredirectoptions) values will be returned as parameters appended to the [redirectUri](#configuration-options).
|
|
@@ -915,6 +1021,9 @@ The amount of time, in seconds, a tab needs to be inactive for the `RenewOnTabAc
|
|
|
915
1021
|
* [tx.resume](#txresume)
|
|
916
1022
|
* [tx.exists](#txexists)
|
|
917
1023
|
* [transaction.status](#transactionstatus)
|
|
1024
|
+
* [getDPoPAuthorizationHeaders](#getdpopauthorizationheaders)
|
|
1025
|
+
* [parseUseDPoPNonceError](#parseusedpopnonceerror)
|
|
1026
|
+
* [clearDPoPStorage](#cleardpopstorage)
|
|
918
1027
|
* [session](#session)
|
|
919
1028
|
* [session.setCookieAndRedirect](#sessionsetcookieandredirectsessiontoken-redirecturi)
|
|
920
1029
|
* [session.exists](#sessionexists)
|
|
@@ -1270,6 +1379,39 @@ See [authn API](docs/authn.md#txexists).
|
|
|
1270
1379
|
|
|
1271
1380
|
See [authn API](docs/authn.md#transactionstatus).
|
|
1272
1381
|
|
|
1382
|
+
### `getDPoPAuthorizationHeaders(params)`
|
|
1383
|
+
|
|
1384
|
+
> :link: web browser only <br>
|
|
1385
|
+
> :hourglass: async <br>
|
|
1386
|
+
|
|
1387
|
+
Requires [dpop](#dpop) set to `true`. Returns `Authorization` and `Dpop` header values to build a DPoP protected-request.
|
|
1388
|
+
|
|
1389
|
+
Params: `url` and (http) `method` are required.
|
|
1390
|
+
* `accessToken` is optional, but will be read from `tokenStorage` if not provided
|
|
1391
|
+
* `nonce` is optional, may be provided via `use_dpop_nonce` pattern from Resource Server ([more info](#handling-use_dpop_nonce))
|
|
1392
|
+
|
|
1393
|
+
### `parseUseDPoPNonceError(headers)`
|
|
1394
|
+
|
|
1395
|
+
> :link: web browser only <br>
|
|
1396
|
+
|
|
1397
|
+
Utility to extract and parse the `WWW-Authenticate` and `DPoP-Nonce` headers from a network response from a DPoP-protected request. Should the response be in the following format, the `nonce` value will be returned. Otherwise returns `null`
|
|
1398
|
+
|
|
1399
|
+
```
|
|
1400
|
+
HTTP/1.1 401 Unauthorized
|
|
1401
|
+
WWW-Authenticate: DPoP error="use_dpop_nonce", \
|
|
1402
|
+
error_description="Resource server requires nonce in DPoP proof"
|
|
1403
|
+
DPoP-Nonce: eyJ7S_zG.eyJH0-Z.HX4w-7v
|
|
1404
|
+
```
|
|
1405
|
+
|
|
1406
|
+
### `clearDPoPStorage(clearAll=false)`
|
|
1407
|
+
|
|
1408
|
+
> :link: web browser only <br>
|
|
1409
|
+
> :hourglass: async <br>
|
|
1410
|
+
|
|
1411
|
+
Clears storage location of `CryptoKeyPair`s generated and used by DPoP. Pass `true` to remove all key pairs as it's possible for orphaned key pairs to exist. If `clearAll` is `false`, the key pair bound to the current `accessToken` in tokenStorage will be removed.
|
|
1412
|
+
|
|
1413
|
+
It's recommended to call this function during user login. [See Example](#clear-dpop-storage-recommended)
|
|
1414
|
+
|
|
1273
1415
|
### `session`
|
|
1274
1416
|
|
|
1275
1417
|
#### `session.setCookieAndRedirect(sessionToken, redirectUri)`
|
package/cjs/base/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../lib/base/types.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as constants from '../constants';\n\nexport declare class EventEmitter {\n on (event: string, callback: (...args: any[]) => any, ctx?: any): EventEmitter;\n once (event: string, callback: (...args: any[]) => any, ctx?: any): EventEmitter;\n emit (event: string, ...args: any[]): EventEmitter;\n off (event: string, callback?: (...args: any[]) => any): EventEmitter;\n}\n\nexport interface FeaturesAPI {\n isLocalhost(): boolean;\n isHTTPS(): boolean;\n isPopupPostMessageSupported(): boolean;\n hasTextEncoder(): boolean;\n isTokenVerifySupported(): boolean;\n isPKCESupported(): boolean;\n isIE11OrLess(): boolean;\n}\n\n\n// options that can be passed to AuthJS\nexport interface OktaAuthBaseOptions {\n devMode?: boolean;\n}\n\n// a class that constructs options\nexport interface OktaAuthOptionsConstructor<O extends OktaAuthBaseOptions = OktaAuthBaseOptions> {\n new(args: any): O;\n}\n\n// a \"base\" instance of AuthJS\nexport interface OktaAuthBaseInterface<O extends OktaAuthBaseOptions = OktaAuthBaseOptions> {\n options: O;\n emitter: EventEmitter;\n features: FeaturesAPI;\n}\n\n// a constructor that returns an instance of AuthJS\nexport interface OktaAuthConstructor\n<\n I extends OktaAuthBaseInterface = OktaAuthBaseInterface\n> \n{\n new(...args: any[]): I;\n features: FeaturesAPI; // static class member\n constants: typeof constants;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../lib/base/types.ts"],"sourcesContent":["/*!\n * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as constants from '../constants';\n\nexport declare class EventEmitter {\n on (event: string, callback: (...args: any[]) => any, ctx?: any): EventEmitter;\n once (event: string, callback: (...args: any[]) => any, ctx?: any): EventEmitter;\n emit (event: string, ...args: any[]): EventEmitter;\n off (event: string, callback?: (...args: any[]) => any): EventEmitter;\n}\n\nexport interface FeaturesAPI {\n isLocalhost(): boolean;\n isHTTPS(): boolean;\n isPopupPostMessageSupported(): boolean;\n hasTextEncoder(): boolean;\n isTokenVerifySupported(): boolean;\n isPKCESupported(): boolean;\n isIE11OrLess(): boolean;\n isDPoPSupported(): boolean;\n}\n\n\n// options that can be passed to AuthJS\nexport interface OktaAuthBaseOptions {\n devMode?: boolean;\n}\n\n// a class that constructs options\nexport interface OktaAuthOptionsConstructor<O extends OktaAuthBaseOptions = OktaAuthBaseOptions> {\n new(args: any): O;\n}\n\n// a \"base\" instance of AuthJS\nexport interface OktaAuthBaseInterface<O extends OktaAuthBaseOptions = OktaAuthBaseOptions> {\n options: O;\n emitter: EventEmitter;\n features: FeaturesAPI;\n}\n\n// a constructor that returns an instance of AuthJS\nexport interface OktaAuthConstructor\n<\n I extends OktaAuthBaseInterface = OktaAuthBaseInterface\n> \n{\n new(...args: any[]): I;\n features: FeaturesAPI; // static class member\n constants: typeof constants;\n}\n"],"mappings":""}
|
package/cjs/errors/OAuthError.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.default = void 0;
|
|
5
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
5
6
|
var _CustomError = _interopRequireDefault(require("./CustomError"));
|
|
6
7
|
/* eslint-disable camelcase */
|
|
7
8
|
/*!
|
|
@@ -19,8 +20,9 @@ var _CustomError = _interopRequireDefault(require("./CustomError"));
|
|
|
19
20
|
class OAuthError extends _CustomError.default {
|
|
20
21
|
// for widget / idx-js backward compatibility
|
|
21
22
|
|
|
22
|
-
constructor(errorCode, summary) {
|
|
23
|
+
constructor(errorCode, summary, resp) {
|
|
23
24
|
super(summary);
|
|
25
|
+
(0, _defineProperty2.default)(this, "resp", null);
|
|
24
26
|
this.name = 'OAuthError';
|
|
25
27
|
this.errorCode = errorCode;
|
|
26
28
|
this.errorSummary = summary;
|
|
@@ -28,6 +30,12 @@ class OAuthError extends _CustomError.default {
|
|
|
28
30
|
// for widget / idx-js backward compatibility
|
|
29
31
|
this.error = errorCode;
|
|
30
32
|
this.error_description = summary;
|
|
33
|
+
|
|
34
|
+
// an OAuth error (should) always result from a network request
|
|
35
|
+
// therefore include that in error for potential error handling
|
|
36
|
+
if (resp) {
|
|
37
|
+
this.resp = resp;
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
exports.default = OAuthError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthError.js","names":["OAuthError","CustomError","constructor","errorCode","summary","name","errorSummary","error","error_description"],"sources":["../../../lib/errors/OAuthError.ts"],"sourcesContent":["/* eslint-disable camelcase */\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 CustomError from './CustomError';\n\nexport default class OAuthError extends CustomError {\n errorCode: string;\n errorSummary: string;\n\n // for widget / idx-js backward compatibility\n error: string;\n error_description: string;\n\n constructor(errorCode: string, summary: string) {\n super(summary);\n\n this.name = 'OAuthError';\n this.errorCode = errorCode;\n this.errorSummary = summary;\n\n // for widget / idx-js backward compatibility\n this.error = errorCode;\n this.error_description = summary;\n }\n}\n\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OAuthError.js","names":["OAuthError","CustomError","constructor","errorCode","summary","resp","name","errorSummary","error","error_description"],"sources":["../../../lib/errors/OAuthError.ts"],"sourcesContent":["/* eslint-disable camelcase */\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 CustomError from './CustomError';\nimport type { HttpResponse } from '../http';\n\nexport default class OAuthError extends CustomError {\n errorCode: string;\n errorSummary: string;\n\n // for widget / idx-js backward compatibility\n error: string;\n error_description: string;\n\n resp: HttpResponse | null = null;\n\n constructor(errorCode: string, summary: string, resp?: HttpResponse) {\n super(summary);\n\n this.name = 'OAuthError';\n this.errorCode = errorCode;\n this.errorSummary = summary;\n\n // for widget / idx-js backward compatibility\n this.error = errorCode;\n this.error_description = summary;\n\n // an OAuth error (should) always result from a network request\n // therefore include that in error for potential error handling\n if (resp) {\n this.resp = resp;\n }\n }\n}\n\n"],"mappings":";;;;;AAaA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKe,MAAMA,UAAU,SAASC,oBAAW,CAAC;EAIlD;;EAMAC,WAAW,CAACC,SAAiB,EAAEC,OAAe,EAAEC,IAAmB,EAAE;IACnE,KAAK,CAACD,OAAO,CAAC;IAAC,4CAHW,IAAI;IAK9B,IAAI,CAACE,IAAI,GAAG,YAAY;IACxB,IAAI,CAACH,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACI,YAAY,GAAGH,OAAO;;IAE3B;IACA,IAAI,CAACI,KAAK,GAAGL,SAAS;IACtB,IAAI,CAACM,iBAAiB,GAAGL,OAAO;;IAEhC;IACA;IACA,IAAIC,IAAI,EAAE;MACR,IAAI,CAACA,IAAI,GAAGA,IAAI;IAClB;EACF;AACF;AAAC;AAAA"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
6
|
+
var _CustomError = _interopRequireDefault(require("./CustomError"));
|
|
7
|
+
var _util = require("../util");
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
10
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
11
|
+
*
|
|
12
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
15
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
*
|
|
17
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Error thrown after an unsuccessful network request which requires an Authorization header
|
|
21
|
+
// and returns a 4XX error with a www-authenticate header. The header value is parsed to construct
|
|
22
|
+
// an error instance, which contains key/value pairs parsed out
|
|
23
|
+
class WWWAuthError extends _CustomError.default {
|
|
24
|
+
constructor(scheme, parameters, resp) {
|
|
25
|
+
// defaults to unknown error. `error` being returned in the www-authenticate header is expected
|
|
26
|
+
// but cannot be guaranteed. Throwing an error within a error constructor seems awkward
|
|
27
|
+
super(parameters.error ?? WWWAuthError.UNKNOWN_ERROR);
|
|
28
|
+
(0, _defineProperty2.default)(this, "name", 'WWWAuthError');
|
|
29
|
+
(0, _defineProperty2.default)(this, "resp", null);
|
|
30
|
+
this.scheme = scheme;
|
|
31
|
+
this.parameters = parameters;
|
|
32
|
+
if (resp) {
|
|
33
|
+
this.resp = resp;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// convenience references
|
|
38
|
+
get error() {
|
|
39
|
+
return this.parameters.error;
|
|
40
|
+
}
|
|
41
|
+
get errorCode() {
|
|
42
|
+
return this.error;
|
|
43
|
+
} // parity with other error props
|
|
44
|
+
// eslint-disable-next-line camelcase
|
|
45
|
+
get error_description() {
|
|
46
|
+
return this.parameters.error_description;
|
|
47
|
+
}
|
|
48
|
+
// eslint-disable-next-line camelcase
|
|
49
|
+
get errorDescription() {
|
|
50
|
+
return this.error_description;
|
|
51
|
+
}
|
|
52
|
+
get errorSummary() {
|
|
53
|
+
return this.errorDescription;
|
|
54
|
+
} // parity with other error props
|
|
55
|
+
get realm() {
|
|
56
|
+
return this.parameters.realm;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// parses the www-authenticate header for releveant
|
|
60
|
+
static parseHeader(header) {
|
|
61
|
+
// header cannot be empty string
|
|
62
|
+
if (!header) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// example string: Bearer error="invalid_token", error_description="The access token is invalid"
|
|
67
|
+
// regex will match on `error="invalid_token", error_description="The access token is invalid"`
|
|
68
|
+
// see unit test for more examples of possible www-authenticate values
|
|
69
|
+
// eslint-disable-next-line max-len
|
|
70
|
+
const regex = /(?:,|, )?([a-zA-Z0-9!#$%&'*+\-.^_`|~]+)=(?:"([a-zA-Z0-9!#$%&'*+\-.,^_`|~ /:]+)"|([a-zA-Z0-9!#$%&'*+\-.^_`|~/:]+))/g;
|
|
71
|
+
const firstSpace = header.indexOf(' ');
|
|
72
|
+
const scheme = header.slice(0, firstSpace);
|
|
73
|
+
const remaining = header.slice(firstSpace + 1);
|
|
74
|
+
const params = {};
|
|
75
|
+
|
|
76
|
+
// Reference: foo="hello", bar="bye"
|
|
77
|
+
// i=0, match=[foo="hello1", foo, hello]
|
|
78
|
+
// i=1, match=[bar="bye", bar, bye]
|
|
79
|
+
let match;
|
|
80
|
+
while ((match = regex.exec(remaining)) !== null) {
|
|
81
|
+
params[match[1]] = match[2] ?? match[3];
|
|
82
|
+
}
|
|
83
|
+
return new WWWAuthError(scheme, params);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// finds the value of the `www-authenticate` header. HeadersInit allows for a few different
|
|
87
|
+
// representations of headers with different access patterns (.get vs [key])
|
|
88
|
+
static getWWWAuthenticateHeader(headers = {}) {
|
|
89
|
+
if ((0, _util.isFunction)(headers?.get)) {
|
|
90
|
+
return headers.get('WWW-Authenticate');
|
|
91
|
+
}
|
|
92
|
+
return headers['www-authenticate'] ?? headers['WWW-Authenticate'];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.default = WWWAuthError;
|
|
96
|
+
(0, _defineProperty2.default)(WWWAuthError, "UNKNOWN_ERROR", 'UNKNOWN_WWW_AUTH_ERROR');
|
|
97
|
+
module.exports = exports.default;
|
|
98
|
+
//# sourceMappingURL=WWWAuthError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WWWAuthError.js","names":["WWWAuthError","CustomError","constructor","scheme","parameters","resp","error","UNKNOWN_ERROR","errorCode","error_description","errorDescription","errorSummary","realm","parseHeader","header","regex","firstSpace","indexOf","slice","remaining","params","match","exec","getWWWAuthenticateHeader","headers","isFunction","get"],"sources":["../../../lib/errors/WWWAuthError.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 type { HttpResponse } from '../http';\nimport CustomError from './CustomError';\nimport { isFunction } from '../util';\n\n// Error thrown after an unsuccessful network request which requires an Authorization header \n// and returns a 4XX error with a www-authenticate header. The header value is parsed to construct \n// an error instance, which contains key/value pairs parsed out\nexport default class WWWAuthError extends CustomError {\n static UNKNOWN_ERROR = 'UNKNOWN_WWW_AUTH_ERROR';\n\n scheme: string;\n parameters: Record<string, string>;\n name = 'WWWAuthError';\n\n resp: HttpResponse | null = null;\n\n constructor(scheme: string, parameters: Record<string, string>, resp?: HttpResponse) {\n // defaults to unknown error. `error` being returned in the www-authenticate header is expected\n // but cannot be guaranteed. Throwing an error within a error constructor seems awkward\n super(parameters.error ?? WWWAuthError.UNKNOWN_ERROR);\n this.scheme = scheme;\n this.parameters = parameters;\n\n if (resp) {\n this.resp = resp;\n }\n }\n\n // convenience references\n get error (): string { return this.parameters.error; }\n get errorCode (): string { return this.error; } // parity with other error props\n // eslint-disable-next-line camelcase\n get error_description (): string { return this.parameters.error_description; }\n // eslint-disable-next-line camelcase\n get errorDescription (): string { return this.error_description; }\n get errorSummary (): string { return this.errorDescription; } // parity with other error props\n get realm (): string { return this.parameters.realm; }\n\n // parses the www-authenticate header for releveant\n static parseHeader (header: string): WWWAuthError | null {\n // header cannot be empty string\n if (!header) {\n return null;\n }\n\n // example string: Bearer error=\"invalid_token\", error_description=\"The access token is invalid\"\n // regex will match on `error=\"invalid_token\", error_description=\"The access token is invalid\"`\n // see unit test for more examples of possible www-authenticate values\n // eslint-disable-next-line max-len\n const regex = /(?:,|, )?([a-zA-Z0-9!#$%&'*+\\-.^_`|~]+)=(?:\"([a-zA-Z0-9!#$%&'*+\\-.,^_`|~ /:]+)\"|([a-zA-Z0-9!#$%&'*+\\-.^_`|~/:]+))/g;\n const firstSpace = header.indexOf(' ');\n const scheme = header.slice(0, firstSpace);\n const remaining = header.slice(firstSpace + 1);\n const params = {};\n\n // Reference: foo=\"hello\", bar=\"bye\"\n // i=0, match=[foo=\"hello1\", foo, hello]\n // i=1, match=[bar=\"bye\", bar, bye]\n let match;\n while ((match = regex.exec(remaining)) !== null) {\n params[match[1]] = (match[2] ?? match[3]);\n }\n\n return new WWWAuthError(scheme, params);\n }\n\n // finds the value of the `www-authenticate` header. HeadersInit allows for a few different\n // representations of headers with different access patterns (.get vs [key])\n static getWWWAuthenticateHeader (headers: HeadersInit = {}): string | null {\n if (isFunction((headers as Headers)?.get)) {\n return (headers as Headers).get('WWW-Authenticate');\n }\n return headers['www-authenticate'] ?? headers['WWW-Authenticate'];\n }\n}\n"],"mappings":";;;;;AAcA;AACA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACe,MAAMA,YAAY,SAASC,oBAAW,CAAC;EASpDC,WAAW,CAACC,MAAc,EAAEC,UAAkC,EAAEC,IAAmB,EAAE;IACnF;IACA;IACA,KAAK,CAACD,UAAU,CAACE,KAAK,IAAIN,YAAY,CAACO,aAAa,CAAC;IAAC,4CAPjD,cAAc;IAAA,4CAEO,IAAI;IAM9B,IAAI,CAACJ,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACC,UAAU,GAAGA,UAAU;IAE5B,IAAIC,IAAI,EAAE;MACR,IAAI,CAACA,IAAI,GAAGA,IAAI;IAClB;EACF;;EAEA;EACA,IAAIC,KAAK,GAAY;IAAE,OAAO,IAAI,CAACF,UAAU,CAACE,KAAK;EAAE;EACrD,IAAIE,SAAS,GAAY;IAAE,OAAO,IAAI,CAACF,KAAK;EAAE,CAAC,CAAiB;EAChE;EACA,IAAIG,iBAAiB,GAAY;IAAE,OAAO,IAAI,CAACL,UAAU,CAACK,iBAAiB;EAAE;EAC7E;EACA,IAAIC,gBAAgB,GAAY;IAAE,OAAO,IAAI,CAACD,iBAAiB;EAAE;EACjE,IAAIE,YAAY,GAAY;IAAE,OAAO,IAAI,CAACD,gBAAgB;EAAE,CAAC,CAAG;EAChE,IAAIE,KAAK,GAAY;IAAE,OAAO,IAAI,CAACR,UAAU,CAACQ,KAAK;EAAE;;EAErD;EACA,OAAOC,WAAW,CAAEC,MAAc,EAAuB;IACvD;IACA,IAAI,CAACA,MAAM,EAAE;MACX,OAAO,IAAI;IACb;;IAEA;IACA;IACA;IACA;IACA,MAAMC,KAAK,GAAG,oHAAoH;IAClI,MAAMC,UAAU,GAAGF,MAAM,CAACG,OAAO,CAAC,GAAG,CAAC;IACtC,MAAMd,MAAM,GAAGW,MAAM,CAACI,KAAK,CAAC,CAAC,EAAEF,UAAU,CAAC;IAC1C,MAAMG,SAAS,GAAGL,MAAM,CAACI,KAAK,CAACF,UAAU,GAAG,CAAC,CAAC;IAC9C,MAAMI,MAAM,GAAG,CAAC,CAAC;;IAEjB;IACA;IACA;IACA,IAAIC,KAAK;IACT,OAAO,CAACA,KAAK,GAAGN,KAAK,CAACO,IAAI,CAACH,SAAS,CAAC,MAAM,IAAI,EAAE;MAC/CC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAIA,KAAK,CAAC,CAAC,CAAC,IAAIA,KAAK,CAAC,CAAC,CAAE;IAC3C;IAEA,OAAO,IAAIrB,YAAY,CAACG,MAAM,EAAEiB,MAAM,CAAC;EACzC;;EAEA;EACA;EACA,OAAOG,wBAAwB,CAAEC,OAAoB,GAAG,CAAC,CAAC,EAAiB;IACzE,IAAI,IAAAC,gBAAU,EAAED,OAAO,EAAcE,GAAG,CAAC,EAAE;MACzC,OAAQF,OAAO,CAAaE,GAAG,CAAC,kBAAkB,CAAC;IACrD;IACA,OAAOF,OAAO,CAAC,kBAAkB,CAAC,IAAIA,OAAO,CAAC,kBAAkB,CAAC;EACnE;AACF;AAAC;AAAA,8BAnEoBxB,YAAY,mBACR,wBAAwB;AAAA"}
|
package/cjs/errors/index.js
CHANGED
|
@@ -4,10 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
var _exportNames = {
|
|
5
5
|
isAuthApiError: true,
|
|
6
6
|
isOAuthError: true,
|
|
7
|
+
isWWWAuthError: true,
|
|
7
8
|
AuthApiError: true,
|
|
8
9
|
AuthPollStopError: true,
|
|
9
10
|
AuthSdkError: true,
|
|
10
|
-
OAuthError: true
|
|
11
|
+
OAuthError: true,
|
|
12
|
+
WWWAuthError: true
|
|
11
13
|
};
|
|
12
14
|
Object.defineProperty(exports, "AuthApiError", {
|
|
13
15
|
enumerable: true,
|
|
@@ -33,12 +35,20 @@ Object.defineProperty(exports, "OAuthError", {
|
|
|
33
35
|
return _OAuthError.default;
|
|
34
36
|
}
|
|
35
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "WWWAuthError", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _WWWAuthError.default;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
36
44
|
exports.isAuthApiError = isAuthApiError;
|
|
37
45
|
exports.isOAuthError = isOAuthError;
|
|
46
|
+
exports.isWWWAuthError = isWWWAuthError;
|
|
38
47
|
var _AuthApiError = _interopRequireDefault(require("./AuthApiError"));
|
|
39
48
|
var _AuthPollStopError = _interopRequireDefault(require("./AuthPollStopError"));
|
|
40
49
|
var _AuthSdkError = _interopRequireDefault(require("./AuthSdkError"));
|
|
41
50
|
var _OAuthError = _interopRequireDefault(require("./OAuthError"));
|
|
51
|
+
var _WWWAuthError = _interopRequireDefault(require("./WWWAuthError"));
|
|
42
52
|
var _types = require("./types");
|
|
43
53
|
Object.keys(_types).forEach(function (key) {
|
|
44
54
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -69,4 +79,7 @@ function isAuthApiError(obj) {
|
|
|
69
79
|
function isOAuthError(obj) {
|
|
70
80
|
return obj instanceof _OAuthError.default;
|
|
71
81
|
}
|
|
82
|
+
function isWWWAuthError(obj) {
|
|
83
|
+
return obj instanceof _WWWAuthError.default;
|
|
84
|
+
}
|
|
72
85
|
//# sourceMappingURL=index.js.map
|
package/cjs/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isAuthApiError","obj","AuthApiError","isOAuthError","OAuthError"],"sources":["../../../lib/errors/index.ts"],"sourcesContent":["\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 AuthApiError from './AuthApiError';\nimport AuthPollStopError from './AuthPollStopError';\nimport AuthSdkError from './AuthSdkError';\nimport OAuthError from './OAuthError';\n\nfunction isAuthApiError(obj: any): obj is AuthApiError {\n return (obj instanceof AuthApiError);\n}\n\nfunction isOAuthError(obj: any): obj is OAuthError {\n return (obj instanceof OAuthError);\n}\n\nexport {\n isAuthApiError,\n isOAuthError,\n AuthApiError,\n AuthPollStopError,\n AuthSdkError,\n OAuthError\n};\n\nexport * from './types';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["isAuthApiError","obj","AuthApiError","isOAuthError","OAuthError","isWWWAuthError","WWWAuthError"],"sources":["../../../lib/errors/index.ts"],"sourcesContent":["\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 AuthApiError from './AuthApiError';\nimport AuthPollStopError from './AuthPollStopError';\nimport AuthSdkError from './AuthSdkError';\nimport OAuthError from './OAuthError';\nimport WWWAuthError from './WWWAuthError';\n\nfunction isAuthApiError(obj: any): obj is AuthApiError {\n return (obj instanceof AuthApiError);\n}\n\nfunction isOAuthError(obj: any): obj is OAuthError {\n return (obj instanceof OAuthError);\n}\n\nfunction isWWWAuthError(obj: any): obj is WWWAuthError {\n return (obj instanceof WWWAuthError);\n}\n\nexport {\n isAuthApiError,\n isOAuthError,\n isWWWAuthError,\n AuthApiError,\n AuthPollStopError,\n AuthSdkError,\n OAuthError,\n WWWAuthError\n};\n\nexport * from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA;AACA;AACA;AACA;AACA;AAyBA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,cAAc,CAACC,GAAQ,EAAuB;EACrD,OAAQA,GAAG,YAAYC,qBAAY;AACrC;AAEA,SAASC,YAAY,CAACF,GAAQ,EAAqB;EACjD,OAAQA,GAAG,YAAYG,mBAAU;AACnC;AAEA,SAASC,cAAc,CAACJ,GAAQ,EAAuB;EACrD,OAAQA,GAAG,YAAYK,qBAAY;AACrC"}
|
package/cjs/features.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports.getUserAgent = getUserAgent;
|
|
4
4
|
exports.hasTextEncoder = hasTextEncoder;
|
|
5
5
|
exports.isBrowser = isBrowser;
|
|
6
|
+
exports.isDPoPSupported = isDPoPSupported;
|
|
6
7
|
exports.isFingerprintSupported = isFingerprintSupported;
|
|
7
8
|
exports.isHTTPS = isHTTPS;
|
|
8
9
|
exports.isIE11OrLess = isIE11OrLess;
|
|
@@ -55,9 +56,12 @@ function isPopupPostMessageSupported() {
|
|
|
55
56
|
}
|
|
56
57
|
return false;
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function isWebCryptoSubtleSupported() {
|
|
59
60
|
return typeof _crypto.webcrypto !== 'undefined' && _crypto.webcrypto !== null && typeof _crypto.webcrypto.subtle !== 'undefined' && typeof Uint8Array !== 'undefined';
|
|
60
61
|
}
|
|
62
|
+
function isTokenVerifySupported() {
|
|
63
|
+
return isWebCryptoSubtleSupported();
|
|
64
|
+
}
|
|
61
65
|
function hasTextEncoder() {
|
|
62
66
|
return typeof TextEncoder !== 'undefined';
|
|
63
67
|
}
|
|
@@ -74,4 +78,9 @@ function isLocalhost() {
|
|
|
74
78
|
// eslint-disable-next-line compat/compat
|
|
75
79
|
return isBrowser() && window.location.hostname === 'localhost';
|
|
76
80
|
}
|
|
81
|
+
|
|
82
|
+
// For now, DPoP is only supported on browsers
|
|
83
|
+
function isDPoPSupported() {
|
|
84
|
+
return !isIE11OrLess() && typeof window.indexedDB !== 'undefined' && hasTextEncoder() && isWebCryptoSubtleSupported();
|
|
85
|
+
}
|
|
77
86
|
//# sourceMappingURL=features.js.map
|
package/cjs/features.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","names":["isWindowsPhone","isBrowser","document","window","isIE11OrLess","documentMode","getUserAgent","navigator","userAgent","isFingerprintSupported","agent","test","isPopupPostMessageSupported","isIE8or9","postMessage","
|
|
1
|
+
{"version":3,"file":"features.js","names":["isWindowsPhone","isBrowser","document","window","isIE11OrLess","documentMode","getUserAgent","navigator","userAgent","isFingerprintSupported","agent","test","isPopupPostMessageSupported","isIE8or9","postMessage","isWebCryptoSubtleSupported","webcrypto","subtle","Uint8Array","isTokenVerifySupported","hasTextEncoder","TextEncoder","isPKCESupported","isHTTPS","location","protocol","isLocalhost","hostname","isDPoPSupported","indexedDB"],"sources":["../../lib/features.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/* eslint-disable node/no-unsupported-features/node-builtins */\n/* global document, window, TextEncoder, navigator */\n\nimport { webcrypto } from './crypto';\n\nconst isWindowsPhone = /windows phone|iemobile|wpdesktop/i;\t\n\nexport function isBrowser() {\n return typeof document !== 'undefined' && typeof window !== 'undefined';\n}\n\nexport function isIE11OrLess() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n return !!documentMode && documentMode <= 11;\n}\n\nexport function getUserAgent() {\n return navigator.userAgent;\n}\n\nexport function isFingerprintSupported() {\n const agent = getUserAgent();\n return agent && !isWindowsPhone.test(agent);\t\n}\n\nexport function isPopupPostMessageSupported() {\n if (!isBrowser()) {\n return false;\n }\n const documentMode = (document as any).documentMode;\n var isIE8or9 = documentMode && documentMode < 10;\n if (typeof window.postMessage !== 'undefined' && !isIE8or9) {\n return true;\n }\n return false;\n}\n\nfunction isWebCryptoSubtleSupported () {\n return typeof webcrypto !== 'undefined'\n && webcrypto !== null\n && typeof webcrypto.subtle !== 'undefined'\n && typeof Uint8Array !== 'undefined';\n}\n\nexport function isTokenVerifySupported() {\n return isWebCryptoSubtleSupported();\n}\n\nexport function hasTextEncoder() {\n return typeof TextEncoder !== 'undefined';\n}\n\nexport function isPKCESupported() {\n return isTokenVerifySupported() && hasTextEncoder();\n}\n\nexport function isHTTPS() {\n if (!isBrowser()) {\n return false;\n }\n return window.location.protocol === 'https:';\n}\n\nexport function isLocalhost() {\n // eslint-disable-next-line compat/compat\n return isBrowser() && window.location.hostname === 'localhost';\n}\n\n// For now, DPoP is only supported on browsers\nexport function isDPoPSupported () {\n return !isIE11OrLess() &&\n typeof window.indexedDB !== 'undefined' &&\n hasTextEncoder() &&\n isWebCryptoSubtleSupported();\n}\n"],"mappings":";;;;;;;;;;;;;AAeA;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAIA,MAAMA,cAAc,GAAG,mCAAmC;AAEnD,SAASC,SAAS,GAAG;EAC1B,OAAO,OAAOC,QAAQ,KAAK,WAAW,IAAI,OAAOC,MAAM,KAAK,WAAW;AACzE;AAEO,SAASC,YAAY,GAAG;EAC7B,IAAI,CAACH,SAAS,EAAE,EAAE;IAChB,OAAO,KAAK;EACd;EACA,MAAMI,YAAY,GAAIH,QAAQ,CAASG,YAAY;EACnD,OAAO,CAAC,CAACA,YAAY,IAAIA,YAAY,IAAI,EAAE;AAC7C;AAEO,SAASC,YAAY,GAAG;EAC7B,OAAOC,SAAS,CAACC,SAAS;AAC5B;AAEO,SAASC,sBAAsB,GAAG;EACvC,MAAMC,KAAK,GAAGJ,YAAY,EAAE;EAC5B,OAAOI,KAAK,IAAI,CAACV,cAAc,CAACW,IAAI,CAACD,KAAK,CAAC;AAC7C;AAEO,SAASE,2BAA2B,GAAG;EAC5C,IAAI,CAACX,SAAS,EAAE,EAAE;IAChB,OAAO,KAAK;EACd;EACA,MAAMI,YAAY,GAAIH,QAAQ,CAASG,YAAY;EACnD,IAAIQ,QAAQ,GAAGR,YAAY,IAAIA,YAAY,GAAG,EAAE;EAChD,IAAI,OAAOF,MAAM,CAACW,WAAW,KAAK,WAAW,IAAI,CAACD,QAAQ,EAAE;IAC1D,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd;AAEA,SAASE,0BAA0B,GAAI;EACrC,OAAO,OAAOC,iBAAS,KAAK,WAAW,IAClCA,iBAAS,KAAK,IAAI,IAClB,OAAOA,iBAAS,CAACC,MAAM,KAAK,WAAW,IACvC,OAAOC,UAAU,KAAK,WAAW;AACxC;AAEO,SAASC,sBAAsB,GAAG;EACvC,OAAOJ,0BAA0B,EAAE;AACrC;AAEO,SAASK,cAAc,GAAG;EAC/B,OAAO,OAAOC,WAAW,KAAK,WAAW;AAC3C;AAEO,SAASC,eAAe,GAAG;EAChC,OAAOH,sBAAsB,EAAE,IAAIC,cAAc,EAAE;AACrD;AAEO,SAASG,OAAO,GAAG;EACxB,IAAI,CAACtB,SAAS,EAAE,EAAE;IAChB,OAAO,KAAK;EACd;EACA,OAAOE,MAAM,CAACqB,QAAQ,CAACC,QAAQ,KAAK,QAAQ;AAC9C;AAEO,SAASC,WAAW,GAAG;EAC5B;EACA,OAAOzB,SAAS,EAAE,IAAIE,MAAM,CAACqB,QAAQ,CAACG,QAAQ,KAAK,WAAW;AAChE;;AAEA;AACO,SAASC,eAAe,GAAI;EACjC,OAAO,CAACxB,YAAY,EAAE,IACpB,OAAOD,MAAM,CAAC0B,SAAS,KAAK,WAAW,IACvCT,cAAc,EAAE,IAChBL,0BAA0B,EAAE;AAChC"}
|
|
@@ -20,7 +20,7 @@ var _features = require("../features");
|
|
|
20
20
|
class OktaUserAgent {
|
|
21
21
|
constructor() {
|
|
22
22
|
// add base sdk env
|
|
23
|
-
this.environments = [`okta-auth-js/${"7.
|
|
23
|
+
this.environments = [`okta-auth-js/${"7.7.1"}`];
|
|
24
24
|
this.maybeAddNodeEnvironment();
|
|
25
25
|
}
|
|
26
26
|
addEnvironment(env) {
|
|
@@ -32,7 +32,7 @@ class OktaUserAgent {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
getVersion() {
|
|
35
|
-
return "7.
|
|
35
|
+
return "7.7.1";
|
|
36
36
|
}
|
|
37
37
|
maybeAddNodeEnvironment() {
|
|
38
38
|
if ((0, _features.isBrowser)() || !process || !process.versions) {
|
package/cjs/http/request.js
CHANGED
|
@@ -22,16 +22,6 @@ var _errors = require("../errors");
|
|
|
22
22
|
|
|
23
23
|
/* eslint-disable complexity */
|
|
24
24
|
|
|
25
|
-
const parseInsufficientAuthenticationError = header => {
|
|
26
|
-
if (!header) {
|
|
27
|
-
throw new _errors.AuthSdkError('Missing header string');
|
|
28
|
-
}
|
|
29
|
-
return header.split(',').map(part => part.trim()).map(part => part.split('=')).reduce((acc, curr) => {
|
|
30
|
-
// unwrap quotes from value
|
|
31
|
-
acc[curr[0]] = curr[1].replace(/^"(.*)"$/, '$1');
|
|
32
|
-
return acc;
|
|
33
|
-
}, {});
|
|
34
|
-
};
|
|
35
25
|
const formatError = (sdk, error) => {
|
|
36
26
|
if (error instanceof Error) {
|
|
37
27
|
// fetch() can throw exceptions
|
|
@@ -58,27 +48,29 @@ const formatError = (sdk, error) => {
|
|
|
58
48
|
if (sdk.options.transformErrorXHR) {
|
|
59
49
|
resp = sdk.options.transformErrorXHR((0, _util.clone)(resp));
|
|
60
50
|
}
|
|
51
|
+
|
|
52
|
+
//
|
|
53
|
+
const wwwAuthHeader = _errors.WWWAuthError.getWWWAuthenticateHeader(resp?.headers) ?? '';
|
|
61
54
|
if (serverErr.error && serverErr.error_description) {
|
|
62
|
-
err = new _errors.OAuthError(serverErr.error, serverErr.error_description);
|
|
55
|
+
err = new _errors.OAuthError(serverErr.error, serverErr.error_description, resp);
|
|
63
56
|
} else {
|
|
64
|
-
err = new _errors.AuthApiError(serverErr, resp
|
|
57
|
+
err = new _errors.AuthApiError(serverErr, resp, {
|
|
58
|
+
wwwAuthHeader
|
|
59
|
+
});
|
|
65
60
|
}
|
|
66
|
-
if (resp?.status
|
|
67
|
-
const
|
|
68
|
-
|
|
61
|
+
if (wwwAuthHeader && resp?.status >= 400 && resp?.status < 500) {
|
|
62
|
+
const wwwAuthErr = _errors.WWWAuthError.parseHeader(wwwAuthHeader);
|
|
63
|
+
// check for 403 to avoid breaking change
|
|
64
|
+
if (resp.status === 403 && wwwAuthErr?.error === 'insufficient_authentication_context') {
|
|
69
65
|
// eslint-disable-next-line camelcase
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
acr_values
|
|
75
|
-
} = parseInsufficientAuthenticationError(resp?.headers?.['www-authenticate']);
|
|
76
|
-
if (error === 'insufficient_authentication_context') {
|
|
66
|
+
const {
|
|
67
|
+
max_age,
|
|
68
|
+
acr_values
|
|
69
|
+
} = wwwAuthErr.parameters;
|
|
77
70
|
err = new _errors.AuthApiError({
|
|
78
|
-
errorSummary: error,
|
|
79
|
-
// eslint-disable-next-line camelcase
|
|
71
|
+
errorSummary: wwwAuthErr.error,
|
|
80
72
|
errorCauses: [{
|
|
81
|
-
errorSummary:
|
|
73
|
+
errorSummary: wwwAuthErr.errorDescription
|
|
82
74
|
}]
|
|
83
75
|
}, resp, {
|
|
84
76
|
// eslint-disable-next-line camelcase
|
|
@@ -88,8 +80,15 @@ const formatError = (sdk, error) => {
|
|
|
88
80
|
acr_values
|
|
89
81
|
})
|
|
90
82
|
});
|
|
83
|
+
} else if (wwwAuthErr?.scheme === 'DPoP') {
|
|
84
|
+
err = wwwAuthErr;
|
|
91
85
|
}
|
|
86
|
+
// else {
|
|
87
|
+
// // WWWAuthError.parseHeader may return null, only overwrite if !null
|
|
88
|
+
// err = wwwAuthErr ?? err;
|
|
89
|
+
// }
|
|
92
90
|
}
|
|
91
|
+
|
|
93
92
|
return err;
|
|
94
93
|
};
|
|
95
94
|
function httpRequest(sdk, options) {
|