Sha256: 1084abbbb6d33e2c6a54f6e596e7ea44d1806190efb9e0dc9006fe85813abea6
Contents?: true
Size: 619 Bytes
Versions: 9
Compression:
Stored size: 619 Bytes
Contents
require 'rotp' module CASino::TwoFactorAuthenticatorProcessor extend ActiveSupport::Concern def validate_one_time_password(otp, authenticator) if authenticator.nil? || authenticator.expired? CASino::ValidationResult.new 'INVALID_AUTHENTICATOR', 'Authenticator does not exist or expired', :warn else totp = ROTP::TOTP.new(authenticator.secret) if totp.verify_with_drift(otp, CASino.config.two_factor_authenticator[:drift]) CASino::ValidationResult.new else CASino::ValidationResult.new 'INVALID_OTP', 'One-time password not valid', :warn end end end end
Version data entries
9 entries across 9 versions & 1 rubygems