@okta/okta-auth-js 7.5.1 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +168 -4
- package/cjs/base/types.js.map +1 -1
- package/cjs/core/ServiceManager/browser.js +10 -2
- package/cjs/core/ServiceManager/browser.js.map +1 -1
- package/cjs/core/types/Service.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/authenticator/Authenticator.js.map +1 -1
- package/cjs/idx/authenticator/OktaPassword.js +16 -4
- package/cjs/idx/authenticator/OktaPassword.js.map +1 -1
- package/cjs/idx/run.js +6 -3
- package/cjs/idx/run.js.map +1 -1
- package/cjs/idx/types/idx-js.js.map +1 -1
- package/cjs/idx/types/options.js.map +1 -1
- package/cjs/oidc/TokenManager.js +17 -1
- package/cjs/oidc/TokenManager.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 +77 -27
- package/cjs/oidc/endpoints/token.js.map +1 -1
- package/cjs/oidc/exchangeCodeForTokens.js +51 -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 +12 -0
- package/cjs/oidc/handleOAuthResponse.js.map +1 -1
- package/cjs/oidc/mixin/index.js +79 -2
- package/cjs/oidc/mixin/index.js.map +1 -1
- package/cjs/oidc/options/OAuthOptionsConstructor.js +3 -1
- package/cjs/oidc/options/OAuthOptionsConstructor.js.map +1 -1
- package/cjs/oidc/renewToken.js +4 -2
- package/cjs/oidc/renewToken.js.map +1 -1
- package/cjs/oidc/renewTokens.js +3 -1
- package/cjs/oidc/renewTokens.js.map +1 -1
- package/cjs/oidc/renewTokensWithRefresh.js +13 -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/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/prepareTokenParams.js +3 -0
- package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
- package/cjs/services/RenewOnTabActivationService.js +64 -0
- package/cjs/services/RenewOnTabActivationService.js.map +1 -0
- package/cjs/services/index.js +11 -0
- package/cjs/services/index.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/ServiceManager/browser.js +9 -2
- package/esm/browser/core/ServiceManager/browser.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/authenticator/Authenticator.js.map +1 -1
- package/esm/browser/idx/authenticator/OktaPassword.js +17 -4
- package/esm/browser/idx/authenticator/OktaPassword.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/types/idx-js.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 +13 -1
- 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 +57 -24
- 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 +40 -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 +10 -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 +78 -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 +2 -1
- 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 +4 -2
- package/esm/browser/oidc/renewToken.js.map +1 -1
- package/esm/browser/oidc/renewTokens.js +4 -1
- package/esm/browser/oidc/renewTokens.js.map +1 -1
- package/esm/browser/oidc/renewTokensWithRefresh.js +12 -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/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/RenewOnTabActivationService.js +67 -0
- package/esm/browser/services/RenewOnTabActivationService.js.map +1 -0
- 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/authenticator/Authenticator.js.map +1 -1
- package/esm/node/idx/authenticator/OktaPassword.js +17 -4
- package/esm/node/idx/authenticator/OktaPassword.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/types/idx-js.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 +13 -1
- 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 +57 -24
- 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 +40 -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 +10 -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 +78 -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 +2 -1
- 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 +4 -2
- package/esm/node/oidc/renewToken.js.map +1 -1
- package/esm/node/oidc/renewTokens.js +4 -1
- package/esm/node/oidc/renewTokens.js.map +1 -1
- package/esm/node/oidc/renewTokensWithRefresh.js +12 -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/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 +5 -6
- package/types/lib/base/types.d.ts +1 -0
- package/types/lib/core/options.d.ts +1 -0
- package/types/lib/core/types/Service.d.ts +7 -1
- 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/authenticator/Authenticator.d.ts +1 -1
- package/types/lib/idx/authenticator/OktaPassword.d.ts +2 -1
- package/types/lib/idx/options.d.ts +1 -0
- package/types/lib/idx/types/idx-js.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 +2 -0
- package/types/lib/oidc/types/api.d.ts +14 -0
- package/types/lib/oidc/types/options.d.ts +3 -0
- package/types/lib/services/RenewOnTabActivationService.d.ts +16 -0
- package/types/lib/services/index.d.ts +1 -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,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 7.6.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#1495](https://github.com/okta/okta-auth-js/pull/1495) add: DPoP support
|
|
8
|
+
- [#1507](https://github.com/okta/okta-auth-js/pull/1507) add: new method `getOrRenewAccessToken`
|
|
9
|
+
- [#1505](https://github.com/okta/okta-auth-js/pull/1505) add: support of `revokeSessions` param for `OktaPassword` authenticator (can be used in `reset-authenticator` remediation)
|
|
10
|
+
- [#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
|
|
11
|
+
- [#1512](https://github.com/okta/okta-auth-js/pull/1512) add: new service `RenewOnTabActivation`
|
|
12
|
+
|
|
13
|
+
### Bug Fix
|
|
14
|
+
|
|
15
|
+
- [#1513](https://github.com/okta/okta-auth-js/pull/1513) fix: restricts `issuer` "-admin" validation to `.okta` domain
|
|
16
|
+
|
|
3
17
|
## 7.5.1
|
|
4
18
|
|
|
5
19
|
### Bug Fix
|
package/README.md
CHANGED
|
@@ -36,6 +36,12 @@ You can learn more on the [Okta + JavaScript][lang-landing] page in our document
|
|
|
36
36
|
|
|
37
37
|
This library uses semantic versioning and follows Okta's [library version policy](https://developer.okta.com/code/library-versions/).
|
|
38
38
|
|
|
39
|
+
> :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning:<br>
|
|
40
|
+
#### :warning: Bulletin Board :warning:
|
|
41
|
+
* Review [Future of autoRenew](./docs/autoRenew-notice.md) <br>
|
|
42
|
+
* Review [End of Third-Party Cookies](https://developer.okta.com/blog/2024/02/29/third-party-cookies) <br>
|
|
43
|
+
> :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning::warning:<br>
|
|
44
|
+
|
|
39
45
|
## Release Status
|
|
40
46
|
|
|
41
47
|
:heavy_check_mark: The current stable major version series is: `7.x`
|
|
@@ -43,7 +49,7 @@ This library uses semantic versioning and follows Okta's [library version policy
|
|
|
43
49
|
| Version | Status |
|
|
44
50
|
| ------- | -------------------------------- |
|
|
45
51
|
| `7.x` | :heavy_check_mark: Stable |
|
|
46
|
-
| `6.x` | :
|
|
52
|
+
| `6.x` | :x: Retired |
|
|
47
53
|
| `5.x` | :x: Retired |
|
|
48
54
|
| `4.x` | :x: Retired |
|
|
49
55
|
| `3.x` | :x: Retired |
|
|
@@ -96,7 +102,7 @@ require('@okta/okta-auth-js/polyfill');
|
|
|
96
102
|
The built polyfill bundle is also available on our global CDN. Include the following script in your HTML file to load before any other scripts:
|
|
97
103
|
|
|
98
104
|
```html
|
|
99
|
-
<script src="https://global.oktacdn.com/okta-auth-js/7.
|
|
105
|
+
<script src="https://global.oktacdn.com/okta-auth-js/7.5.1/okta-auth-js.polyfill.js" type="text/javascript" integrity="sha384-EBFsuVdi4TGp/DwS7b+t+wA8zmWK10omkX05ZjJWQhzWuW31t7FWEGOnHQeIr8+L" crossorigin="anonymous"></script>
|
|
100
106
|
```
|
|
101
107
|
|
|
102
108
|
> :warning: The version shown in this sample may be older than the current version. We recommend using the highest version available
|
|
@@ -171,7 +177,7 @@ If you are using the JS on a web page from the browser, you can copy the `node_m
|
|
|
171
177
|
The built library bundle is also available on our global CDN. Include the following script in your HTML file to load before your application script:
|
|
172
178
|
|
|
173
179
|
```html
|
|
174
|
-
<script src="https://global.oktacdn.com/okta-auth-js/7.
|
|
180
|
+
<script src="https://global.oktacdn.com/okta-auth-js/7.5.1/okta-auth-js.min.js" type="text/javascript" integrity="sha384-6epSwnIDkI5zFNEVNjEYy3A7aSZ+C7ehmEyG8zDJZfP9Bmnxc51TK8du+2me4pjb" crossorigin="anonymous"></script>
|
|
175
181
|
```
|
|
176
182
|
|
|
177
183
|
> :warning: The version shown in this sample may be older than the current version. We recommend using the highest version available
|
|
@@ -342,7 +348,7 @@ Most applications will handle an OAuth callback using a special route/page, sepa
|
|
|
342
348
|
**It’s important that no other app logic runs until the async parseFromUrl / token manager logic is complete**
|
|
343
349
|
3. After this, continue normal app logic
|
|
344
350
|
|
|
345
|
-
```
|
|
351
|
+
```javascript
|
|
346
352
|
|
|
347
353
|
async function main() {
|
|
348
354
|
// create OktaAuth instance
|
|
@@ -393,6 +399,105 @@ Additionally, if using hash routing, we recommend using PKCE and responseMode "q
|
|
|
393
399
|
2. Add tokens to the `TokenManager`: [tokenManager.setTokens](#tokenmanagersettokenstokens)
|
|
394
400
|
6. Read saved route and redirect to it: [getOriginalUri](#getoriginaluristate)
|
|
395
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
|
+
|
|
396
501
|
## Configuration reference
|
|
397
502
|
|
|
398
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/)
|
|
@@ -464,6 +569,13 @@ A client-provided string that will be passed to the server endpoint and returned
|
|
|
464
569
|
|
|
465
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`.
|
|
466
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
|
+
|
|
467
579
|
#### responseMode
|
|
468
580
|
|
|
469
581
|
When requesting tokens using [token.getWithRedirect](#tokengetwithredirectoptions) values will be returned as parameters appended to the [redirectUri](#configuration-options).
|
|
@@ -843,6 +955,8 @@ services: {
|
|
|
843
955
|
autoRenew: true,
|
|
844
956
|
autoRemove: true,
|
|
845
957
|
syncStorage: true,
|
|
958
|
+
renewOnTabActivation: true,
|
|
959
|
+
tabInactivityDuration: 1800 // seconds
|
|
846
960
|
}
|
|
847
961
|
```
|
|
848
962
|
|
|
@@ -866,6 +980,15 @@ Automatically syncs tokens across browser tabs when it's supported in browser (b
|
|
|
866
980
|
|
|
867
981
|
This is accomplished by selecting a single tab to handle the network requests to refresh the tokens and broadcasting to the other tabs. This is done to avoid all tabs sending refresh requests simultaneously, which can cause rate limiting/throttling issues.
|
|
868
982
|
|
|
983
|
+
#### `renewOnTabActivation`
|
|
984
|
+
> NOTE: This service requires `autoRenew: true`
|
|
985
|
+
|
|
986
|
+
When enabled (`{ autoRenew: true, renewOnTabActivation: true }`), this service binds a handler to the [Page Visibility API](https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API) which attempts a token renew (if needed) when the tab becomes active after a (configurable) inactivity period
|
|
987
|
+
|
|
988
|
+
#### `tabInactivityDuration`
|
|
989
|
+
The amount of time, in seconds, a tab needs to be inactive for the `RenewOnTabActivation` service to attempt a token renew. Defaults to `1800` (30 mins)
|
|
990
|
+
|
|
991
|
+
|
|
869
992
|
## API Reference
|
|
870
993
|
<!-- no toc -->
|
|
871
994
|
* [start](#start)
|
|
@@ -886,6 +1009,7 @@ This is accomplished by selecting a single tab to handle the network requests to
|
|
|
886
1009
|
* [getUser](#getuser)
|
|
887
1010
|
* [getIdToken](#getidtoken)
|
|
888
1011
|
* [getAccessToken](#getaccesstoken)
|
|
1012
|
+
* [getOrRenewAccessToken](#getorrenewaccesstoken)
|
|
889
1013
|
* [storeTokensFromRedirect](#storetokensfromredirect)
|
|
890
1014
|
* [setOriginalUri](#setoriginaluriuri)
|
|
891
1015
|
* [getOriginalUri](#getoriginaluristate)
|
|
@@ -897,6 +1021,9 @@ This is accomplished by selecting a single tab to handle the network requests to
|
|
|
897
1021
|
* [tx.resume](#txresume)
|
|
898
1022
|
* [tx.exists](#txexists)
|
|
899
1023
|
* [transaction.status](#transactionstatus)
|
|
1024
|
+
* [getDPoPAuthorizationHeaders](#getdpopauthorizationheaders)
|
|
1025
|
+
* [parseUseDPoPNonceError](#parseusedpopnonceerror)
|
|
1026
|
+
* [clearDPoPStorage](#cleardpopstorage)
|
|
900
1027
|
* [session](#session)
|
|
901
1028
|
* [session.setCookieAndRedirect](#sessionsetcookieandredirectsessiontoken-redirecturi)
|
|
902
1029
|
* [session.exists](#sessionexists)
|
|
@@ -1154,6 +1281,10 @@ Returns the id token string retrieved from [authState](#authstatemanager) if it
|
|
|
1154
1281
|
|
|
1155
1282
|
Returns the access token string retrieved from [authState](#authstatemanager) if it exists.
|
|
1156
1283
|
|
|
1284
|
+
### `getOrRenewAccessToken()`
|
|
1285
|
+
|
|
1286
|
+
Returns the access token string if it exists. Returns `null` if the access token doesn't exist or a renewal cannot be completed
|
|
1287
|
+
|
|
1157
1288
|
### `storeTokensFromRedirect()`
|
|
1158
1289
|
|
|
1159
1290
|
> :hourglass: async
|
|
@@ -1248,6 +1379,39 @@ See [authn API](docs/authn.md#txexists).
|
|
|
1248
1379
|
|
|
1249
1380
|
See [authn API](docs/authn.md#transactionstatus).
|
|
1250
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
|
+
|
|
1251
1415
|
### `session`
|
|
1252
1416
|
|
|
1253
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":""}
|
|
@@ -20,6 +20,7 @@ var _util = require("../../util");
|
|
|
20
20
|
const AUTO_RENEW = 'autoRenew';
|
|
21
21
|
const SYNC_STORAGE = 'syncStorage';
|
|
22
22
|
const LEADER_ELECTION = 'leaderElection';
|
|
23
|
+
const RENEW_ON_TAB_ACTIVATION = 'renewOnTabActivation';
|
|
23
24
|
class ServiceManager {
|
|
24
25
|
constructor(sdk, options = {}) {
|
|
25
26
|
this.sdk = sdk;
|
|
@@ -120,6 +121,11 @@ class ServiceManager {
|
|
|
120
121
|
...this.options
|
|
121
122
|
});
|
|
122
123
|
break;
|
|
124
|
+
case RENEW_ON_TAB_ACTIVATION:
|
|
125
|
+
service = new _services.RenewOnTabActivationService(tokenManager, {
|
|
126
|
+
...this.options
|
|
127
|
+
});
|
|
128
|
+
break;
|
|
123
129
|
default:
|
|
124
130
|
throw new Error(`Unknown service ${name}`);
|
|
125
131
|
}
|
|
@@ -127,10 +133,12 @@ class ServiceManager {
|
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
135
|
exports.ServiceManager = ServiceManager;
|
|
130
|
-
(0, _defineProperty2.default)(ServiceManager, "knownServices", [AUTO_RENEW, SYNC_STORAGE, LEADER_ELECTION]);
|
|
136
|
+
(0, _defineProperty2.default)(ServiceManager, "knownServices", [AUTO_RENEW, SYNC_STORAGE, LEADER_ELECTION, RENEW_ON_TAB_ACTIVATION]);
|
|
131
137
|
(0, _defineProperty2.default)(ServiceManager, "defaultOptions", {
|
|
132
138
|
autoRenew: true,
|
|
133
139
|
autoRemove: true,
|
|
134
|
-
syncStorage: true
|
|
140
|
+
syncStorage: true,
|
|
141
|
+
renewOnTabActivation: true,
|
|
142
|
+
tabInactivityDuration: 1800 // 30 mins in seconds
|
|
135
143
|
});
|
|
136
144
|
//# sourceMappingURL=browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","names":["AUTO_RENEW","SYNC_STORAGE","LEADER_ELECTION","ServiceManager","constructor","sdk","options","onLeader","bind","autoRenew","autoRemove","syncStorage","tokenManager","getOptions","electionChannelName","broadcastChannelName","Object","assign","defaultOptions","clientId","syncChannelName","removeNils","started","services","Map","knownServices","forEach","name","svc","createService","set","startServices","isLeader","getService","isLeaderRequired","values","some","srv","canStart","requiresLeadership","start","stop","stopServices","get","entries","canStartService","isStarted","service","LeaderElectionService","AutoRenewService","SyncStorageService","Error"],"sources":["../../../../lib/core/ServiceManager/browser.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 {\n OAuthTransactionMeta,\n OAuthStorageManagerInterface,\n} from '../../oidc';\n\nimport {\n ServiceManagerInterface,\n ServiceInterface,\n ServiceManagerOptions,\n OktaAuthCoreInterface,\n OktaAuthCoreOptions\n} from '../types';\nimport { AutoRenewService
|
|
1
|
+
{"version":3,"file":"browser.js","names":["AUTO_RENEW","SYNC_STORAGE","LEADER_ELECTION","RENEW_ON_TAB_ACTIVATION","ServiceManager","constructor","sdk","options","onLeader","bind","autoRenew","autoRemove","syncStorage","tokenManager","getOptions","electionChannelName","broadcastChannelName","Object","assign","defaultOptions","clientId","syncChannelName","removeNils","started","services","Map","knownServices","forEach","name","svc","createService","set","startServices","isLeader","getService","isLeaderRequired","values","some","srv","canStart","requiresLeadership","start","stop","stopServices","get","entries","canStartService","isStarted","service","LeaderElectionService","AutoRenewService","SyncStorageService","RenewOnTabActivationService","Error","renewOnTabActivation","tabInactivityDuration"],"sources":["../../../../lib/core/ServiceManager/browser.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 {\n OAuthTransactionMeta,\n OAuthStorageManagerInterface,\n} from '../../oidc';\n\nimport {\n ServiceManagerInterface,\n ServiceInterface,\n ServiceManagerOptions,\n OktaAuthCoreInterface,\n OktaAuthCoreOptions\n} from '../types';\nimport { AutoRenewService,\n SyncStorageService,\n LeaderElectionService,\n RenewOnTabActivationService\n} from '../../services';\nimport { removeNils } from '../../util';\n\nconst AUTO_RENEW = 'autoRenew';\nconst SYNC_STORAGE = 'syncStorage';\nconst LEADER_ELECTION = 'leaderElection';\nconst RENEW_ON_TAB_ACTIVATION = 'renewOnTabActivation';\n\nexport class ServiceManager\n<\n M extends OAuthTransactionMeta,\n S extends OAuthStorageManagerInterface<M>,\n O extends OktaAuthCoreOptions\n>\nimplements ServiceManagerInterface \n{\n private sdk: OktaAuthCoreInterface<M, S, O>;\n private options: ServiceManagerOptions;\n private services: Map<string, ServiceInterface>;\n private started: boolean;\n\n private static knownServices = [AUTO_RENEW, SYNC_STORAGE, LEADER_ELECTION, RENEW_ON_TAB_ACTIVATION];\n\n private static defaultOptions: ServiceManagerOptions = {\n autoRenew: true,\n autoRemove: true,\n syncStorage: true,\n renewOnTabActivation: true,\n tabInactivityDuration: 1800, // 30 mins in seconds\n };\n\n constructor(sdk: OktaAuthCoreInterface<M, S, O>, options: ServiceManagerOptions = {}) {\n this.sdk = sdk;\n this.onLeader = this.onLeader.bind(this);\n\n // TODO: backwards compatibility, remove in next major version - OKTA-473815\n const { autoRenew, autoRemove, syncStorage } = sdk.tokenManager.getOptions();\n options.electionChannelName = options.electionChannelName || options.broadcastChannelName;\n this.options = Object.assign({}, \n ServiceManager.defaultOptions,\n { autoRenew, autoRemove, syncStorage }, \n {\n electionChannelName: `${sdk.options.clientId}-election`,\n syncChannelName: `${sdk.options.clientId}-sync`,\n },\n removeNils(options)\n );\n\n this.started = false;\n this.services = new Map();\n\n ServiceManager.knownServices.forEach(name => {\n const svc = this.createService(name);\n if (svc) {\n this.services.set(name, svc);\n }\n });\n }\n\n private async onLeader() {\n if (this.started) {\n // Start services that requires leadership\n await this.startServices();\n }\n }\n\n isLeader() {\n return (this.getService(LEADER_ELECTION) as LeaderElectionService)?.isLeader();\n }\n\n isLeaderRequired() {\n return [...this.services.values()].some(srv => srv.canStart() && srv.requiresLeadership());\n }\n\n async start() {\n if (this.started) {\n return; // noop if services have already started\n }\n await this.startServices();\n this.started = true;\n }\n \n async stop() {\n await this.stopServices();\n this.started = false;\n }\n\n getService(name: string): ServiceInterface | undefined {\n return this.services.get(name);\n }\n\n private async startServices() {\n for (const [name, srv] of this.services.entries()) {\n if (this.canStartService(name, srv)) {\n await srv.start();\n }\n }\n }\n\n private async stopServices() {\n for (const srv of this.services.values()) {\n await srv.stop();\n }\n }\n\n // eslint-disable-next-line complexity\n private canStartService(name: string, srv: ServiceInterface): boolean {\n let canStart = srv.canStart() && !srv.isStarted();\n // only start election if a leader is required\n if (name === LEADER_ELECTION) {\n canStart &&= this.isLeaderRequired();\n } else if (srv.requiresLeadership()) {\n canStart &&= this.isLeader();\n }\n return canStart;\n }\n\n private createService(name: string): ServiceInterface {\n const tokenManager = this.sdk.tokenManager;\n\n let service: ServiceInterface;\n switch (name) {\n case LEADER_ELECTION:\n service = new LeaderElectionService({...this.options, onLeader: this.onLeader});\n break;\n case AUTO_RENEW:\n service = new AutoRenewService(tokenManager, {...this.options});\n break;\n case SYNC_STORAGE:\n service = new SyncStorageService(tokenManager, {...this.options});\n break;\n case RENEW_ON_TAB_ACTIVATION:\n service = new RenewOnTabActivationService(tokenManager, {...this.options});\n break;\n default:\n throw new Error(`Unknown service ${name}`);\n }\n return service;\n }\n\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Service.js","names":[],"sources":["../../../../lib/core/types/Service.ts"],"sourcesContent":["// only add methods needed internally\nexport interface ServiceInterface {\n start(): Promise<void>;\n stop(): Promise<void>;\n isStarted(): boolean;\n canStart(): boolean;\n requiresLeadership(): boolean;\n}\n\nexport interface ServiceManagerInterface {\n isLeaderRequired(): boolean;\n isLeader(): boolean;\n start(): Promise<void>;\n stop(): Promise<void>;\n getService(name: string): ServiceInterface | undefined;\n}\n\nexport interface AutoRenewServiceOptions {\n autoRenew?: boolean;\n autoRemove?: boolean;\n}\n\nexport interface SyncStorageServiceOptions {\n syncStorage?: boolean;\n syncChannelName?: string;\n}\n\nexport interface LeaderElectionServiceOptions {\n electionChannelName?: string;\n // TODO: remove in next major version - OKTA-473815\n broadcastChannelName?: string;\n}\n\nexport type ServiceManagerOptions
|
|
1
|
+
{"version":3,"file":"Service.js","names":[],"sources":["../../../../lib/core/types/Service.ts"],"sourcesContent":["// only add methods needed internally\nexport interface ServiceInterface {\n start(): Promise<void>;\n stop(): Promise<void>;\n isStarted(): boolean;\n canStart(): boolean;\n requiresLeadership(): boolean;\n}\n\nexport interface ServiceManagerInterface {\n isLeaderRequired(): boolean;\n isLeader(): boolean;\n start(): Promise<void>;\n stop(): Promise<void>;\n getService(name: string): ServiceInterface | undefined;\n}\n\nexport interface AutoRenewServiceOptions {\n autoRenew?: boolean;\n autoRemove?: boolean;\n}\n\nexport interface SyncStorageServiceOptions {\n syncStorage?: boolean;\n syncChannelName?: string;\n}\n\nexport interface LeaderElectionServiceOptions {\n electionChannelName?: string;\n // TODO: remove in next major version - OKTA-473815\n broadcastChannelName?: string;\n}\n\ntype seconds = number;\n\nexport interface RenewOnTabActivationServiceOptions {\n renewOnTabActivation?: boolean;\n tabInactivityDuration?: seconds;\n}\n\nexport type ServiceManagerOptions =\n AutoRenewServiceOptions &\n SyncStorageServiceOptions &\n LeaderElectionServiceOptions &\n RenewOnTabActivationServiceOptions;\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
|