Module: Masks::Credentials::Factor2
- Extended by:
- ActiveSupport::Concern
- Included in:
- BackupCode, OneTimeCode
- Defined in:
- app/models/masks/credentials/factor2.rb
Overview
Base class for factor2 credentials.
Instance Method Summary collapse
- #enable(code, secret:) ⇒ Object
- #enabled? ⇒ Boolean
- #generate_secret ⇒ Object
- #lookup ⇒ Object
- #maskup ⇒ Object
- #param ⇒ Object
- #secret ⇒ Object
- #verified? ⇒ Boolean
- #verify(code) ⇒ Object
- #verify_on_enable? ⇒ Boolean
Instance Method Details
#enable(code, secret:) ⇒ Object
54 55 56 |
# File 'app/models/masks/credentials/factor2.rb', line 54 def enable(code, secret:) raise NotImplementedError end |
#enabled? ⇒ Boolean
42 43 44 |
# File 'app/models/masks/credentials/factor2.rb', line 42 def enabled? secret.present? end |
#generate_secret ⇒ Object
66 67 68 |
# File 'app/models/masks/credentials/factor2.rb', line 66 def generate_secret nil end |
#lookup ⇒ Object
18 19 20 |
# File 'app/models/masks/credentials/factor2.rb', line 18 def lookup # nothing to do here end |
#maskup ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/masks/credentials/factor2.rb', line 22 def maskup check.optional = false if actor&.factor2? return unless enabled? code_param = session_params&.fetch(param, nil)&.presence self.code = verify(code_param) if code_param if code approve! elsif code_param deny! end end |
#param ⇒ Object
46 47 48 |
# File 'app/models/masks/credentials/factor2.rb', line 46 def param raise NotImplementedError end |
#secret ⇒ Object
50 51 52 |
# File 'app/models/masks/credentials/factor2.rb', line 50 def secret raise NotImplementedError end |
#verified? ⇒ Boolean
38 39 40 |
# File 'app/models/masks/credentials/factor2.rb', line 38 def verified? code end |
#verify(code) ⇒ Object
58 59 60 |
# File 'app/models/masks/credentials/factor2.rb', line 58 def verify(code) raise NotImplementedError end |
#verify_on_enable? ⇒ Boolean
62 63 64 |
# File 'app/models/masks/credentials/factor2.rb', line 62 def verify_on_enable? false end |