Class: OmniAuth::Yubikey::Verifier
- Inherits:
-
Object
- Object
- OmniAuth::Yubikey::Verifier
- Defined in:
- lib/omniauth-yubikey/verifier.rb
Instance Attribute Summary collapse
-
#api_id ⇒ Object
readonly
Returns the value of attribute api_id.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
Instance Method Summary collapse
-
#initialize(api_id, api_key, api_url) ⇒ Verifier
constructor
A new instance of Verifier.
- #verify(otp) ⇒ Object
- #verify!(otp) ⇒ Object
Constructor Details
#initialize(api_id, api_key, api_url) ⇒ Verifier
Returns a new instance of Verifier.
10 11 12 |
# File 'lib/omniauth-yubikey/verifier.rb', line 10 def initialize(api_id, api_key, api_url) @api_id, @api_key, @api_url = api_id, api_key, api_url end |
Instance Attribute Details
#api_id ⇒ Object (readonly)
Returns the value of attribute api_id.
8 9 10 |
# File 'lib/omniauth-yubikey/verifier.rb', line 8 def api_id @api_id end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/omniauth-yubikey/verifier.rb', line 8 def api_key @api_key end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
8 9 10 |
# File 'lib/omniauth-yubikey/verifier.rb', line 8 def api_url @api_url end |
Instance Method Details
#verify(otp) ⇒ Object
14 15 16 17 |
# File 'lib/omniauth-yubikey/verifier.rb', line 14 def verify(otp) response = get_response(otp) Result.new(otp, response) end |
#verify!(otp) ⇒ Object
19 20 21 22 23 |
# File 'lib/omniauth-yubikey/verifier.rb', line 19 def verify!(otp) result = verify(otp) raise OtpError, "Received error: #{result.status}" unless result.valid? result end |