Sha256: 1855880d77afc485edd89af426a106f0c29ac8db2a3582bfd908b80073a1961e
Contents?: true
Size: 740 Bytes
Versions: 4
Compression:
Stored size: 740 Bytes
Contents
require 'addressable/uri' require 'rotp' module CASino module ProcessorConcern module TwoFactorAuthenticators class ValidationResult < CASino::ValidationResult; end def validate_one_time_password(otp, authenticator) if authenticator.nil? || authenticator.expired? 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]) ValidationResult.new else ValidationResult.new 'INVALID_OTP', 'One-time password not valid', :warn end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems