Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Time based OTP #957

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Sep 13, 2024

  • Part of https://github.com/elastic/synthetics-dev/issues/367
  • Add first class MFA support with a prebundled TOTP library otpauth. Its actively maintained and works on all runtimes.
  • Synthetics library exposes a mfa.totp function that can be used to generate a One time token during the journey run.
import { journey, step, mfa} from '@elastic/synthetics';

journey('2FA', ({ page }) => {
  step('Login using 2FA', async () => {
    // login using username and pass and go to 2FA in next page
    const token = mfa.token("NB2W45DFOIZA");
    await page.getByPlaceholder("token-input").fill(token)
  });
});
  • Users can also configure it for Inline and other Project based journeys by specifying these MFA secrets from params which would allow for generating the token at runtime instead of generating from the UI which would cause authentication issues as journeys would run past the period the token is valid for.
    const token = mfa.token(params.MFA_GH_SECRET);

@vigneshshanmugam vigneshshanmugam marked this pull request as ready for review September 13, 2024 21:55
shahzad31
shahzad31 previously approved these changes Sep 16, 2024
Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!

Tested with https://otplib.yeojz.dev/

and it seems to work as expected !!

shahzad31
shahzad31 previously approved these changes Sep 17, 2024
Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!

Copy link
Contributor

@emilioalvap emilioalvap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vigneshshanmugam vigneshshanmugam merged commit 8c13a27 into elastic:main Sep 18, 2024
9 checks passed
@vigneshshanmugam vigneshshanmugam deleted the totp-support branch September 18, 2024 16:37
@obltmachine
Copy link

🎉 This PR is included in version 1.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants