diff --git a/lib/idx/remediators/AuthenticatorVerificationData.ts b/lib/idx/remediators/AuthenticatorVerificationData.ts index 72d9631f95..4899040bad 100644 --- a/lib/idx/remediators/AuthenticatorVerificationData.ts +++ b/lib/idx/remediators/AuthenticatorVerificationData.ts @@ -11,55 +11,14 @@ * See the License for the specific language governing permissions and limitations under the License. */ - -import { AuthSdkError } from '../../errors'; import { AuthenticatorData, AuthenticatorDataValues } from './Base/AuthenticatorData'; -import { IdxRemediation, RemediateOptions } from '../types'; export type AuthenticatorVerificationDataValues = AuthenticatorDataValues; export class AuthenticatorVerificationData extends AuthenticatorData { static remediationName = 'authenticator-verification-data'; - shouldProceedWithEmailAuthenticator: boolean; // will be removed in next major version - - constructor( - remediation: IdxRemediation, - values: AuthenticatorDataValues = {}, - options: RemediateOptions = {} - ) { - super(remediation, values); - - // will be removed in next major version - this.shouldProceedWithEmailAuthenticator = options.shouldProceedWithEmailAuthenticator !== false - && this.authenticator.methods.length === 1 - && this.authenticator.methods[0].type === 'email'; - } - - canRemediate() { - // auto proceed if there is only one method (will be removed in next major version) - if (this.shouldProceedWithEmailAuthenticator !== false) { - return true; - } - return super.canRemediate(); - } - mapAuthenticator() { - // auto proceed with the only methodType option - if (this.shouldProceedWithEmailAuthenticator !== false) { - const authenticatorFromRemediation = this.getAuthenticatorFromRemediation(); - return authenticatorFromRemediation.form?.value.reduce((acc, curr) => { - if (curr.value) { - acc[curr.name] = curr.value; - } else if (curr.options) { - acc[curr.name] = curr.options![0].value; - } else { - throw new AuthSdkError(`Unsupported authenticator data type: ${curr}`); - } - return acc; - }, {}); - } - return this.getAuthenticatorData(); } diff --git a/lib/idx/run.ts b/lib/idx/run.ts index 40ae6cb3b0..263ac724b2 100644 --- a/lib/idx/run.ts +++ b/lib/idx/run.ts @@ -62,7 +62,6 @@ function initializeValues(options: RunOptions) { 'step', 'useGenericRemediator', 'exchangeCodeForTokens', - 'shouldProceedWithEmailAuthenticator' ]; const values = { ...options }; knownOptions.forEach(option => { @@ -164,7 +163,6 @@ async function getDataFromRemediate(authClient, data: RunData): Promise actions, flow, step, - shouldProceedWithEmailAuthenticator, // will be removed in next major version useGenericRemediator, } = options; @@ -192,7 +190,6 @@ async function getDataFromRemediate(authClient, data: RunData): Promise actions, flow, step, - shouldProceedWithEmailAuthenticator, // will be removed in next major version useGenericRemediator, } ); diff --git a/lib/idx/types/options.ts b/lib/idx/types/options.ts index b8ef74b8ca..eee2dcf013 100644 --- a/lib/idx/types/options.ts +++ b/lib/idx/types/options.ts @@ -46,7 +46,6 @@ export interface IntrospectOptions extends IdxOptions { export interface RemediateOptions extends IdxOptions { remediators?: RemediationFlow; actions?: RemediateAction[]; - shouldProceedWithEmailAuthenticator?: boolean; // will be removed in next major version useGenericRemediator?: boolean; // beta } diff --git a/test/spec/idx/authenticate.ts b/test/spec/idx/authenticate.ts index 588e2bd2c2..55de7a9eed 100644 --- a/test/spec/idx/authenticate.ts +++ b/test/spec/idx/authenticate.ts @@ -1219,29 +1219,6 @@ describe('idx/authenticate', () => { }); }); - it('can auto select email methodType as authenticator verification data', async () => { - const { - authClient, - verificationDataResponse, - verifyEmailResponse - } = testContext; - - jest.spyOn(verificationDataResponse, 'proceed').mockResolvedValue(verifyEmailResponse); - jest.spyOn(mocked.introspect, 'introspect').mockResolvedValue(verificationDataResponse); - const res = await authenticate(authClient); - expect(verificationDataResponse.proceed).toHaveBeenCalledWith('authenticator-verification-data', { - authenticator: { - id: 'id-email' - } - }); - expect(res).toMatchObject({ - status: IdxStatus.PENDING, - nextStep: { - name: 'challenge-authenticator' - } - }); - }); - it('returns a PENDING error if an invalid code is provided', async () => { const { authClient, diff --git a/test/spec/idx/run.ts b/test/spec/idx/run.ts index d1ce721090..c506827087 100644 --- a/test/spec/idx/run.ts +++ b/test/spec/idx/run.ts @@ -221,13 +221,11 @@ describe('idx/run', () => { const flow = 'register'; const username = 'x'; const password = 'y'; - const shouldProceedWithEmailAuthenticator = false; const options: AuthenticationOptions = { username, password, flow, useGenericRemediator: true, - shouldProceedWithEmailAuthenticator // will be removed in next major version }; const values = { username, @@ -243,7 +241,6 @@ describe('idx/run', () => { flow, flowMonitor, useGenericRemediator: true, - shouldProceedWithEmailAuthenticator, // will be removed in next major version }); }); @@ -260,12 +257,10 @@ describe('idx/run', () => { const flow = 'register'; const username = 'x'; const password = 'y'; - const shouldProceedWithEmailAuthenticator = false; const options: AuthenticationOptions = { username, password, flow, - shouldProceedWithEmailAuthenticator // will be removed in next major version }; const values = { username, @@ -280,7 +275,6 @@ describe('idx/run', () => { actions, flow, flowMonitor, - shouldProceedWithEmailAuthenticator, // will be removed in next major version useGenericRemediator: true, }); });