Two-factor authentication in Scala with Http4s

Click for: original source

This article is a continuation of the authentication methods t- here we will cover two more advanced authentication methods which include One Time Password (OTP) and Two Factor Authentication (2FA). By Daniel Ciocîrlan.

The One Time Password authentication method is defined in the RFC 2289 internet standard which provides a detailed explanation of how OTP is implemented. OTP tokens can either be generated by a software application running on a computer or phone, or they can also be generated using hardware and there is a wide array of devices on the market providing this functionality.

The main sections in the article:

  • Introduction
  • Requirements
  • One Time Password (OTP)
    • HMAC-based One Time Password (HOTP)
    • Time-based One Time Password (TOTP)
  • Two Factor Authentication (2FA)
    • Two Factor Authentication (2FA) Implementation in Scala

In this tutorial we learned about One Time Password Authentication, we explored HMAC-based One Time Password (HOTP) and Time-based One Time Password (TOTP) and created a small application where we implemented Two Factor Authentication using the knowledge we learned. 2FA has gained traction in recent years and as displayed, adds another layer of security to your application. Full code is also provided. Good read!

[Read More]

Tags java app-development how-to infosec jvm