SlideShare a Scribd company logo
COST-EFFECTIVE
TWO-FACTOR
AUTHENTICATION
ABOUT ME
● Waihon Yew
● Rapid River Software
● Connect with me:
○ GitHub: waihon
○ Twitter: waihon
○ LinkedIn: waihonyew
WHAT IS TWO-FACTOR AUTHENTICATION?
● Two-factor authentication (2FA) is a way to add additional
security to your account.
● The first "factor" is your usual password that is standard for
any account.
● A common second "factor" is a verification code retrieved
from an app on a mobile device or computer.
● 2FA is conceptually similar to a security token device that
certain banks in some countries require for online banking.
● Other names for 2FA systems include OTP (one-time
password) and TOTP (Time-based One-time Password
algorithm).
● Business
○ Compatible with Google Authenticator which is
available for free on both Google Play and App Store
● Technical
○ A gem/library that:
■ Makes adding 2FA to a user model simple
■ Is not tightly coupled with any authentication gems
such as Devise
REQUIREMENTS/CONSTRAINTS
2FA GEM: ACTIVEMODEL::OTP
● GitHub
○ https://github.com/heapsource/active_model_otp
● Key dependency
○ ROTP 4.0 or higher
■ A Ruby library for generating and validating one
time passwords according to RFC 4226 (HOTP) and
RFC 6238 (TOTP).
● Installation
○ gem 'active_model_otp'
● Add otp_secret_key to your user model
○ rails g migration AddOtpSecretKeyToUsers
otp_secret_key:string
○ rails db:migrate
● Add has_one_time_password directive to your user model.
○ It provides a few useful methods in order to implement
your 2FA
SETTING UP YOUR MODEL
● The otp_secret_key is saved automatically when an object
is created.
● If you're adding this to an existing user model, you could:
○ Generate otp_secret_key with a migration like:
■ User.find_each { |user|
user.update_attribute(:otp_secret_key,
ROTP::Base32.random_base32) }
○ Generate otp_secret_key when users enable 2FA
OTP SECRET KEY
● user.otp_code #=> 225681
● sleep 30 # let's wait 30 secs
● user.otp_code #=> 837058
GETTING CURRENT CODE
● user.otp_code(time: Time.now) #=> 417714
● user.otp_code(time: Time.now + 3600) #=> 766675
OVERRIDE CURRENT TIME
● user.authenticate_otp('186522') # => truthy
● sleep 30 # let's wait 30 secs
● user.authenticate_otp('186522') # => falsey
AUTHENTICATING USING A CODE
● user.authenticate_otp('186522') # => truthy
● sleep 30 # let’s wait again
● user.authenticate_otp('186522', drift: 60) # =>
truthy
AUTHENTICATING USING A SLIGHTLY OLD CODE
● Recovery codes
○ Used to access your account in the event you cannot
receive two-factor authentication codes.
ADDITIONAL 2FA OPTIONS
● Live
○ https://tfademo.herokuapp.com
● Source code
○ https://github.com/waihon/tfa-demo
2FA DEMO
● Aaron Lim
● Adeline Lim
● Hakim Ahmad
● Tamer Shlash
ACKNOWLEDGEMENTS
QUESTIONS & ANSWERS
THANK YOU!

More Related Content

Similar to Cost-Effective Two-Factor Authentication

Data Engineer's Lunch #37: Pipedream: Serverless Integration and Compute Plat...
Data Engineer's Lunch #37: Pipedream: Serverless Integration and Compute Plat...Data Engineer's Lunch #37: Pipedream: Serverless Integration and Compute Plat...
Data Engineer's Lunch #37: Pipedream: Serverless Integration and Compute Plat...
Anant Corporation
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
Julien Dubois
 
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
Tanya Denisyuk
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneursRodrigo Gil
 
XP Days 2019: First secret delivery for modern cloud-native applications
XP Days 2019: First secret delivery for modern cloud-native applicationsXP Days 2019: First secret delivery for modern cloud-native applications
XP Days 2019: First secret delivery for modern cloud-native applications
Vlad Fedosov
 
Rapid app building with loopback framework
Rapid app building with loopback frameworkRapid app building with loopback framework
Rapid app building with loopback framework
Thomas Papaspiros
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears Training
Alessandro Molina
 
