@okta/okta-auth-js 5.6.0 → 5.9.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 +51 -0
- package/README.md +28 -1
- package/cjs/OktaAuth.js +69 -35
- package/cjs/OktaAuth.js.map +1 -1
- package/cjs/OktaUserAgent.js +2 -2
- package/cjs/StorageManager.js +8 -0
- package/cjs/StorageManager.js.map +1 -1
- package/cjs/TransactionManager.js +24 -12
- package/cjs/TransactionManager.js.map +1 -1
- package/cjs/builderUtil.js +6 -0
- package/cjs/builderUtil.js.map +1 -1
- package/cjs/constants.js +3 -1
- package/cjs/constants.js.map +1 -1
- package/cjs/features.js +1 -1
- package/cjs/features.js.map +1 -1
- package/cjs/idx/authenticate.js +3 -18
- package/cjs/idx/authenticate.js.map +1 -1
- package/cjs/idx/flow/AuthenticationFlow.js +30 -0
- package/cjs/idx/flow/AuthenticationFlow.js.map +1 -0
- package/cjs/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.js +0 -0
- package/cjs/idx/flow/AuthenticationFlowMonitor.js.map +1 -0
- package/cjs/idx/{flowMonitors → flow}/FlowMonitor.js +0 -0
- package/cjs/idx/flow/FlowMonitor.js.map +1 -0
- package/cjs/idx/flow/FlowSpecification.js +49 -0
- package/cjs/idx/flow/FlowSpecification.js.map +1 -0
- package/cjs/idx/flow/PasswordRecoveryFlow.js +28 -0
- package/cjs/idx/flow/PasswordRecoveryFlow.js.map +1 -0
- package/cjs/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.js +0 -0
- package/cjs/idx/flow/PasswordRecoveryFlowMonitor.js.map +1 -0
- package/{esm/crypto/browser.js → cjs/idx/flow/RegistrationFlow.js} +15 -12
- package/cjs/idx/flow/RegistrationFlow.js.map +1 -0
- package/cjs/idx/{flowMonitors → flow}/RegistrationFlowMonitor.js +0 -0
- package/cjs/idx/flow/RegistrationFlowMonitor.js.map +1 -0
- package/cjs/idx/flow/RemediationFlow.js +2 -0
- package/{esm/types/Cookies.js.map → cjs/idx/flow/RemediationFlow.js.map} +1 -1
- package/cjs/idx/flow/index.js +119 -0
- package/cjs/idx/flow/index.js.map +1 -0
- package/cjs/idx/index.js +26 -0
- package/cjs/idx/index.js.map +1 -1
- package/cjs/idx/interact.js +5 -2
- package/cjs/idx/interact.js.map +1 -1
- package/cjs/idx/introspect.js +24 -7
- package/cjs/idx/introspect.js.map +1 -1
- package/cjs/idx/proceed.js +49 -0
- package/cjs/idx/proceed.js.map +1 -0
- package/cjs/idx/recoverPassword.js +3 -17
- package/cjs/idx/recoverPassword.js.map +1 -1
- package/cjs/idx/register.js +7 -16
- package/cjs/idx/register.js.map +1 -1
- package/cjs/idx/remediate.js +33 -37
- package/cjs/idx/remediate.js.map +1 -1
- package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js +3 -1
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/Identify.js +4 -2
- package/cjs/idx/remediators/Identify.js.map +1 -1
- package/cjs/idx/run.js +36 -8
- package/cjs/idx/run.js.map +1 -1
- package/cjs/idx/startTransaction.js +2 -0
- package/cjs/idx/startTransaction.js.map +1 -1
- package/cjs/idx/transactionMeta.js +77 -39
- package/cjs/idx/transactionMeta.js.map +1 -1
- package/cjs/idx/types/FlowIdentifier.js +2 -0
- package/{esm/types/AuthState.js.map → cjs/idx/types/FlowIdentifier.js.map} +1 -1
- package/cjs/idx/types/idx-js.js +5 -0
- package/cjs/idx/types/idx-js.js.map +1 -1
- package/cjs/idx/types/index.js +16 -0
- package/cjs/idx/types/index.js.map +1 -1
- package/cjs/oidc/endpoints/authorize.js +4 -1
- package/cjs/oidc/endpoints/authorize.js.map +1 -1
- package/cjs/oidc/getToken.js +14 -9
- package/cjs/oidc/getToken.js.map +1 -1
- package/cjs/oidc/getWithPopup.js +9 -2
- package/cjs/oidc/getWithPopup.js.map +1 -1
- package/cjs/oidc/getWithRedirect.js +2 -6
- package/cjs/oidc/getWithRedirect.js.map +1 -1
- package/cjs/oidc/renewTokens.js +28 -5
- package/cjs/oidc/renewTokens.js.map +1 -1
- package/cjs/oidc/util/browser.js +1 -13
- package/cjs/oidc/util/browser.js.map +1 -1
- package/cjs/oidc/util/loginRedirect.js +9 -5
- package/cjs/oidc/util/loginRedirect.js.map +1 -1
- package/cjs/oidc/util/urlParams.js +1 -1
- package/cjs/oidc/util/urlParams.js.map +1 -1
- package/cjs/options.js +12 -2
- package/cjs/options.js.map +1 -1
- package/cjs/server/serverStorage.js +2 -1
- package/cjs/server/serverStorage.js.map +1 -1
- package/cjs/tx/AuthTransaction.js +1 -3
- package/cjs/tx/AuthTransaction.js.map +1 -1
- package/cjs/tx/api.js +3 -0
- package/cjs/tx/api.js.map +1 -1
- package/cjs/types/Transaction.js.map +1 -1
- package/{esm/clock.js → cjs/util/emailVerify.js} +14 -18
- package/cjs/util/emailVerify.js.map +1 -0
- package/cjs/util/index.js +13 -0
- package/cjs/util/index.js.map +1 -1
- package/dist/okta-auth-js.min.js +2 -74
- package/dist/okta-auth-js.min.js.LICENSE.txt +32 -0
- package/dist/okta-auth-js.min.js.map +1 -1
- package/dist/okta-auth-js.polyfill.js +2 -18
- package/{esm/crypto/webcrypto.js → dist/okta-auth-js.polyfill.js.LICENSE.txt} +8 -4
- package/dist/okta-auth-js.polyfill.js.map +1 -1
- package/dist/okta-auth-js.umd.js +2 -74
- package/dist/okta-auth-js.umd.js.LICENSE.txt +32 -0
- package/dist/okta-auth-js.umd.js.map +1 -1
- package/esm/index.js +8368 -16
- package/esm/index.js.map +1 -1
- package/lib/OktaAuth.d.ts +7 -3
- package/lib/StorageManager.d.ts +1 -0
- package/lib/TransactionManager.d.ts +5 -1
- package/lib/constants.d.ts +1 -0
- package/lib/crypto/base64.d.ts +2 -2
- package/lib/crypto/oidcHash.d.ts +1 -1
- package/lib/crypto/verifyToken.d.ts +1 -1
- package/{esm/oidc/endpoints/index.js → lib/idx/flow/AuthenticationFlow.d.ts} +3 -5
- package/lib/idx/{flowMonitors → flow}/AuthenticationFlowMonitor.d.ts +0 -0
- package/lib/idx/{flowMonitors → flow}/FlowMonitor.d.ts +0 -0
- package/lib/idx/flow/FlowSpecification.d.ts +10 -0
- package/{esm/crypto/index.js → lib/idx/flow/PasswordRecoveryFlow.d.ts} +3 -6
- package/lib/idx/{flowMonitors → flow}/PasswordRecoveryFlowMonitor.d.ts +0 -0
- package/{esm/tx/TransactionState.js → lib/idx/flow/RegistrationFlow.d.ts} +3 -3
- package/lib/idx/{flowMonitors → flow}/RegistrationFlowMonitor.d.ts +0 -0
- package/lib/idx/flow/RemediationFlow.d.ts +13 -0
- package/lib/idx/{flowMonitors → flow}/index.d.ts +7 -2
- package/lib/idx/index.d.ts +2 -0
- package/lib/idx/introspect.d.ts +2 -1
- package/{esm/errors/AuthApiError.js → lib/idx/proceed.d.ts} +9 -19
- package/lib/idx/remediators/Base/AuthenticatorData.d.ts +1 -4
- package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +1 -4
- package/lib/idx/remediators/Identify.d.ts +1 -0
- package/lib/idx/run.d.ts +9 -9
- package/lib/idx/transactionMeta.d.ts +28 -4
- package/lib/idx/types/FlowIdentifier.d.ts +1 -0
- package/lib/idx/types/idx-js.d.ts +4 -0
- package/lib/idx/types/index.d.ts +14 -3
- package/lib/oidc/getToken.d.ts +2 -2
- package/lib/oidc/renewTokens.d.ts +0 -12
- package/lib/oidc/util/loginRedirect.d.ts +1 -1
- package/lib/types/OktaAuthOptions.d.ts +2 -0
- package/lib/types/Transaction.d.ts +2 -0
- package/lib/types/api.d.ts +20 -5
- package/{esm/errors/AuthPollStopError.js → lib/util/emailVerify.d.ts} +5 -8
- package/lib/util/index.d.ts +1 -0
- package/package.json +26 -14
- package/cjs/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/FlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
- package/cjs/idx/flowMonitors/index.js +0 -54
- package/cjs/idx/flowMonitors/index.js.map +0 -1
- package/esm/AuthStateManager.js +0 -214
- package/esm/AuthStateManager.js.map +0 -1
- package/esm/OktaAuth.js +0 -679
- package/esm/OktaAuth.js.map +0 -1
- package/esm/OktaUserAgent.js +0 -49
- package/esm/OktaUserAgent.js.map +0 -1
- package/esm/PromiseQueue.js +0 -71
- package/esm/PromiseQueue.js.map +0 -1
- package/esm/SavedObject.js +0 -91
- package/esm/SavedObject.js.map +0 -1
- package/esm/StorageManager.js +0 -182
- package/esm/StorageManager.js.map +0 -1
- package/esm/TokenManager.js +0 -455
- package/esm/TokenManager.js.map +0 -1
- package/esm/TransactionManager.js +0 -316
- package/esm/TransactionManager.js.map +0 -1
- package/esm/browser/browserStorage.js +0 -256
- package/esm/browser/browserStorage.js.map +0 -1
- package/esm/browser/fingerprint.js +0 -74
- package/esm/browser/fingerprint.js.map +0 -1
- package/esm/builderUtil.js +0 -50
- package/esm/builderUtil.js.map +0 -1
- package/esm/clock.js.map +0 -1
- package/esm/constants.js +0 -35
- package/esm/constants.js.map +0 -1
- package/esm/crypto/base64.js +0 -66
- package/esm/crypto/base64.js.map +0 -1
- package/esm/crypto/browser.js.map +0 -1
- package/esm/crypto/index.js.map +0 -1
- package/esm/crypto/node.js +0 -54
- package/esm/crypto/node.js.map +0 -1
- package/esm/crypto/oidcHash.js +0 -27
- package/esm/crypto/oidcHash.js.map +0 -1
- package/esm/crypto/verifyToken.js +0 -39
- package/esm/crypto/verifyToken.js.map +0 -1
- package/esm/crypto/webcrypto.js.map +0 -1
- package/esm/errors/AuthApiError.js.map +0 -1
- package/esm/errors/AuthPollStopError.js.map +0 -1
- package/esm/errors/AuthSdkError.js +0 -29
- package/esm/errors/AuthSdkError.js.map +0 -1
- package/esm/errors/CustomError.js +0 -21
- package/esm/errors/CustomError.js.map +0 -1
- package/esm/errors/OAuthError.js +0 -22
- package/esm/errors/OAuthError.js.map +0 -1
- package/esm/errors/index.js +0 -22
- package/esm/errors/index.js.map +0 -1
- package/esm/features.js +0 -64
- package/esm/features.js.map +0 -1
- package/esm/fetch/fetchRequest.js +0 -92
- package/esm/fetch/fetchRequest.js.map +0 -1
- package/esm/http/headers.js +0 -17
- package/esm/http/headers.js.map +0 -1
- package/esm/http/index.js +0 -3
- package/esm/http/index.js.map +0 -1
- package/esm/http/request.js +0 -145
- package/esm/http/request.js.map +0 -1
- package/esm/idx/authenticate.js +0 -47
- package/esm/idx/authenticate.js.map +0 -1
- package/esm/idx/cancel.js +0 -32
- package/esm/idx/cancel.js.map +0 -1
- package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js +0 -41
- package/esm/idx/flowMonitors/AuthenticationFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/FlowMonitor.js +0 -73
- package/esm/idx/flowMonitors/FlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js +0 -57
- package/esm/idx/flowMonitors/PasswordRecoveryFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/RegistrationFlowMonitor.js +0 -28
- package/esm/idx/flowMonitors/RegistrationFlowMonitor.js.map +0 -1
- package/esm/idx/flowMonitors/index.js +0 -16
- package/esm/idx/flowMonitors/index.js.map +0 -1
- package/esm/idx/handleInteractionCodeRedirect.js +0 -64
- package/esm/idx/handleInteractionCodeRedirect.js.map +0 -1
- package/esm/idx/headers.js +0 -39
- package/esm/idx/headers.js.map +0 -1
- package/esm/idx/index.js +0 -20
- package/esm/idx/index.js.map +0 -1
- package/esm/idx/interact.js +0 -83
- package/esm/idx/interact.js.map +0 -1
- package/esm/idx/introspect.js +0 -45
- package/esm/idx/introspect.js.map +0 -1
- package/esm/idx/recoverPassword.js +0 -46
- package/esm/idx/recoverPassword.js.map +0 -1
- package/esm/idx/register.js +0 -63
- package/esm/idx/register.js.map +0 -1
- package/esm/idx/remediate.js +0 -302
- package/esm/idx/remediate.js.map +0 -1
- package/esm/idx/remediators/AuthenticatorEnrollmentData.js +0 -68
- package/esm/idx/remediators/AuthenticatorEnrollmentData.js.map +0 -1
- package/esm/idx/remediators/AuthenticatorVerificationData.js +0 -66
- package/esm/idx/remediators/AuthenticatorVerificationData.js.map +0 -1
- package/esm/idx/remediators/Base/AuthenticatorData.js +0 -105
- package/esm/idx/remediators/Base/AuthenticatorData.js.map +0 -1
- package/esm/idx/remediators/Base/Remediator.js +0 -221
- package/esm/idx/remediators/Base/Remediator.js.map +0 -1
- package/esm/idx/remediators/Base/SelectAuthenticator.js +0 -140
- package/esm/idx/remediators/Base/SelectAuthenticator.js.map +0 -1
- package/esm/idx/remediators/Base/VerifyAuthenticator.js +0 -63
- package/esm/idx/remediators/Base/VerifyAuthenticator.js.map +0 -1
- package/esm/idx/remediators/ChallengeAuthenticator.js +0 -18
- package/esm/idx/remediators/ChallengeAuthenticator.js.map +0 -1
- package/esm/idx/remediators/EnrollAuthenticator.js +0 -18
- package/esm/idx/remediators/EnrollAuthenticator.js.map +0 -1
- package/esm/idx/remediators/EnrollProfile.js +0 -79
- package/esm/idx/remediators/EnrollProfile.js.map +0 -1
- package/esm/idx/remediators/Identify.js +0 -86
- package/esm/idx/remediators/Identify.js.map +0 -1
- package/esm/idx/remediators/ReEnrollAuthenticator.js +0 -45
- package/esm/idx/remediators/ReEnrollAuthenticator.js.map +0 -1
- package/esm/idx/remediators/RedirectIdp.js +0 -38
- package/esm/idx/remediators/RedirectIdp.js.map +0 -1
- package/esm/idx/remediators/ResetAuthenticator.js +0 -18
- package/esm/idx/remediators/ResetAuthenticator.js.map +0 -1
- package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js +0 -18
- package/esm/idx/remediators/SelectAuthenticatorAuthenticate.js.map +0 -1
- package/esm/idx/remediators/SelectAuthenticatorEnroll.js +0 -18
- package/esm/idx/remediators/SelectAuthenticatorEnroll.js.map +0 -1
- package/esm/idx/remediators/SelectEnrollProfile.js +0 -24
- package/esm/idx/remediators/SelectEnrollProfile.js.map +0 -1
- package/esm/idx/remediators/Skip.js +0 -23
- package/esm/idx/remediators/Skip.js.map +0 -1
- package/esm/idx/remediators/index.js +0 -26
- package/esm/idx/remediators/index.js.map +0 -1
- package/esm/idx/remediators/util.js +0 -35
- package/esm/idx/remediators/util.js.map +0 -1
- package/esm/idx/run.js +0 -201
- package/esm/idx/run.js.map +0 -1
- package/esm/idx/startTransaction.js +0 -27
- package/esm/idx/startTransaction.js.map +0 -1
- package/esm/idx/transactionMeta.js +0 -114
- package/esm/idx/transactionMeta.js.map +0 -1
- package/esm/idx/types/idx-js.js +0 -17
- package/esm/idx/types/idx-js.js.map +0 -1
- package/esm/idx/types/index.js +0 -44
- package/esm/idx/types/index.js.map +0 -1
- package/esm/oidc/decodeToken.js +0 -31
- package/esm/oidc/decodeToken.js.map +0 -1
- package/esm/oidc/endpoints/authorize.js +0 -61
- package/esm/oidc/endpoints/authorize.js.map +0 -1
- package/esm/oidc/endpoints/index.js.map +0 -1
- package/esm/oidc/endpoints/token.js +0 -97
- package/esm/oidc/endpoints/token.js.map +0 -1
- package/esm/oidc/endpoints/well-known.js +0 -58
- package/esm/oidc/endpoints/well-known.js.map +0 -1
- package/esm/oidc/exchangeCodeForTokens.js +0 -69
- package/esm/oidc/exchangeCodeForTokens.js.map +0 -1
- package/esm/oidc/getToken.js +0 -175
- package/esm/oidc/getToken.js.map +0 -1
- package/esm/oidc/getUserInfo.js +0 -82
- package/esm/oidc/getUserInfo.js.map +0 -1
- package/esm/oidc/getWithPopup.js +0 -28
- package/esm/oidc/getWithPopup.js.map +0 -1
- package/esm/oidc/getWithRedirect.js +0 -65
- package/esm/oidc/getWithRedirect.js.map +0 -1
- package/esm/oidc/getWithoutPrompt.js +0 -29
- package/esm/oidc/getWithoutPrompt.js.map +0 -1
- package/esm/oidc/handleOAuthResponse.js +0 -148
- package/esm/oidc/handleOAuthResponse.js.map +0 -1
- package/esm/oidc/index.js +0 -29
- package/esm/oidc/index.js.map +0 -1
- package/esm/oidc/parseFromUrl.js +0 -144
- package/esm/oidc/parseFromUrl.js.map +0 -1
- package/esm/oidc/renewToken.js +0 -85
- package/esm/oidc/renewToken.js.map +0 -1
- package/esm/oidc/renewTokens.js +0 -52
- package/esm/oidc/renewTokens.js.map +0 -1
- package/esm/oidc/renewTokensWithRefresh.js +0 -55
- package/esm/oidc/renewTokensWithRefresh.js.map +0 -1
- package/esm/oidc/revokeToken.js +0 -57
- package/esm/oidc/revokeToken.js.map +0 -1
- package/esm/oidc/util/browser.js +0 -85
- package/esm/oidc/util/browser.js.map +0 -1
- package/esm/oidc/util/defaultTokenParams.js +0 -42
- package/esm/oidc/util/defaultTokenParams.js.map +0 -1
- package/esm/oidc/util/errors.js +0 -31
- package/esm/oidc/util/errors.js.map +0 -1
- package/esm/oidc/util/index.js +0 -25
- package/esm/oidc/util/index.js.map +0 -1
- package/esm/oidc/util/loginRedirect.js +0 -84
- package/esm/oidc/util/loginRedirect.js.map +0 -1
- package/esm/oidc/util/oauth.js +0 -70
- package/esm/oidc/util/oauth.js.map +0 -1
- package/esm/oidc/util/pkce.js +0 -55
- package/esm/oidc/util/pkce.js.map +0 -1
- package/esm/oidc/util/prepareTokenParams.js +0 -75
- package/esm/oidc/util/prepareTokenParams.js.map +0 -1
- package/esm/oidc/util/refreshToken.js +0 -24
- package/esm/oidc/util/refreshToken.js.map +0 -1
- package/esm/oidc/util/urlParams.js +0 -54
- package/esm/oidc/util/urlParams.js.map +0 -1
- package/esm/oidc/util/validateClaims.js +0 -53
- package/esm/oidc/util/validateClaims.js.map +0 -1
- package/esm/oidc/util/validateToken.js +0 -21
- package/esm/oidc/util/validateToken.js.map +0 -1
- package/esm/oidc/verifyToken.js +0 -78
- package/esm/oidc/verifyToken.js.map +0 -1
- package/esm/options.js +0 -134
- package/esm/options.js.map +0 -1
- package/esm/server/serverStorage.js +0 -110
- package/esm/server/serverStorage.js.map +0 -1
- package/esm/services/TokenService.js +0 -103
- package/esm/services/TokenService.js.map +0 -1
- package/esm/session.js +0 -81
- package/esm/session.js.map +0 -1
- package/esm/tx/AuthTransaction.js +0 -215
- package/esm/tx/AuthTransaction.js.map +0 -1
- package/esm/tx/TransactionState.js.map +0 -1
- package/esm/tx/api.js +0 -84
- package/esm/tx/api.js.map +0 -1
- package/esm/tx/index.js +0 -18
- package/esm/tx/index.js.map +0 -1
- package/esm/tx/poll.js +0 -124
- package/esm/tx/poll.js.map +0 -1
- package/esm/tx/util.js +0 -26
- package/esm/tx/util.js.map +0 -1
- package/esm/types/AuthState.js +0 -3
- package/esm/types/Cookies.js +0 -3
- package/esm/types/EventEmitter.js +0 -3
- package/esm/types/EventEmitter.js.map +0 -1
- package/esm/types/JWT.js +0 -3
- package/esm/types/JWT.js.map +0 -1
- package/esm/types/OAuth.js +0 -3
- package/esm/types/OAuth.js.map +0 -1
- package/esm/types/OktaAuthOptions.js +0 -3
- package/esm/types/OktaAuthOptions.js.map +0 -1
- package/esm/types/Storage.js +0 -3
- package/esm/types/Storage.js.map +0 -1
- package/esm/types/Token.js +0 -29
- package/esm/types/Token.js.map +0 -1
- package/esm/types/TokenManager.js +0 -3
- package/esm/types/TokenManager.js.map +0 -1
- package/esm/types/Transaction.js +0 -57
- package/esm/types/Transaction.js.map +0 -1
- package/esm/types/UserClaims.js +0 -3
- package/esm/types/UserClaims.js.map +0 -1
- package/esm/types/api.js +0 -3
- package/esm/types/api.js.map +0 -1
- package/esm/types/http.js +0 -3
- package/esm/types/http.js.map +0 -1
- package/esm/types/index.js +0 -27
- package/esm/types/index.js.map +0 -1
- package/esm/util/console.js +0 -53
- package/esm/util/console.js.map +0 -1
- package/esm/util/index.js +0 -17
- package/esm/util/index.js.map +0 -1
- package/esm/util/misc.js +0 -33
- package/esm/util/misc.js.map +0 -1
- package/esm/util/object.js +0 -117
- package/esm/util/object.js.map +0 -1
- package/esm/util/sharedStorage.js +0 -43
- package/esm/util/sharedStorage.js.map +0 -1
- package/esm/util/types.js +0 -27
- package/esm/util/types.js.map +0 -1
- package/esm/util/url.js +0 -64
- package/esm/util/url.js.map +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
|
|
3
|
-
/*!
|
|
4
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
5
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
6
|
-
*
|
|
7
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
8
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
10
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
*
|
|
12
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
import { run } from './run';
|
|
15
|
-
// This method only resolves { status: IdxStatus.PENDING } if transaction has already started
|
|
16
|
-
export function startTransaction(_x) {
|
|
17
|
-
return _startTransaction.apply(this, arguments);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _startTransaction() {
|
|
21
|
-
_startTransaction = _asyncToGenerator(function* (authClient) {
|
|
22
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
23
|
-
return run(authClient, options);
|
|
24
|
-
});
|
|
25
|
-
return _startTransaction.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=startTransaction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/startTransaction.ts"],"names":["run","startTransaction","authClient","options"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,GAAT,QAAoB,OAApB;AAGA;AACA,gBAAsBC,gBAAtB;AAAA;AAAA;;;wCAAO,WACLC,UADK,EAGoB;AAAA,QADzBC,OACyB,uEADH,EACG;AACzB,WAAOH,GAAG,CAACE,UAAD,EAAaC,OAAb,CAAV;AACD,G","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 { run } from './run';\nimport { OktaAuth, IdxOptions, IdxTransaction } from '../types';\n\n// This method only resolves { status: IdxStatus.PENDING } if transaction has already started\nexport async function startTransaction(\n authClient: OktaAuth, \n options: IdxOptions = {}\n): Promise<IdxTransaction> {\n return run(authClient, options);\n}\n"],"file":"startTransaction.js"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
|
|
3
|
-
/*!
|
|
4
|
-
* Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
5
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
6
|
-
*
|
|
7
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
8
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
10
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
*
|
|
12
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
import { warn } from '../util';
|
|
15
|
-
import { getOAuthUrls } from '../oidc'; // Calculate new values
|
|
16
|
-
|
|
17
|
-
export function createTransactionMeta(_x) {
|
|
18
|
-
return _createTransactionMeta.apply(this, arguments);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function _createTransactionMeta() {
|
|
22
|
-
_createTransactionMeta = _asyncToGenerator(function* (authClient) {
|
|
23
|
-
return authClient.token.prepareTokenParams();
|
|
24
|
-
});
|
|
25
|
-
return _createTransactionMeta.apply(this, arguments);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function transactionMetaExist(authClient) {
|
|
29
|
-
if (authClient.transactionManager.exists()) {
|
|
30
|
-
var existing = authClient.transactionManager.load();
|
|
31
|
-
|
|
32
|
-
if (isTransactionMetaValid(authClient, existing) && existing.interactionHandle) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
export function getTransactionMeta(_x2) {
|
|
40
|
-
return _getTransactionMeta.apply(this, arguments);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function _getTransactionMeta() {
|
|
44
|
-
_getTransactionMeta = _asyncToGenerator(function* (authClient) {
|
|
45
|
-
// Load existing transaction meta from storage
|
|
46
|
-
if (authClient.transactionManager.exists()) {
|
|
47
|
-
var existing = authClient.transactionManager.load();
|
|
48
|
-
|
|
49
|
-
if (isTransactionMetaValid(authClient, existing)) {
|
|
50
|
-
return existing;
|
|
51
|
-
} // existing meta is not valid for this configuration
|
|
52
|
-
// this is common when changing configuration in local development environment
|
|
53
|
-
// in a production environment, this may indicate that two apps are sharing a storage key
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
warn('Saved transaction meta does not match the current configuration. ' + 'This may indicate that two apps are sharing a storage key.');
|
|
57
|
-
} // Calculate new values
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var tokenParams = yield authClient.token.prepareTokenParams();
|
|
61
|
-
var urls = getOAuthUrls(authClient, tokenParams);
|
|
62
|
-
var issuer = authClient.options.issuer;
|
|
63
|
-
var {
|
|
64
|
-
pkce,
|
|
65
|
-
clientId,
|
|
66
|
-
redirectUri,
|
|
67
|
-
responseType,
|
|
68
|
-
responseMode,
|
|
69
|
-
scopes,
|
|
70
|
-
state,
|
|
71
|
-
nonce,
|
|
72
|
-
ignoreSignature,
|
|
73
|
-
codeVerifier,
|
|
74
|
-
codeChallengeMethod,
|
|
75
|
-
codeChallenge
|
|
76
|
-
} = tokenParams;
|
|
77
|
-
var meta = {
|
|
78
|
-
issuer,
|
|
79
|
-
pkce,
|
|
80
|
-
clientId,
|
|
81
|
-
redirectUri,
|
|
82
|
-
responseType,
|
|
83
|
-
responseMode,
|
|
84
|
-
scopes,
|
|
85
|
-
state,
|
|
86
|
-
nonce,
|
|
87
|
-
urls,
|
|
88
|
-
ignoreSignature,
|
|
89
|
-
codeVerifier,
|
|
90
|
-
codeChallengeMethod,
|
|
91
|
-
codeChallenge
|
|
92
|
-
};
|
|
93
|
-
return meta;
|
|
94
|
-
});
|
|
95
|
-
return _getTransactionMeta.apply(this, arguments);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function saveTransactionMeta(authClient, meta) {
|
|
99
|
-
authClient.transactionManager.save(meta, {
|
|
100
|
-
muteWarning: true
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
export function clearTransactionMeta(authClient) {
|
|
104
|
-
authClient.transactionManager.clear();
|
|
105
|
-
} // returns true if values in meta match current authClient options
|
|
106
|
-
|
|
107
|
-
export function isTransactionMetaValid(authClient, meta) {
|
|
108
|
-
var keys = ['issuer', 'clientId', 'redirectUri'];
|
|
109
|
-
var mismatch = keys.find(key => {
|
|
110
|
-
return authClient.options[key] !== meta[key];
|
|
111
|
-
});
|
|
112
|
-
return !mismatch;
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=transactionMeta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/transactionMeta.ts"],"names":["warn","getOAuthUrls","createTransactionMeta","authClient","token","prepareTokenParams","transactionMetaExist","transactionManager","exists","existing","load","isTransactionMetaValid","interactionHandle","getTransactionMeta","tokenParams","urls","issuer","options","pkce","clientId","redirectUri","responseType","responseMode","scopes","state","nonce","ignoreSignature","codeVerifier","codeChallengeMethod","codeChallenge","meta","saveTransactionMeta","save","muteWarning","clearTransactionMeta","clear","keys","mismatch","find","key"],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) 2021, 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 { OktaAuth, IdxTransactionMeta } from '../types';\nimport { warn } from '../util';\nimport { getOAuthUrls } from '../oidc';\n\n// Calculate new values\nexport async function createTransactionMeta(authClient: OktaAuth) {\n return authClient.token.prepareTokenParams();\n}\n\nexport function transactionMetaExist(authClient: OktaAuth): boolean {\n if (authClient.transactionManager.exists()) {\n const existing = authClient.transactionManager.load() as IdxTransactionMeta;\n if (isTransactionMetaValid(authClient, existing) && existing.interactionHandle) {\n return true;\n }\n }\n return false;\n}\n\nexport async function getTransactionMeta(authClient: OktaAuth): Promise<IdxTransactionMeta> {\n // Load existing transaction meta from storage\n if (authClient.transactionManager.exists()) {\n const existing = authClient.transactionManager.load();\n if (isTransactionMetaValid(authClient, existing)) {\n return existing as IdxTransactionMeta;\n }\n // existing meta is not valid for this configuration\n // this is common when changing configuration in local development environment\n // in a production environment, this may indicate that two apps are sharing a storage key\n warn('Saved transaction meta does not match the current configuration. ' + \n 'This may indicate that two apps are sharing a storage key.');\n }\n\n // Calculate new values\n const tokenParams = await authClient.token.prepareTokenParams();\n const urls = getOAuthUrls(authClient, tokenParams);\n const issuer = authClient.options.issuer;\n const {\n pkce,\n clientId,\n redirectUri,\n responseType,\n responseMode,\n scopes,\n state,\n nonce,\n ignoreSignature,\n codeVerifier,\n codeChallengeMethod,\n codeChallenge,\n } = tokenParams;\n const meta = {\n issuer,\n pkce,\n clientId,\n redirectUri,\n responseType,\n responseMode,\n scopes,\n state,\n nonce,\n urls,\n ignoreSignature,\n codeVerifier,\n codeChallengeMethod,\n codeChallenge \n };\n return meta;\n}\n\nexport function saveTransactionMeta (authClient: OktaAuth, meta) {\n authClient.transactionManager.save(meta, { muteWarning: true });\n}\n\nexport function clearTransactionMeta (authClient: OktaAuth) {\n authClient.transactionManager.clear();\n}\n\n// returns true if values in meta match current authClient options\nexport function isTransactionMetaValid (authClient: OktaAuth, meta) {\n const keys = ['issuer', 'clientId', 'redirectUri'];\n const mismatch = keys.find(key => {\n return authClient.options[key] !== meta[key];\n });\n return !mismatch;\n}\n"],"file":"transactionMeta.js"}
|
package/esm/idx/types/idx-js.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
// TODO: remove when idx-js provides type information
|
|
13
|
-
// JSON response from the server
|
|
14
|
-
export function isRawIdxResponse(obj) {
|
|
15
|
-
return obj && obj.version;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=idx-js.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/idx/types/idx-js.ts"],"names":["isRawIdxResponse","obj","version"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AA2EA;AAaA,OAAO,SAASA,gBAAT,CAA0BC,GAA1B,EAA2D;AAChE,SAAOA,GAAG,IAAIA,GAAG,CAACC,OAAlB;AACD","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\n// TODO: remove when idx-js provides type information\n\nexport interface IdxAuthenticatorMethod {\n type: string;\n}\nexport interface IdxAuthenticator {\n displayName: string;\n id: string;\n key: string;\n methods: IdxAuthenticatorMethod[];\n type: string;\n settings?: {\n complexity?: unknown;\n age?: unknown;\n };\n contextualData?: unknown;\n}\n\nexport interface IdxForm {\n value: IdxRemediationValue[];\n}\n\nexport interface IdxOption {\n value: string | { form: IdxForm };\n label: string;\n relatesTo?: IdxAuthenticator;\n}\n\nexport interface IdpConfig {\n id: string;\n name: string;\n}\n\nexport interface IdxRemediationValue {\n name: string;\n type?: string;\n required?: boolean;\n secret?: boolean;\n value?: string;\n label?: string;\n form?: IdxForm;\n options?: IdxOption[];\n messages?: IdxMessages;\n minLength?: number;\n maxLength?: number;\n}\n\nexport interface IdxRemediation {\n name: string;\n label?: string;\n value?: IdxRemediationValue[];\n relatesTo?: {\n type?: string;\n value: IdxAuthenticator;\n };\n idp?: IdpConfig;\n href?: string;\n method?: string;\n type?: string;\n}\n\nexport interface IdxMessage {\n message: string;\n class: string;\n i18n: {\n key: string;\n params?: unknown[];\n };\n}\n\nexport interface IdxMessages {\n type: 'array';\n value: IdxMessage[];\n}\n\n// JSON response from the server\nexport interface RawIdxResponse {\n version: string;\n stateHandle: string;\n intent?: string;\n expiresAt?: string;\n remediation?: {\n type: 'array';\n value: IdxRemediation[];\n };\n messages?: IdxMessages;\n}\n\nexport function isRawIdxResponse(obj: any): obj is RawIdxResponse {\n return obj && obj.version;\n}\n\n\nexport interface IdxActions {\n [key: string]: Function;\n}\n\n// Object returned from idx-js\nexport interface IdxResponse {\n proceed: (remediationName: string, params: unknown) => Promise<IdxResponse>;\n neededToProceed: IdxRemediation[];\n rawIdxState: RawIdxResponse;\n interactionCode?: string;\n actions: IdxActions;\n toPersist: {\n interactionHandle?: string;\n };\n}\n"],"file":"idx-js.js"}
|
package/esm/idx/types/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
export { IdxMessage } from './idx-js';
|
|
13
|
-
export { AuthenticationOptions } from '../authenticate';
|
|
14
|
-
export { RegistrationOptions } from '../register';
|
|
15
|
-
export { PasswordRecoveryOptions } from '../recoverPassword';
|
|
16
|
-
export { CancelOptions } from '../cancel';
|
|
17
|
-
export var IdxStatus;
|
|
18
|
-
|
|
19
|
-
(function (IdxStatus) {
|
|
20
|
-
IdxStatus["SUCCESS"] = "SUCCESS";
|
|
21
|
-
IdxStatus["PENDING"] = "PENDING";
|
|
22
|
-
IdxStatus["FAILURE"] = "FAILURE";
|
|
23
|
-
IdxStatus["TERMINAL"] = "TERMINAL";
|
|
24
|
-
IdxStatus["CANCELED"] = "CANCELED";
|
|
25
|
-
})(IdxStatus || (IdxStatus = {}));
|
|
26
|
-
|
|
27
|
-
export var AuthenticatorKey;
|
|
28
|
-
|
|
29
|
-
(function (AuthenticatorKey) {
|
|
30
|
-
AuthenticatorKey["OKTA_PASSWORD"] = "okta_password";
|
|
31
|
-
AuthenticatorKey["OKTA_EMAIL"] = "okta_email";
|
|
32
|
-
AuthenticatorKey["OKTA_VERIFIER"] = "okta_verifier";
|
|
33
|
-
AuthenticatorKey["PHONE_NUMBER"] = "phone_number";
|
|
34
|
-
AuthenticatorKey["GOOGLE_AUTHENTICATOR"] = "google_otp";
|
|
35
|
-
})(AuthenticatorKey || (AuthenticatorKey = {}));
|
|
36
|
-
|
|
37
|
-
export var IdxFeature;
|
|
38
|
-
|
|
39
|
-
(function (IdxFeature) {
|
|
40
|
-
IdxFeature[IdxFeature["PASSWORD_RECOVERY"] = 0] = "PASSWORD_RECOVERY";
|
|
41
|
-
IdxFeature[IdxFeature["REGISTRATION"] = 1] = "REGISTRATION";
|
|
42
|
-
IdxFeature[IdxFeature["SOCIAL_IDP"] = 2] = "SOCIAL_IDP";
|
|
43
|
-
})(IdxFeature || (IdxFeature = {}));
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/idx/types/index.ts"],"names":["IdxMessage","AuthenticationOptions","RegistrationOptions","PasswordRecoveryOptions","CancelOptions","IdxStatus","AuthenticatorKey","IdxFeature"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA,SAASA,UAAT,QAA2B,UAA3B;AACA,SAASC,qBAAT,QAAsC,iBAAtC;AACA,SAASC,mBAAT,QAAoC,aAApC;AACA,SAASC,uBAAT,QAAwC,oBAAxC;AACA,SAASC,aAAT,QAA8B,WAA9B;AAEA,WAAYC,SAAZ;;WAAYA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,KAAAA,S;;AAQZ,WAAYC,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,KAAAA,gB;;AAsBZ,WAAYC,UAAZ;;WAAYA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;AAAAA,EAAAA,U,CAAAA,U;GAAAA,U,KAAAA,U","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 { InteractOptions } from '../interact';\nimport { APIError, Tokens } from '../../types';\nimport { IdxTransactionMeta } from '../../types/Transaction';\nimport { IdxAuthenticator, IdxMessage, IdxOption } from './idx-js';\n\nexport { IdxMessage } from './idx-js';\nexport { AuthenticationOptions } from '../authenticate';\nexport { RegistrationOptions } from '../register';\nexport { PasswordRecoveryOptions } from '../recoverPassword';\nexport { CancelOptions } from '../cancel';\n\nexport enum IdxStatus {\n SUCCESS = 'SUCCESS',\n PENDING = 'PENDING',\n FAILURE = 'FAILURE',\n TERMINAL = 'TERMINAL',\n CANCELED = 'CANCELED',\n}\n\nexport enum AuthenticatorKey {\n OKTA_PASSWORD = 'okta_password',\n OKTA_EMAIL = 'okta_email',\n OKTA_VERIFIER = 'okta_verifier',\n PHONE_NUMBER = 'phone_number',\n GOOGLE_AUTHENTICATOR = 'google_otp',\n}\n\ntype Input = {\n name: string;\n required?: boolean;\n}\n\nexport type NextStep = {\n name: string;\n authenticator?: IdxAuthenticator;\n canSkip?: boolean;\n canResend?: boolean;\n inputs?: Input[];\n options?: IdxOption[];\n}\n\nexport enum IdxFeature {\n PASSWORD_RECOVERY,\n REGISTRATION,\n SOCIAL_IDP,\n}\n\nexport interface IdxTransaction {\n status: IdxStatus;\n tokens?: Tokens;\n nextStep?: NextStep;\n messages?: IdxMessage[];\n error?: APIError;\n meta?: IdxTransactionMeta;\n enabledFeatures?: IdxFeature[];\n availableSteps?: NextStep[];\n}\n\nexport type IdxOptions = InteractOptions;\n\nexport type Authenticator = {\n key: string;\n methodType?: string;\n phoneNumber?: string;\n};\n"],"file":"index.js"}
|
package/esm/oidc/decodeToken.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
import { AuthSdkError } from '../errors';
|
|
14
|
-
import { base64UrlToString } from '../crypto';
|
|
15
|
-
export function decodeToken(token) {
|
|
16
|
-
var jwt = token.split('.');
|
|
17
|
-
var decodedToken;
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
decodedToken = {
|
|
21
|
-
header: JSON.parse(base64UrlToString(jwt[0])),
|
|
22
|
-
payload: JSON.parse(base64UrlToString(jwt[1])),
|
|
23
|
-
signature: jwt[2]
|
|
24
|
-
};
|
|
25
|
-
} catch (e) {
|
|
26
|
-
throw new AuthSdkError('Malformed token');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return decodedToken;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=decodeToken.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/oidc/decodeToken.ts"],"names":["AuthSdkError","base64UrlToString","decodeToken","token","jwt","split","decodedToken","header","JSON","parse","payload","signature","e"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,WAA7B;AAEA,SAASC,iBAAT,QAAkC,WAAlC;AAEA,OAAO,SAASC,WAAT,CAAqBC,KAArB,EAA+C;AACpD,MAAIC,GAAG,GAAGD,KAAK,CAACE,KAAN,CAAY,GAAZ,CAAV;AACA,MAAIC,YAAJ;;AAEA,MAAI;AACFA,IAAAA,YAAY,GAAG;AACbC,MAAAA,MAAM,EAAEC,IAAI,CAACC,KAAL,CAAWR,iBAAiB,CAACG,GAAG,CAAC,CAAD,CAAJ,CAA5B,CADK;AAEbM,MAAAA,OAAO,EAAEF,IAAI,CAACC,KAAL,CAAWR,iBAAiB,CAACG,GAAG,CAAC,CAAD,CAAJ,CAA5B,CAFI;AAGbO,MAAAA,SAAS,EAAEP,GAAG,CAAC,CAAD;AAHD,KAAf;AAKD,GAND,CAME,OAAOQ,CAAP,EAAU;AACV,UAAM,IAAIZ,YAAJ,CAAiB,iBAAjB,CAAN;AACD;;AAED,SAAOM,YAAP;AACD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { AuthSdkError } from '../errors';\nimport { JWTObject } from '../types';\nimport { base64UrlToString } from '../crypto';\n\nexport function decodeToken(token: string): JWTObject {\n var jwt = token.split('.');\n var decodedToken: JWTObject;\n\n try {\n decodedToken = {\n header: JSON.parse(base64UrlToString(jwt[0])),\n payload: JSON.parse(base64UrlToString(jwt[1])),\n signature: jwt[2]\n };\n } catch (e) {\n throw new AuthSdkError('Malformed token');\n }\n\n return decodedToken;\n}\n"],"file":"decodeToken.js"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { isString, removeNils, toQueryString } from '../../util';
|
|
13
|
-
import { AuthSdkError } from '../../errors';
|
|
14
|
-
export function convertTokenParamsToOAuthParams(tokenParams) {
|
|
15
|
-
// Quick validation
|
|
16
|
-
if (!tokenParams.clientId) {
|
|
17
|
-
throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (isString(tokenParams.responseType) && tokenParams.responseType.indexOf(' ') !== -1) {
|
|
21
|
-
throw new AuthSdkError('Multiple OAuth responseTypes must be defined as an array');
|
|
22
|
-
} // Convert our params to their actual OAuth equivalents
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var oauthParams = {
|
|
26
|
-
'client_id': tokenParams.clientId,
|
|
27
|
-
'code_challenge': tokenParams.codeChallenge,
|
|
28
|
-
'code_challenge_method': tokenParams.codeChallengeMethod,
|
|
29
|
-
'display': tokenParams.display,
|
|
30
|
-
'idp': tokenParams.idp,
|
|
31
|
-
'idp_scope': tokenParams.idpScope,
|
|
32
|
-
'login_hint': tokenParams.loginHint,
|
|
33
|
-
'max_age': tokenParams.maxAge,
|
|
34
|
-
'nonce': tokenParams.nonce,
|
|
35
|
-
'prompt': tokenParams.prompt,
|
|
36
|
-
'redirect_uri': tokenParams.redirectUri,
|
|
37
|
-
'response_mode': tokenParams.responseMode,
|
|
38
|
-
'response_type': tokenParams.responseType,
|
|
39
|
-
'sessionToken': tokenParams.sessionToken,
|
|
40
|
-
'state': tokenParams.state
|
|
41
|
-
};
|
|
42
|
-
oauthParams = removeNils(oauthParams);
|
|
43
|
-
['idp_scope', 'response_type'].forEach(function (mayBeArray) {
|
|
44
|
-
if (Array.isArray(oauthParams[mayBeArray])) {
|
|
45
|
-
oauthParams[mayBeArray] = oauthParams[mayBeArray].join(' ');
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (tokenParams.responseType.indexOf('id_token') !== -1 && tokenParams.scopes.indexOf('openid') === -1) {
|
|
50
|
-
throw new AuthSdkError('openid scope must be specified in the scopes argument when requesting an id_token');
|
|
51
|
-
} else {
|
|
52
|
-
oauthParams.scope = tokenParams.scopes.join(' ');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return oauthParams;
|
|
56
|
-
}
|
|
57
|
-
export function buildAuthorizeParams(tokenParams) {
|
|
58
|
-
var oauthQueryParams = convertTokenParamsToOAuthParams(tokenParams);
|
|
59
|
-
return toQueryString(oauthQueryParams);
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=authorize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/oidc/endpoints/authorize.ts"],"names":["isString","removeNils","toQueryString","AuthSdkError","convertTokenParamsToOAuthParams","tokenParams","clientId","responseType","indexOf","oauthParams","codeChallenge","codeChallengeMethod","display","idp","idpScope","loginHint","maxAge","nonce","prompt","redirectUri","responseMode","sessionToken","state","forEach","mayBeArray","Array","isArray","join","scopes","scope","buildAuthorizeParams","oauthQueryParams"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,SAASA,QAAT,EAAmBC,UAAnB,EAA+BC,aAA/B,QAAoD,YAApD;AACA,SAASC,YAAT,QAA6B,cAA7B;AAGA,OAAO,SAASC,+BAAT,CAAyCC,WAAzC,EAAmE;AACxE;AACA,MAAI,CAACA,WAAW,CAACC,QAAjB,EAA2B;AACzB,UAAM,IAAIH,YAAJ,CAAiB,yEAAjB,CAAN;AACD;;AAED,MAAIH,QAAQ,CAACK,WAAW,CAACE,YAAb,CAAR,IAAsCF,WAAW,CAACE,YAAZ,CAAyBC,OAAzB,CAAiC,GAAjC,MAA0C,CAAC,CAArF,EAAwF;AACtF,UAAM,IAAIL,YAAJ,CAAiB,0DAAjB,CAAN;AACD,GARuE,CAUxE;;;AACA,MAAIM,WAAwB,GAAG;AAC7B,iBAAaJ,WAAW,CAACC,QADI;AAE7B,sBAAkBD,WAAW,CAACK,aAFD;AAG7B,6BAAyBL,WAAW,CAACM,mBAHR;AAI7B,eAAWN,WAAW,CAACO,OAJM;AAK7B,WAAOP,WAAW,CAACQ,GALU;AAM7B,iBAAaR,WAAW,CAACS,QANI;AAO7B,kBAAcT,WAAW,CAACU,SAPG;AAQ7B,eAAWV,WAAW,CAACW,MARM;AAS7B,aAASX,WAAW,CAACY,KATQ;AAU7B,cAAUZ,WAAW,CAACa,MAVO;AAW7B,oBAAgBb,WAAW,CAACc,WAXC;AAY7B,qBAAiBd,WAAW,CAACe,YAZA;AAa7B,qBAAiBf,WAAW,CAACE,YAbA;AAc7B,oBAAgBF,WAAW,CAACgB,YAdC;AAe7B,aAAShB,WAAW,CAACiB;AAfQ,GAA/B;AAiBAb,EAAAA,WAAW,GAAGR,UAAU,CAACQ,WAAD,CAAxB;AAEA,GAAC,WAAD,EAAc,eAAd,EAA+Bc,OAA/B,CAAuC,UAAUC,UAAV,EAAsB;AAC3D,QAAIC,KAAK,CAACC,OAAN,CAAcjB,WAAW,CAACe,UAAD,CAAzB,CAAJ,EAA4C;AAC1Cf,MAAAA,WAAW,CAACe,UAAD,CAAX,GAA0Bf,WAAW,CAACe,UAAD,CAAX,CAAwBG,IAAxB,CAA6B,GAA7B,CAA1B;AACD;AACF,GAJD;;AAMA,MAAItB,WAAW,CAACE,YAAZ,CAAyBC,OAAzB,CAAiC,UAAjC,MAAiD,CAAC,CAAlD,IACFH,WAAW,CAACuB,MAAZ,CAAmBpB,OAAnB,CAA2B,QAA3B,MAAyC,CAAC,CAD5C,EAC+C;AAC7C,UAAM,IAAIL,YAAJ,CAAiB,mFAAjB,CAAN;AACD,GAHD,MAGO;AACLM,IAAAA,WAAW,CAACoB,KAAZ,GAAoBxB,WAAW,CAACuB,MAAZ,CAAmBD,IAAnB,CAAwB,GAAxB,CAApB;AACD;;AAED,SAAOlB,WAAP;AACD;AAED,OAAO,SAASqB,oBAAT,CAA8BzB,WAA9B,EAAwD;AAC7D,MAAI0B,gBAAgB,GAAG3B,+BAA+B,CAACC,WAAD,CAAtD;AACA,SAAOH,aAAa,CAAC6B,gBAAD,CAApB;AACD","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 { isString, removeNils, toQueryString } from '../../util';\nimport { AuthSdkError } from '../../errors';\nimport { OAuthParams, TokenParams } from '../../types';\n\nexport function convertTokenParamsToOAuthParams(tokenParams: TokenParams) {\n // Quick validation\n if (!tokenParams.clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');\n }\n\n if (isString(tokenParams.responseType) && tokenParams.responseType.indexOf(' ') !== -1) {\n throw new AuthSdkError('Multiple OAuth responseTypes must be defined as an array');\n }\n\n // Convert our params to their actual OAuth equivalents\n var oauthParams: OAuthParams = {\n 'client_id': tokenParams.clientId,\n 'code_challenge': tokenParams.codeChallenge,\n 'code_challenge_method': tokenParams.codeChallengeMethod,\n 'display': tokenParams.display,\n 'idp': tokenParams.idp,\n 'idp_scope': tokenParams.idpScope,\n 'login_hint': tokenParams.loginHint,\n 'max_age': tokenParams.maxAge,\n 'nonce': tokenParams.nonce,\n 'prompt': tokenParams.prompt,\n 'redirect_uri': tokenParams.redirectUri,\n 'response_mode': tokenParams.responseMode,\n 'response_type': tokenParams.responseType,\n 'sessionToken': tokenParams.sessionToken,\n 'state': tokenParams.state,\n };\n oauthParams = removeNils(oauthParams) as OAuthParams;\n\n ['idp_scope', 'response_type'].forEach(function (mayBeArray) {\n if (Array.isArray(oauthParams[mayBeArray])) {\n oauthParams[mayBeArray] = oauthParams[mayBeArray].join(' ');\n }\n });\n\n if (tokenParams.responseType.indexOf('id_token') !== -1 &&\n tokenParams.scopes.indexOf('openid') === -1) {\n throw new AuthSdkError('openid scope must be specified in the scopes argument when requesting an id_token');\n } else {\n oauthParams.scope = tokenParams.scopes.join(' ');\n }\n\n return oauthParams;\n}\n\nexport function buildAuthorizeParams(tokenParams: TokenParams) {\n var oauthQueryParams = convertTokenParamsToOAuthParams(tokenParams);\n return toQueryString(oauthQueryParams);\n}\n"],"file":"authorize.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/oidc/endpoints/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,cAAc,aAAd;AACA,cAAc,SAAd;AACA,cAAc,cAAd","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nexport * from './authorize';\nexport * from './token';\nexport * from './well-known';\n"],"file":"index.js"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { AuthSdkError } from '../../errors';
|
|
13
|
-
import { removeNils, toQueryString } from '../../util';
|
|
14
|
-
import { httpRequest } from '../../http';
|
|
15
|
-
|
|
16
|
-
function validateOptions(options) {
|
|
17
|
-
// Quick validation
|
|
18
|
-
if (!options.clientId) {
|
|
19
|
-
throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (!options.redirectUri) {
|
|
23
|
-
throw new AuthSdkError('The redirectUri passed to /authorize must also be passed to /token');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (!options.authorizationCode && !options.interactionCode) {
|
|
27
|
-
throw new AuthSdkError('An authorization code (returned from /authorize) must be passed to /token');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!options.codeVerifier) {
|
|
31
|
-
throw new AuthSdkError('The "codeVerifier" (generated and saved by your app) must be passed to /token');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getPostData(sdk, options) {
|
|
36
|
-
// Convert Token params to OAuth params, sent to the /token endpoint
|
|
37
|
-
var params = removeNils({
|
|
38
|
-
'client_id': options.clientId,
|
|
39
|
-
'redirect_uri': options.redirectUri,
|
|
40
|
-
'grant_type': options.interactionCode ? 'interaction_code' : 'authorization_code',
|
|
41
|
-
'code_verifier': options.codeVerifier
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
if (options.interactionCode) {
|
|
45
|
-
params['interaction_code'] = options.interactionCode;
|
|
46
|
-
} else if (options.authorizationCode) {
|
|
47
|
-
params.code = options.authorizationCode;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
var {
|
|
51
|
-
clientSecret
|
|
52
|
-
} = sdk.options;
|
|
53
|
-
|
|
54
|
-
if (clientSecret) {
|
|
55
|
-
params['client_secret'] = clientSecret;
|
|
56
|
-
} // Encode as URL string
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return toQueryString(params).slice(1);
|
|
60
|
-
} // exchange authorization code for an access token
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export function postToTokenEndpoint(sdk, options, urls) {
|
|
64
|
-
validateOptions(options);
|
|
65
|
-
var data = getPostData(sdk, options);
|
|
66
|
-
var headers = {
|
|
67
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
68
|
-
};
|
|
69
|
-
return httpRequest(sdk, {
|
|
70
|
-
url: urls.tokenUrl,
|
|
71
|
-
method: 'POST',
|
|
72
|
-
args: data,
|
|
73
|
-
headers
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
export function postRefreshToken(sdk, options, refreshToken) {
|
|
77
|
-
return httpRequest(sdk, {
|
|
78
|
-
url: refreshToken.tokenUrl,
|
|
79
|
-
method: 'POST',
|
|
80
|
-
headers: {
|
|
81
|
-
'Content-Type': 'application/x-www-form-urlencoded'
|
|
82
|
-
},
|
|
83
|
-
args: Object.entries({
|
|
84
|
-
client_id: options.clientId,
|
|
85
|
-
// eslint-disable-line camelcase
|
|
86
|
-
grant_type: 'refresh_token',
|
|
87
|
-
// eslint-disable-line camelcase
|
|
88
|
-
scope: refreshToken.scopes.join(' '),
|
|
89
|
-
refresh_token: refreshToken.refreshToken // eslint-disable-line camelcase
|
|
90
|
-
|
|
91
|
-
}).map(function (_ref) {
|
|
92
|
-
var [name, value] = _ref;
|
|
93
|
-
return name + '=' + encodeURIComponent(value);
|
|
94
|
-
}).join('&')
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=token.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/oidc/endpoints/token.ts"],"names":["AuthSdkError","removeNils","toQueryString","httpRequest","validateOptions","options","clientId","redirectUri","authorizationCode","interactionCode","codeVerifier","getPostData","sdk","params","code","clientSecret","slice","postToTokenEndpoint","urls","data","headers","url","tokenUrl","method","args","postRefreshToken","refreshToken","Object","entries","client_id","grant_type","scope","scopes","join","refresh_token","map","name","value","encodeURIComponent"],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * \n * See the License for the specific language governing permissions and limitations under the License.\n */\n\n\nimport { AuthSdkError } from '../../errors';\nimport { CustomUrls, OAuthParams, OAuthResponse, RefreshToken, TokenParams } from '../../types';\nimport { removeNils, toQueryString } from '../../util';\nimport { httpRequest } from '../../http';\n\nfunction validateOptions(options: TokenParams) {\n // Quick validation\n if (!options.clientId) {\n throw new AuthSdkError('A clientId must be specified in the OktaAuth constructor to get a token');\n }\n\n if (!options.redirectUri) {\n throw new AuthSdkError('The redirectUri passed to /authorize must also be passed to /token');\n }\n\n if (!options.authorizationCode && !options.interactionCode) {\n throw new AuthSdkError('An authorization code (returned from /authorize) must be passed to /token');\n }\n\n if (!options.codeVerifier) {\n throw new AuthSdkError('The \"codeVerifier\" (generated and saved by your app) must be passed to /token');\n }\n}\n\nfunction getPostData(sdk, options: TokenParams): string {\n // Convert Token params to OAuth params, sent to the /token endpoint\n var params: OAuthParams = removeNils({\n 'client_id': options.clientId,\n 'redirect_uri': options.redirectUri,\n 'grant_type': options.interactionCode ? 'interaction_code' : 'authorization_code',\n 'code_verifier': options.codeVerifier\n });\n\n if (options.interactionCode) {\n params['interaction_code'] = options.interactionCode;\n } else if (options.authorizationCode) {\n params.code = options.authorizationCode;\n }\n\n const { clientSecret } = sdk.options;\n if (clientSecret) {\n params['client_secret'] = clientSecret;\n }\n\n // Encode as URL string\n return toQueryString(params).slice(1);\n}\n\n// exchange authorization code for an access token\nexport function postToTokenEndpoint(sdk, options: TokenParams, urls: CustomUrls): Promise<OAuthResponse> {\n validateOptions(options);\n var data = getPostData(sdk, options);\n\n const headers = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n };\n\n return httpRequest(sdk, {\n url: urls.tokenUrl,\n method: 'POST',\n args: data,\n headers\n });\n}\n\nexport function postRefreshToken(sdk, options: TokenParams, refreshToken: RefreshToken): Promise<OAuthResponse> {\n return httpRequest(sdk, {\n url: refreshToken.tokenUrl,\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n\n args: Object.entries({\n client_id: options.clientId, // eslint-disable-line camelcase\n grant_type: 'refresh_token', // eslint-disable-line camelcase\n scope: refreshToken.scopes.join(' '),\n refresh_token: refreshToken.refreshToken, // eslint-disable-line camelcase\n }).map(function ([name, value]) {\n return name + '=' + encodeURIComponent(value);\n }).join('&'),\n });\n}"],"file":"token.js"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
-
*
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
-
*
|
|
10
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
import { get } from '../../http';
|
|
14
|
-
import { find } from '../../util';
|
|
15
|
-
import AuthSdkError from '../../errors/AuthSdkError';
|
|
16
|
-
export function getWellKnown(sdk, issuer) {
|
|
17
|
-
var authServerUri = issuer || sdk.options.issuer;
|
|
18
|
-
return get(sdk, authServerUri + '/.well-known/openid-configuration', {
|
|
19
|
-
cacheResponse: true
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export function getKey(sdk, issuer, kid) {
|
|
23
|
-
var httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);
|
|
24
|
-
return getWellKnown(sdk, issuer).then(function (wellKnown) {
|
|
25
|
-
var jwksUri = wellKnown['jwks_uri']; // Check our kid against the cached version (if it exists and isn't expired)
|
|
26
|
-
|
|
27
|
-
var cacheContents = httpCache.getStorage();
|
|
28
|
-
var cachedResponse = cacheContents[jwksUri];
|
|
29
|
-
|
|
30
|
-
if (cachedResponse && Date.now() / 1000 < cachedResponse.expiresAt) {
|
|
31
|
-
var cachedKey = find(cachedResponse.response.keys, {
|
|
32
|
-
kid: kid
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (cachedKey) {
|
|
36
|
-
return cachedKey;
|
|
37
|
-
}
|
|
38
|
-
} // Remove cache for the key
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
httpCache.clearStorage(jwksUri); // Pull the latest keys if the key wasn't in the cache
|
|
42
|
-
|
|
43
|
-
return get(sdk, jwksUri, {
|
|
44
|
-
cacheResponse: true
|
|
45
|
-
}).then(function (res) {
|
|
46
|
-
var key = find(res.keys, {
|
|
47
|
-
kid: kid
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
if (key) {
|
|
51
|
-
return key;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
throw new AuthSdkError('The key id, ' + kid + ', was not found in the server\'s keys');
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=well-known.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/oidc/endpoints/well-known.ts"],"names":["get","find","AuthSdkError","getWellKnown","sdk","issuer","authServerUri","options","cacheResponse","getKey","kid","httpCache","storageManager","getHttpCache","cookies","then","wellKnown","jwksUri","cacheContents","getStorage","cachedResponse","Date","now","expiresAt","cachedKey","response","keys","clearStorage","res","key"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,YAApB;AACA,SAASC,IAAT,QAAqB,YAArB;AAEA,OAAOC,YAAP,MAAyB,2BAAzB;AAEA,OAAO,SAASC,YAAT,CAAsBC,GAAtB,EAAqCC,MAArC,EAAkF;AACvF,MAAIC,aAAa,GAAID,MAAM,IAAID,GAAG,CAACG,OAAJ,CAAYF,MAA3C;AACA,SAAOL,GAAG,CAACI,GAAD,EAAME,aAAa,GAAG,mCAAtB,EAA2D;AACnEE,IAAAA,aAAa,EAAE;AADoD,GAA3D,CAAV;AAGD;AAED,OAAO,SAASC,MAAT,CAAgBL,GAAhB,EAA+BC,MAA/B,EAA+CK,GAA/C,EAA6E;AAClF,MAAIC,SAAS,GAAGP,GAAG,CAACQ,cAAJ,CAAmBC,YAAnB,CAAgCT,GAAG,CAACG,OAAJ,CAAYO,OAA5C,CAAhB;AAEA,SAAOX,YAAY,CAACC,GAAD,EAAMC,MAAN,CAAZ,CACNU,IADM,CACD,UAASC,SAAT,EAAoB;AACxB,QAAIC,OAAO,GAAGD,SAAS,CAAC,UAAD,CAAvB,CADwB,CAGxB;;AACA,QAAIE,aAAa,GAAGP,SAAS,CAACQ,UAAV,EAApB;AACA,QAAIC,cAAc,GAAGF,aAAa,CAACD,OAAD,CAAlC;;AACA,QAAIG,cAAc,IAAIC,IAAI,CAACC,GAAL,KAAW,IAAX,GAAkBF,cAAc,CAACG,SAAvD,EAAkE;AAChE,UAAIC,SAAS,GAAGvB,IAAI,CAACmB,cAAc,CAACK,QAAf,CAAwBC,IAAzB,EAA+B;AACjDhB,QAAAA,GAAG,EAAEA;AAD4C,OAA/B,CAApB;;AAIA,UAAIc,SAAJ,EAAe;AACb,eAAOA,SAAP;AACD;AACF,KAduB,CAgBxB;;;AACAb,IAAAA,SAAS,CAACgB,YAAV,CAAuBV,OAAvB,EAjBwB,CAmBxB;;AACA,WAAOjB,GAAG,CAACI,GAAD,EAAMa,OAAN,EAAe;AACvBT,MAAAA,aAAa,EAAE;AADQ,KAAf,CAAH,CAGNO,IAHM,CAGD,UAASa,GAAT,EAAc;AAClB,UAAIC,GAAG,GAAG5B,IAAI,CAAC2B,GAAG,CAACF,IAAL,EAAW;AACvBhB,QAAAA,GAAG,EAAEA;AADkB,OAAX,CAAd;;AAIA,UAAImB,GAAJ,EAAS;AACP,eAAOA,GAAP;AACD;;AAED,YAAM,IAAI3B,YAAJ,CAAiB,iBAAiBQ,GAAjB,GAAuB,uCAAxC,CAAN;AACD,KAbM,CAAP;AAcD,GAnCM,CAAP;AAoCD","sourcesContent":["/*!\n * Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n *\n */\nimport { get } from '../../http';\nimport { find } from '../../util';\nimport { OktaAuth, WellKnownResponse } from '../../types';\nimport AuthSdkError from '../../errors/AuthSdkError';\n\nexport function getWellKnown(sdk: OktaAuth, issuer?: string): Promise<WellKnownResponse> {\n var authServerUri = (issuer || sdk.options.issuer);\n return get(sdk, authServerUri + '/.well-known/openid-configuration', {\n cacheResponse: true\n });\n}\n\nexport function getKey(sdk: OktaAuth, issuer: string, kid: string): Promise<string> {\n var httpCache = sdk.storageManager.getHttpCache(sdk.options.cookies);\n\n return getWellKnown(sdk, issuer)\n .then(function(wellKnown) {\n var jwksUri = wellKnown['jwks_uri'];\n\n // Check our kid against the cached version (if it exists and isn't expired)\n var cacheContents = httpCache.getStorage();\n var cachedResponse = cacheContents[jwksUri];\n if (cachedResponse && Date.now()/1000 < cachedResponse.expiresAt) {\n var cachedKey = find(cachedResponse.response.keys, {\n kid: kid\n });\n\n if (cachedKey) {\n return cachedKey;\n }\n }\n\n // Remove cache for the key\n httpCache.clearStorage(jwksUri);\n\n // Pull the latest keys if the key wasn't in the cache\n return get(sdk, jwksUri, {\n cacheResponse: true\n })\n .then(function(res) {\n var key = find(res.keys, {\n kid: kid\n });\n\n if (key) {\n return key;\n }\n\n throw new AuthSdkError('The key id, ' + kid + ', was not found in the server\\'s keys');\n });\n });\n}\n"],"file":"well-known.js"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
|
|
3
|
-
/*!
|
|
4
|
-
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
5
|
-
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
6
|
-
*
|
|
7
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
8
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
10
|
-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
*
|
|
12
|
-
* See the License for the specific language governing permissions and limitations under the License.
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
import { getOAuthUrls } from '../oidc';
|
|
16
|
-
import { getDefaultTokenParams } from './util';
|
|
17
|
-
import { clone } from '../util';
|
|
18
|
-
import { postToTokenEndpoint } from './endpoints/token';
|
|
19
|
-
import { handleOAuthResponse } from './handleOAuthResponse'; // codeVerifier is required. May pass either an authorizationCode or interactionCode
|
|
20
|
-
|
|
21
|
-
export function exchangeCodeForTokens(sdk, tokenParams, urls) {
|
|
22
|
-
urls = urls || getOAuthUrls(sdk, tokenParams); // build params using defaults + options
|
|
23
|
-
|
|
24
|
-
tokenParams = Object.assign({}, getDefaultTokenParams(sdk), clone(tokenParams));
|
|
25
|
-
var {
|
|
26
|
-
authorizationCode,
|
|
27
|
-
interactionCode,
|
|
28
|
-
codeVerifier,
|
|
29
|
-
clientId,
|
|
30
|
-
redirectUri,
|
|
31
|
-
scopes,
|
|
32
|
-
ignoreSignature,
|
|
33
|
-
state
|
|
34
|
-
} = tokenParams;
|
|
35
|
-
var getTokenOptions = {
|
|
36
|
-
clientId,
|
|
37
|
-
redirectUri,
|
|
38
|
-
authorizationCode,
|
|
39
|
-
interactionCode,
|
|
40
|
-
codeVerifier
|
|
41
|
-
};
|
|
42
|
-
return postToTokenEndpoint(sdk, getTokenOptions, urls).then(response => {
|
|
43
|
-
// `handleOAuthResponse` hanadles responses from both `/authorize` and `/token` endpoints
|
|
44
|
-
// Here we modify the response from `/token` so that it more closely matches a response from `/authorize`
|
|
45
|
-
// `responseType` is used to validate that the expected tokens were returned
|
|
46
|
-
var responseType = ['token']; // an accessToken will always be returned
|
|
47
|
-
|
|
48
|
-
if (scopes.indexOf('openid') !== -1) {
|
|
49
|
-
responseType.push('id_token'); // an idToken will be returned if "openid" is in the scopes
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var handleResponseOptions = {
|
|
53
|
-
clientId,
|
|
54
|
-
redirectUri,
|
|
55
|
-
scopes,
|
|
56
|
-
responseType,
|
|
57
|
-
ignoreSignature
|
|
58
|
-
};
|
|
59
|
-
return handleOAuthResponse(sdk, handleResponseOptions, response, urls).then(response => {
|
|
60
|
-
// For compatibility, "code" is returned in the TokenResponse. OKTA-326091
|
|
61
|
-
response.code = authorizationCode;
|
|
62
|
-
response.state = state;
|
|
63
|
-
return response;
|
|
64
|
-
});
|
|
65
|
-
}).finally(() => {
|
|
66
|
-
sdk.transactionManager.clear();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=exchangeCodeForTokens.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/oidc/exchangeCodeForTokens.ts"],"names":["getOAuthUrls","getDefaultTokenParams","clone","postToTokenEndpoint","handleOAuthResponse","exchangeCodeForTokens","sdk","tokenParams","urls","Object","assign","authorizationCode","interactionCode","codeVerifier","clientId","redirectUri","scopes","ignoreSignature","state","getTokenOptions","then","response","responseType","indexOf","push","handleResponseOptions","code","finally","transactionManager","clear"],"mappings":"AAAA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,SAA7B;AAEA,SAASC,qBAAT,QAAsC,QAAtC;AACA,SAASC,KAAT,QAAsB,SAAtB;AACA,SAASC,mBAAT,QAAoC,mBAApC;AACA,SAASC,mBAAT,QAAoC,uBAApC,C,CAEA;;AACA,OAAO,SAASC,qBAAT,CAA+BC,GAA/B,EAA8CC,WAA9C,EAAwEC,IAAxE,EAAmH;AACxHA,EAAAA,IAAI,GAAGA,IAAI,IAAIR,YAAY,CAACM,GAAD,EAAMC,WAAN,CAA3B,CADwH,CAExH;;AACAA,EAAAA,WAAW,GAAGE,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBT,qBAAqB,CAACK,GAAD,CAAvC,EAA8CJ,KAAK,CAACK,WAAD,CAAnD,CAAd;AAEA,MAAM;AACJI,IAAAA,iBADI;AAEJC,IAAAA,eAFI;AAGJC,IAAAA,YAHI;AAIJC,IAAAA,QAJI;AAKJC,IAAAA,WALI;AAMJC,IAAAA,MANI;AAOJC,IAAAA,eAPI;AAQJC,IAAAA;AARI,MASFX,WATJ;AAWA,MAAIY,eAAe,GAAG;AACpBL,IAAAA,QADoB;AAEpBC,IAAAA,WAFoB;AAGpBJ,IAAAA,iBAHoB;AAIpBC,IAAAA,eAJoB;AAKpBC,IAAAA;AALoB,GAAtB;AAQA,SAAOV,mBAAmB,CAACG,GAAD,EAAMa,eAAN,EAAuBX,IAAvB,CAAnB,CACJY,IADI,CACEC,QAAD,IAA6B;AAEjC;AACA;AACA;AACA,QAAMC,YAAY,GAAG,CAAC,OAAD,CAArB,CALiC,CAKD;;AAChC,QAAIN,MAAM,CAACO,OAAP,CAAe,QAAf,MAA6B,CAAC,CAAlC,EAAqC;AACnCD,MAAAA,YAAY,CAACE,IAAb,CAAkB,UAAlB,EADmC,CACJ;AAChC;;AACD,QAAMC,qBAAkC,GAAG;AACzCX,MAAAA,QADyC;AAEzCC,MAAAA,WAFyC;AAGzCC,MAAAA,MAHyC;AAIzCM,MAAAA,YAJyC;AAKzCL,MAAAA;AALyC,KAA3C;AAOA,WAAOb,mBAAmB,CAACE,GAAD,EAAMmB,qBAAN,EAA6BJ,QAA7B,EAAuCb,IAAvC,CAAnB,CACJY,IADI,CACEC,QAAD,IAA6B;AACjC;AACAA,MAAAA,QAAQ,CAACK,IAAT,GAAgBf,iBAAhB;AACAU,MAAAA,QAAQ,CAACH,KAAT,GAAiBA,KAAjB;AACA,aAAOG,QAAP;AACD,KANI,CAAP;AAOD,GAxBI,EAyBJM,OAzBI,CAyBI,MAAM;AACbrB,IAAAA,GAAG,CAACsB,kBAAJ,CAAuBC,KAAvB;AACD,GA3BI,CAAP;AA4BD","sourcesContent":["/* eslint-disable max-len */\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 { getOAuthUrls } from '../oidc';\nimport { CustomUrls, OAuthResponse, OktaAuth, TokenParams, TokenResponse } from '../types';\nimport { getDefaultTokenParams } from './util';\nimport { clone } from '../util';\nimport { postToTokenEndpoint } from './endpoints/token';\nimport { handleOAuthResponse } from './handleOAuthResponse';\n\n// codeVerifier is required. May pass either an authorizationCode or interactionCode\nexport function exchangeCodeForTokens(sdk: OktaAuth, tokenParams: TokenParams, urls?: CustomUrls): Promise<TokenResponse> {\n urls = urls || getOAuthUrls(sdk, tokenParams);\n // build params using defaults + options\n tokenParams = Object.assign({}, getDefaultTokenParams(sdk), clone(tokenParams));\n\n const {\n authorizationCode,\n interactionCode,\n codeVerifier,\n clientId,\n redirectUri,\n scopes,\n ignoreSignature,\n state\n } = tokenParams;\n\n var getTokenOptions = {\n clientId,\n redirectUri,\n authorizationCode,\n interactionCode,\n codeVerifier,\n };\n\n return postToTokenEndpoint(sdk, getTokenOptions, urls)\n .then((response: OAuthResponse) => {\n\n // `handleOAuthResponse` hanadles responses from both `/authorize` and `/token` endpoints\n // Here we modify the response from `/token` so that it more closely matches a response from `/authorize`\n // `responseType` is used to validate that the expected tokens were returned\n const responseType = ['token']; // an accessToken will always be returned\n if (scopes.indexOf('openid') !== -1) {\n responseType.push('id_token'); // an idToken will be returned if \"openid\" is in the scopes\n }\n const handleResponseOptions: TokenParams = {\n clientId,\n redirectUri,\n scopes,\n responseType,\n ignoreSignature,\n };\n return handleOAuthResponse(sdk, handleResponseOptions, response, urls)\n .then((response: TokenResponse) => {\n // For compatibility, \"code\" is returned in the TokenResponse. OKTA-326091\n response.code = authorizationCode;\n response.state = state;\n return response;\n });\n })\n .finally(() => {\n sdk.transactionManager.clear();\n });\n}"],"file":"exchangeCodeForTokens.js"}
|