@okta/okta-auth-js 5.11.0 → 6.0.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 +32 -0
- package/README.md +5 -2
- package/cjs/AuthStateManager.js +2 -1
- package/cjs/AuthStateManager.js.map +1 -1
- package/cjs/OktaAuth.js +75 -71
- package/cjs/OktaAuth.js.map +1 -1
- package/cjs/OktaUserAgent.js +2 -2
- package/cjs/OktaUserAgent.js.map +1 -1
- package/cjs/PromiseQueue.js +6 -1
- package/cjs/PromiseQueue.js.map +1 -1
- package/cjs/StorageManager.js +3 -1
- package/cjs/StorageManager.js.map +1 -1
- package/cjs/TokenManager.js +9 -3
- package/cjs/TokenManager.js.map +1 -1
- package/cjs/TransactionManager.js +17 -4
- package/cjs/TransactionManager.js.map +1 -1
- package/cjs/browser/browserStorage.js +7 -5
- package/cjs/browser/browserStorage.js.map +1 -1
- package/cjs/browser/fingerprint.js +3 -1
- package/cjs/browser/fingerprint.js.map +1 -1
- package/cjs/builderUtil.js +3 -17
- package/cjs/builderUtil.js.map +1 -1
- package/cjs/crypto/oidcHash.js.map +1 -1
- package/cjs/features.js +9 -3
- package/cjs/features.js.map +1 -1
- package/cjs/fetch/fetchRequest.js +2 -1
- package/cjs/fetch/fetchRequest.js.map +1 -1
- package/cjs/http/request.js +2 -0
- package/cjs/http/request.js.map +1 -1
- package/cjs/idx/authenticate.js +8 -5
- package/cjs/idx/authenticate.js.map +1 -1
- package/cjs/idx/authenticator/SecurityQuestionVerification.js +1 -0
- package/cjs/idx/authenticator/SecurityQuestionVerification.js.map +1 -1
- package/cjs/idx/authenticator/VerificationCodeAuthenticator.js +2 -2
- package/cjs/idx/authenticator/VerificationCodeAuthenticator.js.map +1 -1
- package/cjs/idx/authenticator/getAuthenticator.js +5 -6
- package/cjs/idx/authenticator/getAuthenticator.js.map +1 -1
- package/cjs/idx/cancel.js.map +1 -1
- package/cjs/idx/emailVerify.js +73 -0
- package/cjs/idx/emailVerify.js.map +1 -0
- package/cjs/idx/flow/FlowSpecification.js +16 -4
- package/cjs/idx/flow/FlowSpecification.js.map +1 -1
- package/cjs/idx/flow/RegistrationFlow.js +2 -0
- package/cjs/idx/flow/RegistrationFlow.js.map +1 -1
- package/cjs/idx/handleInteractionCodeRedirect.js +1 -0
- package/cjs/idx/handleInteractionCodeRedirect.js.map +1 -1
- package/cjs/idx/index.js +13 -0
- package/cjs/idx/index.js.map +1 -1
- package/cjs/idx/interact.js +46 -34
- package/cjs/idx/interact.js.map +1 -1
- package/cjs/idx/introspect.js +12 -14
- package/cjs/idx/introspect.js.map +1 -1
- package/cjs/idx/proceed.js +4 -7
- package/cjs/idx/proceed.js.map +1 -1
- package/cjs/idx/recoverPassword.js +1 -1
- package/cjs/idx/recoverPassword.js.map +1 -1
- package/cjs/idx/register.js +6 -15
- package/cjs/idx/register.js.map +1 -1
- package/cjs/idx/remediate.js +21 -5
- package/cjs/idx/remediate.js.map +1 -1
- package/cjs/idx/remediators/AuthenticatorEnrollmentData.js +2 -0
- package/cjs/idx/remediators/AuthenticatorEnrollmentData.js.map +1 -1
- package/cjs/idx/remediators/AuthenticatorVerificationData.js +5 -3
- package/cjs/idx/remediators/AuthenticatorVerificationData.js.map +1 -1
- package/cjs/idx/remediators/Base/AuthenticatorData.js +5 -3
- package/cjs/idx/remediators/Base/AuthenticatorData.js.map +1 -1
- package/cjs/idx/remediators/Base/Remediator.js +2 -0
- package/cjs/idx/remediators/Base/Remediator.js.map +1 -1
- package/cjs/idx/remediators/Base/SelectAuthenticator.js +4 -3
- package/cjs/idx/remediators/Base/SelectAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/Base/VerifyAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/ChallengeAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/EnrollAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/EnrollPoll.js +2 -3
- package/cjs/idx/remediators/EnrollPoll.js.map +1 -1
- package/cjs/idx/remediators/EnrollProfile.js +4 -1
- package/cjs/idx/remediators/EnrollProfile.js.map +1 -1
- package/cjs/idx/remediators/EnrollmentChannelData.js +80 -0
- package/cjs/idx/remediators/EnrollmentChannelData.js.map +1 -0
- package/cjs/idx/remediators/Identify.js.map +1 -1
- package/cjs/idx/remediators/ReEnrollAuthenticator.js +1 -0
- package/cjs/idx/remediators/ReEnrollAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/ResetAuthenticator.js.map +1 -1
- package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js +2 -2
- package/cjs/idx/remediators/SelectAuthenticatorAuthenticate.js.map +1 -1
- package/cjs/idx/remediators/SelectAuthenticatorEnroll.js.map +1 -1
- package/cjs/idx/remediators/SelectEnrollProfile.js.map +1 -1
- package/cjs/idx/remediators/SelectEnrollmentChannel.js +74 -0
- package/cjs/idx/remediators/SelectEnrollmentChannel.js.map +1 -0
- package/cjs/idx/remediators/Skip.js.map +1 -1
- package/cjs/idx/remediators/index.js +26 -0
- package/cjs/idx/remediators/index.js.map +1 -1
- package/cjs/idx/remediators/util.js +7 -2
- package/cjs/idx/remediators/util.js.map +1 -1
- package/cjs/idx/run.js +111 -45
- package/cjs/idx/run.js.map +1 -1
- package/cjs/idx/startTransaction.js +4 -2
- package/cjs/idx/startTransaction.js.map +1 -1
- package/cjs/idx/transactionMeta.js +82 -69
- package/cjs/idx/transactionMeta.js.map +1 -1
- package/cjs/idx/types/idx-js.js.map +1 -1
- package/cjs/idx/types/index.js +19 -3
- package/cjs/idx/types/index.js.map +1 -1
- package/cjs/index.js +14 -0
- package/cjs/index.js.map +1 -1
- package/cjs/oidc/endpoints/authorize.js +2 -0
- package/cjs/oidc/endpoints/authorize.js.map +1 -1
- package/cjs/oidc/endpoints/token.js +1 -0
- package/cjs/oidc/endpoints/token.js.map +1 -1
- package/cjs/oidc/exchangeCodeForTokens.js +3 -3
- package/cjs/oidc/exchangeCodeForTokens.js.map +1 -1
- package/cjs/oidc/getToken.js +3 -1
- package/cjs/oidc/getToken.js.map +1 -1
- package/cjs/oidc/getWithRedirect.js +10 -37
- package/cjs/oidc/getWithRedirect.js.map +1 -1
- package/cjs/oidc/handleOAuthResponse.js +80 -86
- package/cjs/oidc/handleOAuthResponse.js.map +1 -1
- package/cjs/oidc/parseFromUrl.js.map +1 -1
- package/cjs/oidc/renewToken.js.map +1 -1
- package/cjs/oidc/renewTokens.js +1 -1
- package/cjs/oidc/renewTokens.js.map +1 -1
- package/cjs/oidc/revokeToken.js +28 -29
- package/cjs/oidc/revokeToken.js.map +1 -1
- package/cjs/oidc/util/index.js +14 -0
- package/cjs/oidc/util/index.js.map +1 -1
- package/cjs/oidc/util/loginRedirect.js +6 -1
- package/cjs/oidc/util/loginRedirect.js.map +1 -1
- package/cjs/oidc/util/oauth.js.map +1 -1
- package/cjs/oidc/util/oauthMeta.js +36 -0
- package/cjs/oidc/util/oauthMeta.js.map +1 -0
- package/cjs/oidc/util/pkce.js.map +1 -1
- package/cjs/oidc/util/prepareTokenParams.js +57 -36
- package/cjs/oidc/util/prepareTokenParams.js.map +1 -1
- package/cjs/oidc/util/validateClaims.js +2 -0
- package/cjs/oidc/util/validateClaims.js.map +1 -1
- package/cjs/oidc/verifyToken.js +2 -1
- package/cjs/oidc/verifyToken.js.map +1 -1
- package/cjs/options.js +6 -2
- package/cjs/options.js.map +1 -1
- package/cjs/server/serverStorage.js +1 -1
- package/cjs/server/serverStorage.js.map +1 -1
- package/cjs/services/TokenService.js +3 -0
- package/cjs/services/TokenService.js.map +1 -1
- package/cjs/tx/AuthTransaction.js +3 -0
- package/cjs/tx/AuthTransaction.js.map +1 -1
- package/cjs/tx/TransactionState.js +0 -17
- package/cjs/tx/TransactionState.js.map +1 -1
- package/cjs/tx/api.js +3 -2
- package/cjs/tx/api.js.map +1 -1
- package/cjs/types/Transaction.js.map +1 -1
- package/cjs/util/index.js +0 -13
- package/cjs/util/index.js.map +1 -1
- package/cjs/util/url.js.map +1 -1
- package/dist/okta-auth-js.min.js +1 -1
- package/dist/okta-auth-js.min.js.map +1 -1
- package/dist/okta-auth-js.umd.js +1 -1
- package/dist/okta-auth-js.umd.js.map +1 -1
- package/esm/index.js +1334 -758
- package/esm/index.js.map +1 -1
- package/lib/AuthStateManager.d.ts +1 -2
- package/lib/OktaAuth.d.ts +4 -10
- package/lib/StorageManager.d.ts +1 -1
- package/lib/TokenManager.d.ts +2 -2
- package/lib/TransactionManager.d.ts +3 -2
- package/lib/browser/fingerprint.d.ts +1 -1
- package/lib/builderUtil.d.ts +1 -2
- package/lib/crypto/browser.d.ts +1 -1
- package/lib/features.d.ts +1 -1
- package/lib/idx/authenticate.d.ts +1 -1
- package/lib/idx/authenticator/VerificationCodeAuthenticator.d.ts +1 -1
- package/lib/idx/cancel.d.ts +1 -1
- package/lib/{util → idx}/emailVerify.d.ts +10 -1
- package/lib/idx/flow/FlowSpecification.d.ts +1 -0
- package/lib/idx/index.d.ts +1 -0
- package/lib/idx/interact.d.ts +4 -11
- package/lib/idx/introspect.d.ts +3 -2
- package/lib/idx/proceed.d.ts +4 -2
- package/lib/idx/recoverPassword.d.ts +1 -1
- package/lib/idx/remediate.d.ts +10 -4
- package/lib/idx/remediators/AuthenticatorEnrollmentData.d.ts +3 -3
- package/lib/idx/remediators/AuthenticatorVerificationData.d.ts +3 -3
- package/lib/idx/remediators/Base/AuthenticatorData.d.ts +7 -7
- package/lib/idx/remediators/Base/Remediator.d.ts +1 -1
- package/lib/idx/remediators/Base/SelectAuthenticator.d.ts +7 -7
- package/lib/idx/remediators/Base/VerifyAuthenticator.d.ts +2 -1
- package/lib/idx/remediators/EnrollProfile.d.ts +1 -1
- package/lib/idx/remediators/EnrollmentChannelData.d.ts +53 -0
- package/lib/idx/remediators/Identify.d.ts +2 -2
- package/lib/idx/remediators/ReEnrollAuthenticator.d.ts +2 -2
- package/lib/idx/remediators/RedirectIdp.d.ts +3 -3
- package/lib/idx/remediators/SelectEnrollmentChannel.d.ts +39 -0
- package/lib/idx/remediators/index.d.ts +2 -0
- package/lib/idx/remediators/util.d.ts +2 -2
- package/lib/idx/run.d.ts +3 -1
- package/lib/idx/startTransaction.d.ts +3 -2
- package/lib/idx/transactionMeta.d.ts +6 -27
- package/lib/idx/types/idx-js.d.ts +8 -1
- package/lib/idx/types/index.d.ts +17 -6
- package/lib/index.d.ts +1 -0
- package/lib/oidc/exchangeCodeForTokens.d.ts +12 -0
- package/lib/oidc/getWithRedirect.d.ts +1 -1
- package/lib/oidc/handleOAuthResponse.d.ts +1 -1
- package/lib/oidc/parseFromUrl.d.ts +1 -1
- package/lib/oidc/renewToken.d.ts +1 -1
- package/lib/oidc/renewTokens.d.ts +1 -1
- package/lib/oidc/util/browser.d.ts +1 -1
- package/lib/oidc/util/errors.d.ts +1 -1
- package/lib/oidc/util/index.d.ts +1 -0
- package/lib/oidc/util/oauth.d.ts +1 -8
- package/lib/oidc/util/oauthMeta.d.ts +2 -0
- package/lib/oidc/util/prepareTokenParams.d.ts +3 -0
- package/lib/server/serverStorage.d.ts +1 -1
- package/lib/services/TokenService.d.ts +2 -2
- package/lib/tx/AuthTransaction.d.ts +2 -2
- package/lib/tx/TransactionState.d.ts +11 -1
- package/lib/tx/api.d.ts +6 -6
- package/lib/types/OktaAuthOptions.d.ts +5 -6
- package/lib/types/Storage.d.ts +3 -3
- package/lib/types/Transaction.d.ts +11 -0
- package/lib/types/UserClaims.d.ts +3 -3
- package/lib/types/api.d.ts +28 -16
- package/lib/util/console.d.ts +1 -1
- package/lib/util/index.d.ts +0 -1
- package/lib/util/types.d.ts +1 -1
- package/lib/util/url.d.ts +2 -2
- package/package.json +5 -5
- package/cjs/util/emailVerify.js +0 -28
- package/cjs/util/emailVerify.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/authenticate.ts"],"names":["authenticate","authClient","options","
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/authenticate.ts"],"names":["authenticate","authClient","options","password","authenticator","AuthenticatorKey","OKTA_PASSWORD","flow"],"mappings":";;;;AAaA;;AAMA;;AAnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA6BO,eAAeA,YAAf,CACLC,UADK,EACiBC,OAA8B,GAAG,EADlD,EAEoB;AACzB,MAAIA,OAAO,CAACC,QAAR,IAAoB,CAACD,OAAO,CAACE,aAAjC,EAAgD;AAC9CF,IAAAA,OAAO,CAACE,aAAR,GAAwBC,wBAAiBC,aAAzC;AACD;;AACD,SAAO,cAAIL,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErBK,IAAAA,IAAI,EAAE;AAFe,GAAhB,CAAP;AAID","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 OktaAuth,\n IdxOptions,\n IdxTransaction,\n AuthenticatorKey\n} from '../types';\nimport { run } from './run';\nimport { \n IdentifyValues,\n SelectAuthenticatorAuthenticateValues,\n ChallengeAuthenticatorValues,\n ReEnrollAuthenticatorValues,\n AuthenticatorEnrollmentDataValues,\n SelectAuthenticatorEnrollValues,\n EnrollAuthenticatorValues,\n} from './remediators';\n\nexport type AuthenticationOptions = IdxOptions \n & IdentifyValues \n & SelectAuthenticatorAuthenticateValues \n & SelectAuthenticatorEnrollValues\n & ChallengeAuthenticatorValues \n & ReEnrollAuthenticatorValues\n & AuthenticatorEnrollmentDataValues\n & EnrollAuthenticatorValues;\n\nexport async function authenticate(\n authClient: OktaAuth, options: AuthenticationOptions = {}\n): Promise<IdxTransaction> {\n if (options.password && !options.authenticator) {\n options.authenticator = AuthenticatorKey.OKTA_PASSWORD;\n }\n return run(authClient, { \n ...options, \n flow: 'authenticate'\n });\n}\n"],"file":"authenticate.js"}
|
|
@@ -4,6 +4,7 @@ exports.SecurityQuestionVerification = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _Authenticator = require("./Authenticator");
|
|
6
6
|
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
7
8
|
class SecurityQuestionVerification extends _Authenticator.Authenticator {
|
|
8
9
|
canVerify(values) {
|
|
9
10
|
return values.answer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/idx/authenticator/SecurityQuestionVerification.ts"],"names":["SecurityQuestionVerification","Authenticator","canVerify","values","answer","mapCredentials","questionKey","meta","contextualData","enrolledQuestion","getInputs","name","type","label","required"],"mappings":";;;;
|
|
1
|
+
{"version":3,"sources":["../../../../lib/idx/authenticator/SecurityQuestionVerification.ts"],"names":["SecurityQuestionVerification","Authenticator","canVerify","values","answer","mapCredentials","questionKey","meta","contextualData","enrolledQuestion","getInputs","name","type","label","required"],"mappings":";;;;AACA;;AADA;AAGO,MAAMA,4BAAN,SAA2CC,4BAA3C,CAAyD;AAC9DC,EAAAA,SAAS,CAACC,MAAD,EAAS;AAChB,WAAOA,MAAM,CAACC,MAAd;AACD;;AAEDC,EAAAA,cAAc,CAACF,MAAD,EAAS;AACrB,WAAO;AACLG,MAAAA,WAAW,EAAE,KAAKC,IAAL,CAAUC,cAAV,CAA0BC,gBAA1B,CAA4CH,WADpD;AAELF,MAAAA,MAAM,EAAED,MAAM,CAACC;AAFV,KAAP;AAID;;AAEDM,EAAAA,SAAS,GAAG;AACV,WAAO,CACL;AAAEC,MAAAA,IAAI,EAAE,QAAR;AAAkBC,MAAAA,IAAI,EAAE,QAAxB;AAAkCC,MAAAA,KAAK,EAAE,QAAzC;AAAmDC,MAAAA,QAAQ,EAAE;AAA7D,KADK,CAAP;AAGD;;AAhB6D","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { Authenticator } from './Authenticator';\n\nexport class SecurityQuestionVerification extends Authenticator {\n canVerify(values) {\n return values.answer;\n }\n\n mapCredentials(values) {\n return {\n questionKey: this.meta.contextualData!.enrolledQuestion!.questionKey,\n answer: values.answer\n };\n }\n\n getInputs() {\n return [\n { name: 'answer', type: 'string', label: 'Answer', required: true }\n ];\n }\n}\n"],"file":"SecurityQuestionVerification.js"}
|
|
@@ -9,12 +9,12 @@ var _Authenticator = require("./Authenticator");
|
|
|
9
9
|
// a new authenticator class should be created if special cases need to be handled
|
|
10
10
|
class VerificationCodeAuthenticator extends _Authenticator.Authenticator {
|
|
11
11
|
canVerify(values) {
|
|
12
|
-
return
|
|
12
|
+
return values.verificationCode || values.otp;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
mapCredentials(values) {
|
|
16
16
|
return {
|
|
17
|
-
passcode: values.verificationCode
|
|
17
|
+
passcode: values.verificationCode || values.otp
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/idx/authenticator/VerificationCodeAuthenticator.ts"],"names":["VerificationCodeAuthenticator","Authenticator","canVerify","values","verificationCode","mapCredentials","passcode","getInputs","idxRemediationValue","form","value","name","type","required"],"mappings":";;;;AAAA;;AAMA;AACA;AACA;AACO,MAAMA,6BAAN,SAA4CC,4BAA5C,CAA0D;AAC/DC,EAAAA,SAAS,CAACC,MAAD,EAAS;AAChB,
|
|
1
|
+
{"version":3,"sources":["../../../../lib/idx/authenticator/VerificationCodeAuthenticator.ts"],"names":["VerificationCodeAuthenticator","Authenticator","canVerify","values","verificationCode","otp","mapCredentials","passcode","getInputs","idxRemediationValue","form","value","name","type","required"],"mappings":";;;;AAAA;;AAMA;AACA;AACA;AACO,MAAMA,6BAAN,SAA4CC,4BAA5C,CAA0D;AAC/DC,EAAAA,SAAS,CAACC,MAAD,EAAS;AAChB,WAAQA,MAAM,CAACC,gBAAP,IAA2BD,MAAM,CAACE,GAA1C;AACD;;AAEDC,EAAAA,cAAc,CAACH,MAAD,EAAoD;AAChE,WAAO;AAAEI,MAAAA,QAAQ,EAAEJ,MAAM,CAACC,gBAAP,IAA2BD,MAAM,CAACE;AAA9C,KAAP;AACD;;AAEDG,EAAAA,SAAS,CAACC,mBAAD,EAAsB;AAAA;;AAC7B,WAAO,EACL,6BAAGA,mBAAmB,CAACC,IAAvB,0DAAG,sBAA0BC,KAA1B,CAAgC,CAAhC,CAAH,CADK;AAELC,MAAAA,IAAI,EAAE,kBAFD;AAGLC,MAAAA,IAAI,EAAE,QAHD;AAILC,MAAAA,QAAQ,EAAEL,mBAAmB,CAACK;AAJzB,KAAP;AAMD;;AAhB8D","sourcesContent":["import { Authenticator, Credentials } from './Authenticator';\n\ninterface VerificationCodeCredentials extends Credentials {\n passcode: string;\n}\n\n// general authenticator to handle \"verificationCode\" input\n// it can be used for \"email\", \"phone\", \"google authenticator\"\n// a new authenticator class should be created if special cases need to be handled\nexport class VerificationCodeAuthenticator extends Authenticator {\n canVerify(values) {\n return (values.verificationCode || values.otp);\n }\n\n mapCredentials(values): VerificationCodeCredentials | Credentials {\n return { passcode: values.verificationCode || values.otp };\n }\n\n getInputs(idxRemediationValue) {\n return {\n ...idxRemediationValue.form?.value[0],\n name: 'verificationCode',\n type: 'string',\n required: idxRemediationValue.required\n };\n }\n}\n"],"file":"VerificationCodeAuthenticator.js"}
|
|
@@ -15,18 +15,17 @@ var _SecurityQuestionVerification = require("./SecurityQuestionVerification");
|
|
|
15
15
|
var _types = require("../types");
|
|
16
16
|
|
|
17
17
|
function getAuthenticator(remediation) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = remediation;
|
|
18
|
+
var _value$contextualData;
|
|
19
|
+
|
|
20
|
+
const relatesTo = remediation.relatesTo;
|
|
21
|
+
const value = (relatesTo === null || relatesTo === void 0 ? void 0 : relatesTo.value) || {};
|
|
23
22
|
|
|
24
23
|
switch (value.key) {
|
|
25
24
|
case _types.AuthenticatorKey.OKTA_PASSWORD:
|
|
26
25
|
return new _OktaPassword.OktaPassword(value);
|
|
27
26
|
|
|
28
27
|
case _types.AuthenticatorKey.SECURITY_QUESTION:
|
|
29
|
-
if (value.contextualData.enrolledQuestion) {
|
|
28
|
+
if ((_value$contextualData = value.contextualData) !== null && _value$contextualData !== void 0 && _value$contextualData.enrolledQuestion) {
|
|
30
29
|
return new _SecurityQuestionVerification.SecurityQuestionVerification(value);
|
|
31
30
|
} else {
|
|
32
31
|
return new _SecurityQuestionEnrollment.SecurityQuestionEnrollment(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/idx/authenticator/getAuthenticator.ts"],"names":["getAuthenticator","remediation","relatesTo","value","key","AuthenticatorKey","OKTA_PASSWORD","OktaPassword","SECURITY_QUESTION","contextualData","enrolledQuestion","SecurityQuestionVerification","SecurityQuestionEnrollment","OKTA_VERIFY","OktaVerifyTotp","VerificationCodeAuthenticator"],"mappings":";;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAEO,SAASA,gBAAT,CAA0BC,WAA1B,EAAsE;AAC3E,
|
|
1
|
+
{"version":3,"sources":["../../../../lib/idx/authenticator/getAuthenticator.ts"],"names":["getAuthenticator","remediation","relatesTo","value","key","AuthenticatorKey","OKTA_PASSWORD","OktaPassword","SECURITY_QUESTION","contextualData","enrolledQuestion","SecurityQuestionVerification","SecurityQuestionEnrollment","OKTA_VERIFY","OktaVerifyTotp","VerificationCodeAuthenticator"],"mappings":";;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAEO,SAASA,gBAAT,CAA0BC,WAA1B,EAAsE;AAAA;;AAC3E,QAAMC,SAAS,GAAGD,WAAW,CAACC,SAA9B;AACA,QAAMC,KAAK,GAAG,CAAAD,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEC,KAAX,KAAoB,EAAlC;;AACA,UAAQA,KAAK,CAACC,GAAd;AACE,SAAKC,wBAAiBC,aAAtB;AACE,aAAO,IAAIC,0BAAJ,CAAiBJ,KAAjB,CAAP;;AACF,SAAKE,wBAAiBG,iBAAtB;AACE,mCAAIL,KAAK,CAACM,cAAV,kDAAI,sBAAsBC,gBAA1B,EAA4C;AAC1C,eAAO,IAAIC,0DAAJ,CAAiCR,KAAjC,CAAP;AACD,OAFD,MAEO;AACL,eAAO,IAAIS,sDAAJ,CAA+BT,KAA/B,CAAP;AACD;;AACH,SAAKE,wBAAiBQ,WAAtB;AACE,aAAO,IAAIC,8BAAJ,CAAmBX,KAAnB,CAAP;;AACF;AACE,aAAO,IAAIY,4DAAJ,CAAkCZ,KAAlC,CAAP;AAZJ;AAcD","sourcesContent":["import { OktaVerifyTotp } from './OktaVerifyTotp';\nimport { Authenticator } from './Authenticator';\nimport { VerificationCodeAuthenticator } from './VerificationCodeAuthenticator';\nimport { OktaPassword } from './OktaPassword';\nimport { SecurityQuestionEnrollment } from './SecurityQuestionEnrollment';\nimport { SecurityQuestionVerification } from './SecurityQuestionVerification';\nimport { IdxAuthenticator, IdxRemediation } from '../types/idx-js';\nimport { AuthenticatorKey } from '../types';\n\nexport function getAuthenticator(remediation: IdxRemediation): Authenticator {\n const relatesTo = remediation.relatesTo;\n const value = relatesTo?.value || {} as IdxAuthenticator;\n switch (value.key) {\n case AuthenticatorKey.OKTA_PASSWORD:\n return new OktaPassword(value);\n case AuthenticatorKey.SECURITY_QUESTION:\n if (value.contextualData?.enrolledQuestion) {\n return new SecurityQuestionVerification(value);\n } else {\n return new SecurityQuestionEnrollment(value);\n }\n case AuthenticatorKey.OKTA_VERIFY:\n return new OktaVerifyTotp(value);\n default:\n return new VerificationCodeAuthenticator(value);\n }\n}\n"],"file":"getAuthenticator.js"}
|
package/cjs/idx/cancel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/cancel.ts"],"names":["cancel","authClient","options","meta","transactionManager","load","flowSpec","flow","actions"],"mappings":";;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQO,eAAeA,MAAf,CAAuBC,UAAvB,EAA6CC,OAA7C,
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/cancel.ts"],"names":["cancel","authClient","options","meta","transactionManager","load","flowSpec","flow","actions"],"mappings":";;;;AAaA;;AACA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQO,eAAeA,MAAf,CAAuBC,UAAvB,EAA6CC,OAA7C,EAAsE;AAC3E,QAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;AACA,QAAMC,QAAQ,GAAG,gCAAqBL,UAArB,EAAiCE,IAAI,CAACI,IAAtC,CAAjB;AACA,SAAO,cAAIN,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErB,OAAGI,QAFkB;AAGrBE,IAAAA,OAAO,EAAE,CAAC,QAAD;AAHY,GAAhB,CAAP;AAKD","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, IdxOptions, IdxTransactionMeta } from '../types';\nimport { run } from './run';\nimport { getFlowSpecification } from './flow';\n\nexport type CancelOptions = IdxOptions;\n\nexport async function cancel (authClient: OktaAuth, options?: CancelOptions) {\n const meta = authClient.transactionManager.load() as IdxTransactionMeta;\n const flowSpec = getFlowSpecification(authClient, meta.flow);\n return run(authClient, {\n ...options,\n ...flowSpec,\n actions: ['cancel']\n });\n}\n"],"file":"cancel.js"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.isEmailVerifyCallbackError = isEmailVerifyCallbackError;
|
|
6
|
+
exports.isEmailVerifyCallback = isEmailVerifyCallback;
|
|
7
|
+
exports.parseEmailVerifyCallback = parseEmailVerifyCallback;
|
|
8
|
+
exports.handleEmailVerifyCallback = handleEmailVerifyCallback;
|
|
9
|
+
exports.EmailVerifyCallbackError = void 0;
|
|
10
|
+
|
|
11
|
+
var _CustomError = _interopRequireDefault(require("../errors/CustomError"));
|
|
12
|
+
|
|
13
|
+
var _urlParams = require("../oidc/util/urlParams");
|
|
14
|
+
|
|
15
|
+
/*!
|
|
16
|
+
* Copyright (c) 2015-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
17
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
18
|
+
*
|
|
19
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
20
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
22
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
+
*
|
|
24
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
class EmailVerifyCallbackError extends _CustomError.default {
|
|
27
|
+
constructor(state, otp) {
|
|
28
|
+
super(`Enter the OTP code in the originating client: ${otp}`);
|
|
29
|
+
this.name = 'EmailVerifyCallbackError';
|
|
30
|
+
this.state = state;
|
|
31
|
+
this.otp = otp;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.EmailVerifyCallbackError = EmailVerifyCallbackError;
|
|
37
|
+
|
|
38
|
+
function isEmailVerifyCallbackError(error) {
|
|
39
|
+
return error.name === 'EmailVerifyCallbackError';
|
|
40
|
+
} // Check if state && otp have been passed back in the url
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
function isEmailVerifyCallback(urlPath) {
|
|
44
|
+
return /(otp=)/i.test(urlPath) && /(state=)/i.test(urlPath);
|
|
45
|
+
} // Parse state and otp from a urlPath (should be either a search or fragment from the URL)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
function parseEmailVerifyCallback(urlPath) {
|
|
49
|
+
return (0, _urlParams.urlParamsToObject)(urlPath);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function handleEmailVerifyCallback(authClient, search) {
|
|
53
|
+
if (isEmailVerifyCallback(search)) {
|
|
54
|
+
const {
|
|
55
|
+
state,
|
|
56
|
+
otp
|
|
57
|
+
} = parseEmailVerifyCallback(search);
|
|
58
|
+
|
|
59
|
+
if (authClient.idx.canProceed({
|
|
60
|
+
state
|
|
61
|
+
})) {
|
|
62
|
+
// same browser / device
|
|
63
|
+
return await authClient.idx.proceed({
|
|
64
|
+
state,
|
|
65
|
+
otp
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
// different browser or device
|
|
69
|
+
throw new EmailVerifyCallbackError(state, otp);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=emailVerify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/emailVerify.ts"],"names":["EmailVerifyCallbackError","CustomError","constructor","state","otp","name","isEmailVerifyCallbackError","error","isEmailVerifyCallback","urlPath","test","parseEmailVerifyCallback","handleEmailVerifyCallback","authClient","search","idx","canProceed","proceed"],"mappings":";;;;;;;;;;AAeA;;AACA;;AAfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYO,MAAMA,wBAAN,SAAuCC,oBAAvC,CAAmD;AAIxDC,EAAAA,WAAW,CAACC,KAAD,EAAgBC,GAAhB,EAA6B;AACtC,UAAO,iDAAgDA,GAAI,EAA3D;AACA,SAAKC,IAAL,GAAY,0BAAZ;AACA,SAAKF,KAAL,GAAaA,KAAb;AACA,SAAKC,GAAL,GAAWA,GAAX;AACD;;AATuD;;;;AAYnD,SAASE,0BAAT,CAAoCC,KAApC,EAAkD;AACvD,SAAQA,KAAK,CAACF,IAAN,KAAe,0BAAvB;AACD,C,CAED;;;AACO,SAASG,qBAAT,CAAgCC,OAAhC,EAA0D;AAC/D,SAAO,UAAUC,IAAV,CAAeD,OAAf,KAA2B,YAAYC,IAAZ,CAAiBD,OAAjB,CAAlC;AACD,C,CAED;;;AACO,SAASE,wBAAT,CAAkCF,OAAlC,EAAgF;AACrF,SAAO,kCAAkBA,OAAlB,CAAP;AACD;;AAEM,eAAeG,yBAAf,CAAyCC,UAAzC,EAA+DC,MAA/D,EAA+E;AACpF,MAAIN,qBAAqB,CAACM,MAAD,CAAzB,EAAmC;AACjC,UAAM;AAAEX,MAAAA,KAAF;AAASC,MAAAA;AAAT,QAAiBO,wBAAwB,CAACG,MAAD,CAA/C;;AACA,QAAID,UAAU,CAACE,GAAX,CAAeC,UAAf,CAA0B;AAAEb,MAAAA;AAAF,KAA1B,CAAJ,EAA0C;AACxC;AACA,aAAO,MAAMU,UAAU,CAACE,GAAX,CAAeE,OAAf,CAAuB;AAAEd,QAAAA,KAAF;AAASC,QAAAA;AAAT,OAAvB,CAAb;AACD,KAHD,MAGO;AACL;AACA,YAAM,IAAIJ,wBAAJ,CAA6BG,KAA7B,EAAoCC,GAApC,CAAN;AACD;AACF;AACF","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 { OktaAuth } from '../types';\n\nimport CustomError from '../errors/CustomError';\nimport { urlParamsToObject } from '../oidc/util/urlParams';\n\nexport interface EmailVerifyCallbackResponse {\n state: string;\n otp: string;\n}\n\nexport class EmailVerifyCallbackError extends CustomError {\n state: string;\n otp: string;\n\n constructor(state: string, otp: string) {\n super(`Enter the OTP code in the originating client: ${otp}`);\n this.name = 'EmailVerifyCallbackError';\n this.state = state;\n this.otp = otp;\n }\n}\n\nexport function isEmailVerifyCallbackError(error: Error) {\n return (error.name === 'EmailVerifyCallbackError');\n}\n\n// Check if state && otp have been passed back in the url\nexport function isEmailVerifyCallback (urlPath: string): boolean {\n return /(otp=)/i.test(urlPath) && /(state=)/i.test(urlPath);\n}\n\n// Parse state and otp from a urlPath (should be either a search or fragment from the URL)\nexport function parseEmailVerifyCallback(urlPath: string): EmailVerifyCallbackResponse {\n return urlParamsToObject(urlPath) as EmailVerifyCallbackResponse;\n}\n\nexport async function handleEmailVerifyCallback(authClient: OktaAuth, search: string) {\n if (isEmailVerifyCallback(search)) {\n const { state, otp } = parseEmailVerifyCallback(search);\n if (authClient.idx.canProceed({ state })) {\n // same browser / device\n return await authClient.idx.proceed({ state, otp });\n } else {\n // different browser or device\n throw new EmailVerifyCallbackError(state, otp);\n }\n }\n}\n"],"file":"emailVerify.js"}
|
|
@@ -8,24 +8,35 @@ var _PasswordRecoveryFlow = require("./PasswordRecoveryFlow");
|
|
|
8
8
|
|
|
9
9
|
var _RegistrationFlow = require("./RegistrationFlow");
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
// eslint-disable-next-line complexity
|
|
12
|
+
function getFlowSpecification(oktaAuth, flow = 'default') {
|
|
13
|
+
let remediators,
|
|
14
|
+
actions,
|
|
15
|
+
withCredentials = true;
|
|
13
16
|
|
|
14
17
|
switch (flow) {
|
|
15
18
|
case 'register':
|
|
16
19
|
case 'signup':
|
|
17
20
|
case 'enrollProfile':
|
|
18
21
|
remediators = _RegistrationFlow.RegistrationFlow;
|
|
22
|
+
withCredentials = false;
|
|
19
23
|
break;
|
|
20
24
|
|
|
21
25
|
case 'recoverPassword':
|
|
22
26
|
case 'resetPassword':
|
|
23
27
|
remediators = _PasswordRecoveryFlow.PasswordRecoveryFlow;
|
|
24
28
|
actions = ['currentAuthenticator-recover', 'currentAuthenticatorEnrollment-recover'];
|
|
29
|
+
withCredentials = false;
|
|
30
|
+
break;
|
|
31
|
+
|
|
32
|
+
case 'authenticate':
|
|
33
|
+
case 'login':
|
|
34
|
+
case 'signin':
|
|
35
|
+
remediators = _AuthenticationFlow.AuthenticationFlow;
|
|
25
36
|
break;
|
|
26
37
|
|
|
27
38
|
default:
|
|
28
|
-
//
|
|
39
|
+
// default case has no flow monitor
|
|
29
40
|
remediators = _AuthenticationFlow.AuthenticationFlow;
|
|
30
41
|
break;
|
|
31
42
|
}
|
|
@@ -33,7 +44,8 @@ function getFlowSpecification(oktaAuth, flow = 'proceed') {
|
|
|
33
44
|
return {
|
|
34
45
|
flow,
|
|
35
46
|
remediators,
|
|
36
|
-
actions
|
|
47
|
+
actions,
|
|
48
|
+
withCredentials
|
|
37
49
|
};
|
|
38
50
|
}
|
|
39
51
|
//# sourceMappingURL=FlowSpecification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/idx/flow/FlowSpecification.ts"],"names":["getFlowSpecification","oktaAuth","flow","remediators","actions","RegistrationFlow","PasswordRecoveryFlow","AuthenticationFlow"],"mappings":";;;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../../../../lib/idx/flow/FlowSpecification.ts"],"names":["getFlowSpecification","oktaAuth","flow","remediators","actions","withCredentials","RegistrationFlow","PasswordRecoveryFlow","AuthenticationFlow"],"mappings":";;;;AACA;;AACA;;AACA;;AAUA;AACO,SAASA,oBAAT,CAA8BC,QAA9B,EAAkDC,IAAoB,GAAG,SAAzE,EAAuG;AAC5G,MAAIC,WAAJ;AAAA,MAAiBC,OAAjB;AAAA,MAA0BC,eAAe,GAAG,IAA5C;;AACA,UAAQH,IAAR;AACE,SAAK,UAAL;AACA,SAAK,QAAL;AACA,SAAK,eAAL;AACEC,MAAAA,WAAW,GAAGG,kCAAd;AACAD,MAAAA,eAAe,GAAG,KAAlB;AACA;;AACF,SAAK,iBAAL;AACA,SAAK,eAAL;AACEF,MAAAA,WAAW,GAAGI,0CAAd;AACAH,MAAAA,OAAO,GAAG,CACR,8BADQ,EAER,wCAFQ,CAAV;AAIAC,MAAAA,eAAe,GAAG,KAAlB;AACA;;AACF,SAAK,cAAL;AACA,SAAK,OAAL;AACA,SAAK,QAAL;AACEF,MAAAA,WAAW,GAAGK,sCAAd;AACA;;AACF;AACE;AACAL,MAAAA,WAAW,GAAGK,sCAAd;AACA;AAxBJ;;AA0BA,SAAO;AAAEN,IAAAA,IAAF;AAAQC,IAAAA,WAAR;AAAqBC,IAAAA,OAArB;AAA8BC,IAAAA;AAA9B,GAAP;AACD","sourcesContent":["import { OktaAuth, FlowIdentifier } from '../../types';\nimport { AuthenticationFlow } from './AuthenticationFlow';\nimport { PasswordRecoveryFlow } from './PasswordRecoveryFlow';\nimport { RegistrationFlow } from './RegistrationFlow';\nimport { RemediationFlow } from './RemediationFlow';\n\nexport interface FlowSpecification {\n flow: FlowIdentifier;\n remediators: RemediationFlow;\n actions?: string[];\n withCredentials?: boolean;\n}\n\n// eslint-disable-next-line complexity\nexport function getFlowSpecification(oktaAuth: OktaAuth, flow: FlowIdentifier = 'default'): FlowSpecification {\n let remediators, actions, withCredentials = true;\n switch (flow) {\n case 'register':\n case 'signup':\n case 'enrollProfile':\n remediators = RegistrationFlow;\n withCredentials = false;\n break;\n case 'recoverPassword':\n case 'resetPassword':\n remediators = PasswordRecoveryFlow;\n actions = [\n 'currentAuthenticator-recover', \n 'currentAuthenticatorEnrollment-recover'\n ];\n withCredentials = false;\n break;\n case 'authenticate':\n case 'login':\n case 'signin':\n remediators = AuthenticationFlow;\n break;\n default:\n // default case has no flow monitor\n remediators = AuthenticationFlow;\n break;\n }\n return { flow, remediators, actions, withCredentials };\n}\n"],"file":"FlowSpecification.js"}
|
|
@@ -21,6 +21,8 @@ const RegistrationFlow = {
|
|
|
21
21
|
'authenticator-enrollment-data': _remediators.AuthenticatorEnrollmentData,
|
|
22
22
|
'select-authenticator-enroll': _remediators.SelectAuthenticatorEnroll,
|
|
23
23
|
'enroll-poll': _remediators.EnrollPoll,
|
|
24
|
+
'select-enrollment-channel': _remediators.SelectEnrollmentChannel,
|
|
25
|
+
'enrollment-channel-data': _remediators.EnrollmentChannelData,
|
|
24
26
|
'enroll-authenticator': _remediators.EnrollAuthenticator,
|
|
25
27
|
'skip': _remediators.Skip
|
|
26
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../lib/idx/flow/RegistrationFlow.ts"],"names":["RegistrationFlow","SelectEnrollProfile","EnrollProfile","AuthenticatorEnrollmentData","SelectAuthenticatorEnroll","EnrollPoll","EnrollAuthenticator","Skip"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["../../../../lib/idx/flow/RegistrationFlow.ts"],"names":["RegistrationFlow","SelectEnrollProfile","EnrollProfile","AuthenticatorEnrollmentData","SelectAuthenticatorEnroll","EnrollPoll","SelectEnrollmentChannel","EnrollmentChannelData","EnrollAuthenticator","Skip"],"mappings":";;;;AAcA;;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBO,MAAMA,gBAAiC,GAAG;AAC/C,2BAAyBC,gCADsB;AAE/C,oBAAkBC,0BAF6B;AAG/C,mCAAiCC,wCAHc;AAI/C,iCAA+BC,sCAJgB;AAK/C,iBAAeC,uBALgC;AAM/C,+BAA6BC,oCANkB;AAO/C,6BAA2BC,kCAPoB;AAQ/C,0BAAwBC,gCARuB;AAS/C,UAAQC;AATuC,CAA1C","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 { RemediationFlow } from './RemediationFlow';\nimport { \n SelectEnrollProfile,\n EnrollPoll,\n SelectEnrollmentChannel,\n EnrollmentChannelData,\n EnrollProfile,\n SelectAuthenticatorEnroll,\n EnrollAuthenticator,\n AuthenticatorEnrollmentData,\n Skip,\n} from '../remediators';\n\nexport const RegistrationFlow: RemediationFlow = {\n 'select-enroll-profile': SelectEnrollProfile,\n 'enroll-profile': EnrollProfile,\n 'authenticator-enrollment-data': AuthenticatorEnrollmentData,\n 'select-authenticator-enroll': SelectAuthenticatorEnroll,\n 'enroll-poll': EnrollPoll,\n 'select-enrollment-channel': SelectEnrollmentChannel,\n 'enrollment-channel-data': EnrollmentChannelData,\n 'enroll-authenticator': EnrollAuthenticator,\n 'skip': Skip,\n};\n"],"file":"RegistrationFlow.js"}
|
|
@@ -37,6 +37,7 @@ async function handleInteractionCodeRedirect(authClient, url) {
|
|
|
37
37
|
const error = searchParams.get('error');
|
|
38
38
|
|
|
39
39
|
if (error) {
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
41
|
throw new _errors.OAuthError(error, searchParams.get('error_description'));
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/handleInteractionCodeRedirect.ts"],"names":["handleInteractionCodeRedirect","authClient","url","meta","transactionManager","load","AuthSdkError","codeVerifier","state","savedState","searchParams","URL","get","interactionCode","error","OAuthError","tokens","token","exchangeCodeForTokens","tokenManager","setTokens"],"mappings":";;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOO,eAAeA,6BAAf,CACLC,UADK,EAELC,GAFK,EAGU;AACf,QAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;;AACA,MAAI,CAACF,IAAL,EAAW;AACT,UAAM,IAAIG,oBAAJ,CAAiB,0CAAjB,CAAN;AACD;;AAED,QAAM;AACJC,IAAAA,YADI;AAEJC,IAAAA,KAAK,EAAEC;AAFH,MAGFN,IAHJ;AAIA,QAAM;AACJO,IAAAA,YADI,CAEN;AACA;;AAHM,MAIF,IAAIC,GAAJ,CAAQT,GAAR,CAJJ;AAKA,QAAMM,KAAK,GAAGE,YAAY,CAACE,GAAb,CAAiB,OAAjB,CAAd;AACA,QAAMC,eAAe,GAAGH,YAAY,CAACE,GAAb,CAAiB,kBAAjB,CAAxB,CAhBe,CAkBf;;AACA,QAAME,KAAK,GAAGJ,YAAY,CAACE,GAAb,CAAiB,OAAjB,CAAd;;AACA,MAAIE,KAAJ,EAAW;AACT,UAAM,IAAIC,kBAAJ,CAAeD,KAAf,EAAsBJ,YAAY,CAACE,GAAb,CAAiB,mBAAjB,CAAtB,CAAN;AACD;;AACD,MAAIJ,KAAK,KAAKC,UAAd,EAA0B;AACxB,UAAM,IAAIH,oBAAJ,CAAiB,6DAAjB,CAAN;AACD;;AACD,MAAI,CAACO,eAAL,EAAsB;AACpB,UAAM,IAAIP,oBAAJ,CAAiB,+CAAjB,CAAN;AACD,
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/handleInteractionCodeRedirect.ts"],"names":["handleInteractionCodeRedirect","authClient","url","meta","transactionManager","load","AuthSdkError","codeVerifier","state","savedState","searchParams","URL","get","interactionCode","error","OAuthError","tokens","token","exchangeCodeForTokens","tokenManager","setTokens"],"mappings":";;;;AAaA;;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOO,eAAeA,6BAAf,CACLC,UADK,EAELC,GAFK,EAGU;AACf,QAAMC,IAAI,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,IAA9B,EAAb;;AACA,MAAI,CAACF,IAAL,EAAW;AACT,UAAM,IAAIG,oBAAJ,CAAiB,0CAAjB,CAAN;AACD;;AAED,QAAM;AACJC,IAAAA,YADI;AAEJC,IAAAA,KAAK,EAAEC;AAFH,MAGFN,IAHJ;AAIA,QAAM;AACJO,IAAAA,YADI,CAEN;AACA;;AAHM,MAIF,IAAIC,GAAJ,CAAQT,GAAR,CAJJ;AAKA,QAAMM,KAAK,GAAGE,YAAY,CAACE,GAAb,CAAiB,OAAjB,CAAd;AACA,QAAMC,eAAe,GAAGH,YAAY,CAACE,GAAb,CAAiB,kBAAjB,CAAxB,CAhBe,CAkBf;;AACA,QAAME,KAAK,GAAGJ,YAAY,CAACE,GAAb,CAAiB,OAAjB,CAAd;;AACA,MAAIE,KAAJ,EAAW;AACT;AACA,UAAM,IAAIC,kBAAJ,CAAeD,KAAf,EAAsBJ,YAAY,CAACE,GAAb,CAAiB,mBAAjB,CAAtB,CAAN;AACD;;AACD,MAAIJ,KAAK,KAAKC,UAAd,EAA0B;AACxB,UAAM,IAAIH,oBAAJ,CAAiB,6DAAjB,CAAN;AACD;;AACD,MAAI,CAACO,eAAL,EAAsB;AACpB,UAAM,IAAIP,oBAAJ,CAAiB,+CAAjB,CAAN;AACD,GA7Bc,CA+Bf;;;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAa,MAAMf,UAAU,CAACgB,KAAX,CAAiBC,qBAAjB,CAAuC;AAAEL,IAAAA,eAAF;AAAmBN,IAAAA;AAAnB,GAAvC,CAAzB;AACAN,EAAAA,UAAU,CAACkB,YAAX,CAAwBC,SAAxB,CAAkCJ,MAAlC;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 { AuthSdkError, OAuthError } from '../errors';\nimport { OktaAuth } from '..';\nimport {IdxTransactionMeta} from '../types';\n\nexport async function handleInteractionCodeRedirect(\n authClient: OktaAuth, \n url: string\n): Promise<void> {\n const meta = authClient.transactionManager.load() as IdxTransactionMeta;\n if (!meta) {\n throw new AuthSdkError('No transaction data was found in storage');\n }\n\n const { \n codeVerifier,\n state: savedState \n } = meta;\n const { \n searchParams\n // URL API has been added to the polyfill\n // eslint-disable-next-line compat/compat\n } = new URL(url); \n const state = searchParams.get('state');\n const interactionCode = searchParams.get('interaction_code');\n\n // Error handling\n const error = searchParams.get('error');\n if (error) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n throw new OAuthError(error, searchParams.get('error_description')!);\n }\n if (state !== savedState) {\n throw new AuthSdkError('State in redirect uri does not match with transaction state');\n }\n if (!interactionCode) {\n throw new AuthSdkError('Unable to parse interaction_code from the url');\n }\n \n // Save tokens to storage\n const { tokens } = await authClient.token.exchangeCodeForTokens({ interactionCode, codeVerifier });\n authClient.tokenManager.setTokens(tokens);\n}"],"file":"handleInteractionCodeRedirect.js"}
|
package/cjs/idx/index.js
CHANGED
|
@@ -26,6 +26,19 @@ Object.keys(_cancel).forEach(function (key) {
|
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
var _emailVerify = require("./emailVerify");
|
|
30
|
+
|
|
31
|
+
Object.keys(_emailVerify).forEach(function (key) {
|
|
32
|
+
if (key === "default" || key === "__esModule") return;
|
|
33
|
+
if (key in exports && exports[key] === _emailVerify[key]) return;
|
|
34
|
+
Object.defineProperty(exports, key, {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return _emailVerify[key];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
29
42
|
var _interact = require("./interact");
|
|
30
43
|
|
|
31
44
|
Object.keys(_interact).forEach(function (key) {
|
package/cjs/idx/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/index.ts"],"names":[],"mappings":";;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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 './authenticate';\nexport * from './cancel';\nexport * from './interact';\nexport * from './introspect';\nexport * from './poll';\nexport * from './proceed';\nexport * from './register';\nexport * from './recoverPassword';\nexport * from './handleInteractionCodeRedirect';\nexport * from './startTransaction';\nexport * from './transactionMeta';\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/index.ts"],"names":[],"mappings":";;AAaA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","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 './authenticate';\nexport * from './cancel';\nexport * from './emailVerify';\nexport * from './interact';\nexport * from './introspect';\nexport * from './poll';\nexport * from './proceed';\nexport * from './register';\nexport * from './recoverPassword';\nexport * from './handleInteractionCodeRedirect';\nexport * from './startTransaction';\nexport * from './transactionMeta';\n"],"file":"index.js"}
|
package/cjs/idx/interact.js
CHANGED
|
@@ -10,6 +10,12 @@ var _transactionMeta = require("./transactionMeta");
|
|
|
10
10
|
|
|
11
11
|
var _oidc = require("../oidc");
|
|
12
12
|
|
|
13
|
+
var _ = require(".");
|
|
14
|
+
|
|
15
|
+
var _util = require("../util");
|
|
16
|
+
|
|
17
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
18
|
+
|
|
13
19
|
/*!
|
|
14
20
|
* Copyright (c) 2021, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
15
21
|
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
@@ -21,6 +27,8 @@ var _oidc = require("../oidc");
|
|
|
21
27
|
*
|
|
22
28
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
23
29
|
*/
|
|
30
|
+
|
|
31
|
+
/* eslint complexity:[0,8] */
|
|
24
32
|
function getResponse(meta) {
|
|
25
33
|
return {
|
|
26
34
|
meta,
|
|
@@ -31,34 +39,33 @@ function getResponse(meta) {
|
|
|
31
39
|
|
|
32
40
|
|
|
33
41
|
async function interact(authClient, options = {}) {
|
|
34
|
-
|
|
35
|
-
const meta = await (0, _transactionMeta.getTransactionMeta)(authClient, {
|
|
36
|
-
state
|
|
37
|
-
}); // Saved transaction, return meta
|
|
42
|
+
var _meta;
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} // These properties are always loaded from meta (or calculated fresh)
|
|
44
|
+
options = (0, _util.removeNils)(options);
|
|
45
|
+
let meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient, options); // If meta exists, it has been validated against all options
|
|
42
46
|
|
|
47
|
+
if ((_meta = meta) !== null && _meta !== void 0 && _meta.interactionHandle) {
|
|
48
|
+
return getResponse(meta); // Saved transaction, return meta
|
|
49
|
+
} // Create new meta, respecting previous meta if it has been set and is not overridden
|
|
43
50
|
|
|
44
|
-
const {
|
|
45
|
-
codeChallenge,
|
|
46
|
-
codeChallengeMethod
|
|
47
|
-
} = meta; // These properties are defined by global configuration
|
|
48
51
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
} = authClient.options; // These properties can be set in options, but also have a default value in global configuration.
|
|
53
|
-
|
|
54
|
-
state = state || meta.state;
|
|
55
|
-
const scopes = options.scopes || authClient.options.scopes || meta.scopes; // These properties can be set in options
|
|
56
|
-
|
|
57
|
-
const {
|
|
58
|
-
activationToken
|
|
59
|
-
} = options;
|
|
52
|
+
meta = await (0, _.createTransactionMeta)(authClient, { ...meta,
|
|
53
|
+
...options
|
|
54
|
+
});
|
|
60
55
|
const baseUrl = (0, _oidc.getOAuthBaseUrl)(authClient);
|
|
61
|
-
|
|
56
|
+
let {
|
|
57
|
+
clientId,
|
|
58
|
+
redirectUri,
|
|
59
|
+
state,
|
|
60
|
+
scopes,
|
|
61
|
+
withCredentials,
|
|
62
|
+
codeChallenge,
|
|
63
|
+
codeChallengeMethod,
|
|
64
|
+
activationToken,
|
|
65
|
+
recoveryToken
|
|
66
|
+
} = meta;
|
|
67
|
+
const interactionHandle = await _oktaIdxJs.default.interact({
|
|
68
|
+
withCredentials,
|
|
62
69
|
// OAuth
|
|
63
70
|
clientId,
|
|
64
71
|
baseUrl,
|
|
@@ -68,17 +75,22 @@ async function interact(authClient, options = {}) {
|
|
|
68
75
|
// PKCE
|
|
69
76
|
codeChallenge,
|
|
70
77
|
codeChallengeMethod,
|
|
71
|
-
//
|
|
72
|
-
activationToken
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
interactionHandle,
|
|
76
|
-
state,
|
|
77
|
-
scopes
|
|
78
|
-
}; // Save transaction meta so it can be resumed
|
|
79
|
-
|
|
80
|
-
(0, _transactionMeta.saveTransactionMeta)(authClient, newMeta);
|
|
81
|
-
return getResponse(newMeta);
|
|
78
|
+
// Activation
|
|
79
|
+
activationToken,
|
|
80
|
+
// Recovery
|
|
81
|
+
recoveryToken
|
|
82
82
|
});
|
|
83
|
+
const newMeta = { ...meta,
|
|
84
|
+
interactionHandle,
|
|
85
|
+
// Options which can be passed into interact() should be saved in the meta
|
|
86
|
+
withCredentials,
|
|
87
|
+
state,
|
|
88
|
+
scopes,
|
|
89
|
+
recoveryToken,
|
|
90
|
+
activationToken
|
|
91
|
+
}; // Save transaction meta so it can be resumed
|
|
92
|
+
|
|
93
|
+
(0, _transactionMeta.saveTransactionMeta)(authClient, newMeta);
|
|
94
|
+
return getResponse(newMeta);
|
|
83
95
|
}
|
|
84
96
|
//# sourceMappingURL=interact.js.map
|
package/cjs/idx/interact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/interact.ts"],"names":["getResponse","meta","interactionHandle","state","interact","authClient","options","
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/interact.ts"],"names":["getResponse","meta","interactionHandle","state","interact","authClient","options","baseUrl","clientId","redirectUri","scopes","withCredentials","codeChallenge","codeChallengeMethod","activationToken","recoveryToken","idx","newMeta"],"mappings":";;;;;;AAaA;;AAEA;;AACA;;AACA;;AACA;;AAlBA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AAwBA,SAASA,WAAT,CAAqBC,IAArB,EAAiE;AAC/D,SAAO;AACLA,IAAAA,IADK;AAELC,IAAAA,iBAAiB,EAAED,IAAI,CAACC,iBAFnB;AAGLC,IAAAA,KAAK,EAAEF,IAAI,CAACE;AAHP,GAAP;AAKD,C,CAED;;;AACO,eAAeC,QAAf,CAAyBC,UAAzB,EAA+CC,OAAwB,GAAG,EAA1E,EAAyG;AAAA;;AAC9GA,EAAAA,OAAO,GAAG,sBAAWA,OAAX,CAAV;AAEA,MAAIL,IAAI,GAAG,8CAAwBI,UAAxB,EAAoCC,OAApC,CAAX,CAH8G,CAI9G;;AAEA,eAAIL,IAAJ,kCAAI,MAAMC,iBAAV,EAA6B;AAC3B,WAAOF,WAAW,CAACC,IAAD,CAAlB,CAD2B,CACD;AAC3B,GAR6G,CAU9G;;;AACAA,EAAAA,IAAI,GAAG,MAAM,6BAAsBI,UAAtB,EAAkC,EAAE,GAAGJ,IAAL;AAAW,OAAGK;AAAd,GAAlC,CAAb;AACA,QAAMC,OAAO,GAAG,2BAAgBF,UAAhB,CAAhB;AACA,MAAI;AACFG,IAAAA,QADE;AAEFC,IAAAA,WAFE;AAGFN,IAAAA,KAHE;AAIFO,IAAAA,MAJE;AAKFC,IAAAA,eALE;AAMFC,IAAAA,aANE;AAOFC,IAAAA,mBAPE;AAQFC,IAAAA,eARE;AASFC,IAAAA;AATE,MAUAd,IAVJ;AAYA,QAAMC,iBAAiB,GAAG,MAAMc,mBAAIZ,QAAJ,CAAa;AAC3CO,IAAAA,eAD2C;AAG3C;AACAH,IAAAA,QAJ2C;AAK3CD,IAAAA,OAL2C;AAM3CG,IAAAA,MAN2C;AAO3CP,IAAAA,KAP2C;AAQ3CM,IAAAA,WAR2C;AAU3C;AACAG,IAAAA,aAX2C;AAY3CC,IAAAA,mBAZ2C;AAc3C;AACAC,IAAAA,eAf2C;AAiB3C;AACAC,IAAAA;AAlB2C,GAAb,CAAhC;AAoBA,QAAME,OAAO,GAAG,EACd,GAAGhB,IADW;AAEdC,IAAAA,iBAFc;AAId;AACAS,IAAAA,eALc;AAMdR,IAAAA,KANc;AAOdO,IAAAA,MAPc;AAQdK,IAAAA,aARc;AASdD,IAAAA;AATc,GAAhB,CA7C8G,CAwD9G;;AACA,4CAAoBT,UAApB,EAAgCY,OAAhC;AAEA,SAAOjB,WAAW,CAACiB,OAAD,CAAlB;AACD","sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/*!\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/* eslint complexity:[0,8] */\nimport idx from '@okta/okta-idx-js';\nimport { OktaAuth, IdxTransactionMeta } from '../types';\nimport { getSavedTransactionMeta, saveTransactionMeta } from './transactionMeta';\nimport { getOAuthBaseUrl } from '../oidc';\nimport { createTransactionMeta } from '.';\nimport { removeNils } from '../util';\n\nexport interface InteractOptions {\n withCredentials?: boolean;\n state?: string;\n scopes?: string[];\n codeChallenge?: string;\n codeChallengeMethod?: string;\n activationToken?: string;\n recoveryToken?: string;\n}\n\nexport interface InteractResponse {\n state?: string;\n interactionHandle: string;\n meta: IdxTransactionMeta;\n}\n\nfunction getResponse(meta: IdxTransactionMeta): InteractResponse {\n return {\n meta,\n interactionHandle: meta.interactionHandle!,\n state: meta.state\n };\n}\n\n// Begin or resume a transaction. Returns an interaction handle\nexport async function interact (authClient: OktaAuth, options: InteractOptions = {}): Promise<InteractResponse> {\n options = removeNils(options);\n\n let meta = getSavedTransactionMeta(authClient, options);\n // If meta exists, it has been validated against all options\n\n if (meta?.interactionHandle) {\n return getResponse(meta); // Saved transaction, return meta\n }\n\n // Create new meta, respecting previous meta if it has been set and is not overridden\n meta = await createTransactionMeta(authClient, { ...meta, ...options });\n const baseUrl = getOAuthBaseUrl(authClient);\n let {\n clientId,\n redirectUri,\n state,\n scopes,\n withCredentials,\n codeChallenge,\n codeChallengeMethod,\n activationToken,\n recoveryToken\n } = meta as IdxTransactionMeta;\n\n const interactionHandle = await idx.interact({\n withCredentials,\n\n // OAuth\n clientId, \n baseUrl,\n scopes,\n state,\n redirectUri,\n\n // PKCE\n codeChallenge,\n codeChallengeMethod,\n\n // Activation\n activationToken,\n \n // Recovery\n recoveryToken\n });\n const newMeta = {\n ...meta,\n interactionHandle,\n \n // Options which can be passed into interact() should be saved in the meta\n withCredentials,\n state,\n scopes,\n recoveryToken,\n activationToken\n };\n // Save transaction meta so it can be resumed\n saveTransactionMeta(authClient, newMeta);\n\n return getResponse(newMeta);\n}\n"],"file":"interact.js"}
|
package/cjs/idx/introspect.js
CHANGED
|
@@ -23,26 +23,19 @@ var _constants = require("../constants");
|
|
|
23
23
|
*
|
|
24
24
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
25
25
|
*/
|
|
26
|
-
async function introspect(authClient, options) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
let rawIdxResponse;
|
|
30
|
-
|
|
31
|
-
if (useLastResponse) {
|
|
32
|
-
// try load from storage first
|
|
33
|
-
rawIdxResponse = authClient.transactionManager.loadIdxResponse();
|
|
34
|
-
} // call idx.introspect if no existing idx response available in storage
|
|
35
|
-
|
|
26
|
+
async function introspect(authClient, options = {}) {
|
|
27
|
+
// try load from storage first
|
|
28
|
+
let rawIdxResponse = authClient.transactionManager.loadIdxResponse(); // call idx.introspect if no existing idx response available in storage
|
|
36
29
|
|
|
37
30
|
if (!rawIdxResponse) {
|
|
38
|
-
const version = _constants.IDX_API_VERSION;
|
|
31
|
+
const version = options.version || _constants.IDX_API_VERSION;
|
|
39
32
|
const domain = (0, _oidc.getOAuthDomain)(authClient);
|
|
40
33
|
|
|
41
34
|
try {
|
|
42
35
|
rawIdxResponse = await _oktaIdxJs.default.introspect({
|
|
43
36
|
domain,
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
...options,
|
|
38
|
+
version
|
|
46
39
|
});
|
|
47
40
|
} catch (err) {
|
|
48
41
|
if ((0, _idxJs.isRawIdxResponse)(err)) {
|
|
@@ -53,6 +46,11 @@ async function introspect(authClient, options) {
|
|
|
53
46
|
}
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
const {
|
|
50
|
+
withCredentials
|
|
51
|
+
} = options;
|
|
52
|
+
return _oktaIdxJs.default.makeIdxState(rawIdxResponse, {
|
|
53
|
+
withCredentials
|
|
54
|
+
});
|
|
57
55
|
}
|
|
58
56
|
//# sourceMappingURL=introspect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/introspect.ts"],"names":["introspect","authClient","options","
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/introspect.ts"],"names":["introspect","authClient","options","rawIdxResponse","transactionManager","loadIdxResponse","version","IDX_API_VERSION","domain","idx","err","withCredentials","makeIdxState"],"mappings":";;;;;;AAYA;;AAEA;;AACA;;AACA;;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeO,eAAeA,UAAf,CAA2BC,UAA3B,EAAiDC,OAA0B,GAAG,EAA9E,EAAwG;AAC7G;AACA,MAAIC,cAAc,GAAGF,UAAU,CAACG,kBAAX,CAA8BC,eAA9B,EAArB,CAF6G,CAI7G;;AACA,MAAI,CAACF,cAAL,EAAqB;AACnB,UAAMG,OAAO,GAAGJ,OAAO,CAACI,OAAR,IAAmBC,0BAAnC;AACA,UAAMC,MAAM,GAAG,0BAAeP,UAAf,CAAf;;AACA,QAAI;AACFE,MAAAA,cAAc,GAAG,MAAMM,mBAAIT,UAAJ,CAAe;AAAEQ,QAAAA,MAAF;AAAU,WAAGN,OAAb;AAAsBI,QAAAA;AAAtB,OAAf,CAAvB;AACD,KAFD,CAEE,OAAOI,GAAP,EAAY;AACZ,UAAI,6BAAiBA,GAAjB,CAAJ,EAA2B;AACzBP,QAAAA,cAAc,GAAGO,GAAjB;AACD,OAFD,MAEO;AACL,cAAMA,GAAN;AACD;AACF;AACF;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAAsBT,OAA5B;AACA,SAAOO,mBAAIG,YAAJ,CAAiBT,cAAjB,EAAiC;AAAEQ,IAAAA;AAAF,GAAjC,CAAP;AACD","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 idx from '@okta/okta-idx-js';\nimport { OktaAuth } from '../types';\nimport { IdxResponse, isRawIdxResponse } from './types/idx-js';\nimport { getOAuthDomain } from '../oidc';\nimport { IDX_API_VERSION } from '../constants';\n\nexport interface IntrospectOptions {\n withCredentials?: boolean;\n interactionHandle?: string;\n stateHandle?: string;\n version?: string;\n}\n\nexport async function introspect (authClient: OktaAuth, options: IntrospectOptions = {}): Promise<IdxResponse> {\n // try load from storage first\n let rawIdxResponse = authClient.transactionManager.loadIdxResponse();\n \n // call idx.introspect if no existing idx response available in storage\n if (!rawIdxResponse) {\n const version = options.version || IDX_API_VERSION;\n const domain = getOAuthDomain(authClient);\n try {\n rawIdxResponse = await idx.introspect({ domain, ...options, version });\n } catch (err) {\n if (isRawIdxResponse(err)) {\n rawIdxResponse = err;\n } else {\n throw err;\n }\n }\n }\n\n const { withCredentials } = options;\n return idx.makeIdxState(rawIdxResponse, { withCredentials });\n}\n"],"file":"introspect.js"}
|
package/cjs/idx/proceed.js
CHANGED
|
@@ -7,8 +7,6 @@ var _run = require("./run");
|
|
|
7
7
|
|
|
8
8
|
var _transactionMeta = require("./transactionMeta");
|
|
9
9
|
|
|
10
|
-
var _flow = require("./flow");
|
|
11
|
-
|
|
12
10
|
var _errors = require("../errors");
|
|
13
11
|
|
|
14
12
|
/*!
|
|
@@ -29,21 +27,20 @@ function canProceed(authClient, options) {
|
|
|
29
27
|
|
|
30
28
|
async function proceed(authClient, options = {}) {
|
|
31
29
|
const {
|
|
32
|
-
stateTokenExternalId,
|
|
33
30
|
state
|
|
34
31
|
} = options;
|
|
35
32
|
const meta = (0, _transactionMeta.getSavedTransactionMeta)(authClient, {
|
|
36
33
|
state
|
|
37
|
-
}); // Proceed always needs saved transaction meta
|
|
34
|
+
}); // Proceed always needs saved transaction meta
|
|
38
35
|
|
|
39
|
-
if (!meta
|
|
36
|
+
if (!meta) {
|
|
40
37
|
throw new _errors.AuthSdkError('Unable to proceed: saved transaction could not be loaded');
|
|
41
38
|
} // Determine the flow specification based on the saved flow
|
|
42
39
|
|
|
43
40
|
|
|
44
|
-
const
|
|
41
|
+
const flow = meta === null || meta === void 0 ? void 0 : meta.flow;
|
|
45
42
|
return (0, _run.run)(authClient, { ...options,
|
|
46
|
-
|
|
43
|
+
flow
|
|
47
44
|
});
|
|
48
45
|
}
|
|
49
46
|
//# sourceMappingURL=proceed.js.map
|
package/cjs/idx/proceed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../lib/idx/proceed.ts"],"names":["canProceed","authClient","options","meta","proceed","
|
|
1
|
+
{"version":3,"sources":["../../../lib/idx/proceed.ts"],"names":["canProceed","authClient","options","meta","proceed","state","AuthSdkError","flow"],"mappings":";;;;;AAiBA;;AAQA;;AACA;;AA1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAyBO,SAASA,UAAT,CAAoBC,UAApB,EAA0CC,OAA1C,EAAwE;AAC7E,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoCC,OAApC,CAAb;AACA,SAAO,CAAC,CAACC,IAAT;AACD;;AAEM,eAAeC,OAAf,CACLH,UADK,EAELC,OAAuB,GAAG,EAFrB,EAGoB;AACzB,QAAM;AAAEG,IAAAA;AAAF,MAAYH,OAAlB;AACA,QAAMC,IAAI,GAAG,8CAAwBF,UAAxB,EAAoC;AAAEI,IAAAA;AAAF,GAApC,CAAb,CAFyB,CAIzB;;AACA,MAAI,CAACF,IAAL,EAAW;AACT,UAAM,IAAIG,oBAAJ,CAAiB,0DAAjB,CAAN;AACD,GAPwB,CASzB;;;AACA,QAAMC,IAAI,GAAGJ,IAAH,aAAGA,IAAH,uBAAGA,IAAI,CAAEI,IAAnB;AAEA,SAAO,cAAIN,UAAJ,EAAgB,EACrB,GAAGC,OADkB;AAErBK,IAAAA;AAFqB,GAAhB,CAAP;AAID","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 OktaAuth,\n IdxTransaction,\n} from '../types';\nimport { run } from './run';\nimport { AuthenticationOptions } from './authenticate';\nimport {\n EnrollPollValues as EnrollPollOptions,\n SelectEnrollmentChannelValues as SelectEnrollmentChannelOptions\n} from './remediators';\nimport { RegistrationOptions } from './register';\nimport { PasswordRecoveryOptions } from './recoverPassword';\nimport { getSavedTransactionMeta } from './transactionMeta';\nimport { AuthSdkError } from '../errors';\n\nexport type ProceedOptions = AuthenticationOptions\n & RegistrationOptions\n & PasswordRecoveryOptions\n & EnrollPollOptions\n & SelectEnrollmentChannelOptions\n & { step?: string };\n\nexport function canProceed(authClient: OktaAuth, options?: { state?: string }) {\n const meta = getSavedTransactionMeta(authClient, options);\n return !!meta;\n}\n\nexport async function proceed(\n authClient: OktaAuth,\n options: ProceedOptions = {}\n): Promise<IdxTransaction> {\n const { state } = options;\n const meta = getSavedTransactionMeta(authClient, { state });\n\n // Proceed always needs saved transaction meta\n if (!meta) {\n throw new AuthSdkError('Unable to proceed: saved transaction could not be loaded');\n }\n\n // Determine the flow specification based on the saved flow\n const flow = meta?.flow;\n\n return run(authClient, { \n ...options, \n flow\n });\n}\n"],"file":"proceed.js"}
|