Post-Mortem Debugging and Web Development
Post-Mortem Debugging and Web DevelopmentPost-Mortem Debugging and Web Development
Post-Mortem Debugging and Web Development
Alessandro Molina
 
Bypassing Windows Security Functions(en)
Bypassing Windows Security Functions(en)Bypassing Windows Security Functions(en)
Bypassing Windows Security Functions(en)
abend_cve_9999_0001
 
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire - RAGE:...
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire -  RAGE:...Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire -  RAGE:...
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire - RAGE:...
eMadrid network
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
shyamraj55
 
Integrating Okta with Anypoint Platform for a mobile security use case
Integrating Okta with Anypoint Platform for a mobile security use caseIntegrating Okta with Anypoint Platform for a mobile security use case
Integrating Okta with Anypoint Platform for a mobile security use case
Bahman Kalali
 
2013.devcon3 liferay and google authenticator integration rafik_harabi
2013.devcon3 liferay and google authenticator integration rafik_harabi2013.devcon3 liferay and google authenticator integration rafik_harabi
2013.devcon3 liferay and google authenticator integration rafik_harabi
Rafik HARABI
 
Google authentication
Google authenticationGoogle authentication
Google authentication
NexThoughts Technologies
 
Security .NET.pdf
Security .NET.pdfSecurity .NET.pdf
Security .NET.pdf
Abhi Jain
 
Building Open Source Identity Infrastructures
Building Open Source Identity InfrastructuresBuilding Open Source Identity Infrastructures
Building Open Source Identity Infrastructures
Misagh Moayyed
 
Safe Community Call #13.pdf
Safe Community Call #13.pdfSafe Community Call #13.pdf
Safe Community Call #13.pdf
LornyPfeifer
 
The New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by PythonThe New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by Python
All Things Open
 
MuleSoft Manchester Meetup #2 slides 29th October 2019
MuleSoft Manchester Meetup #2 slides 29th October 2019MuleSoft Manchester Meetup #2 slides 29th October 2019
MuleSoft Manchester Meetup #2 slides 29th October 2019
Ieva Navickaite
 
Shift Left Security
Shift Left SecurityShift Left Security
Shift Left Security
gjdevos
 

Similar to Cost-Effective Two-Factor Authentication (20)

Data Engineer's Lunch #37: Pipedream: Serverless Integration and Compute Plat...
Data Engineer's Lunch #37: Pipedream: Serverless Integration and Compute Plat...Data Engineer's Lunch #37: Pipedream: Serverless Integration and Compute Plat...
Data Engineer's Lunch #37: Pipedream: Serverless Integration and Compute Plat...
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
 
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
Дмитрий Хоревич "Cloud native security with UAA \ Как защитить микросервисы с...
 
Programming for non tech entrepreneurs
Programming for non tech entrepreneursProgramming for non tech entrepreneurs
Programming for non tech entrepreneurs
 
XP Days 2019: First secret delivery for modern cloud-native applications
XP Days 2019: First secret delivery for modern cloud-native applicationsXP Days 2019: First secret delivery for modern cloud-native applications
XP Days 2019: First secret delivery for modern cloud-native applications
 
Rapid app building with loopback framework
Rapid app building with loopback frameworkRapid app building with loopback framework
Rapid app building with loopback framework
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears Training
 
Post-Mortem Debugging and Web Development
Post-Mortem Debugging and Web DevelopmentPost-Mortem Debugging and Web Development
Post-Mortem Debugging and Web Development
 
Bypassing Windows Security Functions(en)
Bypassing Windows Security Functions(en)Bypassing Windows Security Functions(en)
Bypassing Windows Security Functions(en)
 
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire - RAGE:...
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire -  RAGE:...Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire -  RAGE:...
Seminario eMadrid 2015 09 10 sobre Serious Games (UCM) Manuel Freire - RAGE:...
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Integrating Okta with Anypoint Platform for a mobile security use case
Integrating Okta with Anypoint Platform for a mobile security use caseIntegrating Okta with Anypoint Platform for a mobile security use case
Integrating Okta with Anypoint Platform for a mobile security use case
 
2013.devcon3 liferay and google authenticator integration rafik_harabi
2013.devcon3 liferay and google authenticator integration rafik_harabi2013.devcon3 liferay and google authenticator integration rafik_harabi
2013.devcon3 liferay and google authenticator integration rafik_harabi
 
Google authentication
Google authenticationGoogle authentication
Google authentication
 
Security .NET.pdf
Security .NET.pdfSecurity .NET.pdf
Security .NET.pdf
 
Building Open Source Identity Infrastructures
Building Open Source Identity InfrastructuresBuilding Open Source Identity Infrastructures
Building Open Source Identity Infrastructures
 
Safe Community Call #13.pdf
Safe Community Call #13.pdfSafe Community Call #13.pdf
Safe Community Call #13.pdf
 
The New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by PythonThe New York Times: Sustainable Systems, Powered by Python
The New York Times: Sustainable Systems, Powered by Python
 
MuleSoft Manchester Meetup #2 slides 29th October 2019
MuleSoft Manchester Meetup #2 slides 29th October 2019MuleSoft Manchester Meetup #2 slides 29th October 2019
MuleSoft Manchester Meetup #2 slides 29th October 2019
 
Shift Left Security
Shift Left SecurityShift Left Security
Shift Left Security
 

Recently uploaded

Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 

Recently uploaded (20)

Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 

Cost-Effective Two-Factor Authentication

  • 2. ABOUT ME ● Waihon Yew ● Rapid River Software ● Connect with me: ○ GitHub: waihon ○ Twitter: waihon ○ LinkedIn: waihonyew
  • 3. WHAT IS TWO-FACTOR AUTHENTICATION? ● Two-factor authentication (2FA) is a way to add additional security to your account. ● The first "factor" is your usual password that is standard for any account. ● A common second "factor" is a verification code retrieved from an app on a mobile device or computer. ● 2FA is conceptually similar to a security token device that certain banks in some countries require for online banking. ● Other names for 2FA systems include OTP (one-time password) and TOTP (Time-based One-time Password algorithm).
  • 4. ● Business ○ Compatible with Google Authenticator which is available for free on both Google Play and App Store ● Technical ○ A gem/library that: ■ Makes adding 2FA to a user model simple ■ Is not tightly coupled with any authentication gems such as Devise REQUIREMENTS/CONSTRAINTS
  • 5. 2FA GEM: ACTIVEMODEL::OTP ● GitHub ○ https://github.com/heapsource/active_model_otp ● Key dependency ○ ROTP 4.0 or higher ■ A Ruby library for generating and validating one time passwords according to RFC 4226 (HOTP) and RFC 6238 (TOTP). ● Installation ○ gem 'active_model_otp'
  • 6. ● Add otp_secret_key to your user model ○ rails g migration AddOtpSecretKeyToUsers otp_secret_key:string ○ rails db:migrate ● Add has_one_time_password directive to your user model. ○ It provides a few useful methods in order to implement your 2FA SETTING UP YOUR MODEL
  • 7. ● The otp_secret_key is saved automatically when an object is created. ● If you're adding this to an existing user model, you could: ○ Generate otp_secret_key with a migration like: ■ User.find_each { |user| user.update_attribute(:otp_secret_key, ROTP::Base32.random_base32) } ○ Generate otp_secret_key when users enable 2FA OTP SECRET KEY
  • 8. ● user.otp_code #=> 225681 ● sleep 30 # let's wait 30 secs ● user.otp_code #=> 837058 GETTING CURRENT CODE
  • 9. ● user.otp_code(time: Time.now) #=> 417714 ● user.otp_code(time: Time.now + 3600) #=> 766675 OVERRIDE CURRENT TIME
  • 10. ● user.authenticate_otp('186522') # => truthy ● sleep 30 # let's wait 30 secs ● user.authenticate_otp('186522') # => falsey AUTHENTICATING USING A CODE
  • 11. ● user.authenticate_otp('186522') # => truthy ● sleep 30 # let’s wait again ● user.authenticate_otp('186522', drift: 60) # => truthy AUTHENTICATING USING A SLIGHTLY OLD CODE
  • 12. ● Recovery codes ○ Used to access your account in the event you cannot receive two-factor authentication codes. ADDITIONAL 2FA OPTIONS
  • 13. ● Live ○ https://tfademo.herokuapp.com ● Source code ○ https://github.com/waihon/tfa-demo 2FA DEMO
  • 14. ● Aaron Lim ● Adeline Lim ● Hakim Ahmad ● Tamer Shlash ACKNOWLEDGEMENTS