Class: DuoApi::Auth
- Inherits:
-
DuoApi
- Object
- DuoApi
- DuoApi::Auth
- Defined in:
- lib/duo_api/auth.rb
Overview
Duo Auth API (https://duo.com/docs/authapi)
Instance Method Summary collapse
- #auth(factor:, **optional_params) ⇒ Object
- #auth_status(txid:) ⇒ Object
- #check ⇒ Object
- #enroll(**optional_params) ⇒ Object
- #enroll_status(user_id:, activation_code:) ⇒ Object
- #logo ⇒ Object
- #ping ⇒ Object
- #preauth(**optional_params) ⇒ Object
Instance Method Details
#auth(factor:, **optional_params) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/duo_api/auth.rb', line 47 def auth(factor:, **optional_params) # optional_params: user_id, username, ipaddr, hostname, async # # Note: user_id or username must be provided optional_params.tap do |p| p[:async] = stringified_binary_boolean(p[:async]) if p[:async] end params = optional_params.merge({ factor: factor }) post('/auth/v2/auth', params)[:response] end |
#auth_status(txid:) ⇒ Object
58 59 60 61 |
# File 'lib/duo_api/auth.rb', line 58 def auth_status(txid:) params = { txid: txid } get('/auth/v2/auth_status', params)[:response] end |
#check ⇒ Object
15 16 17 |
# File 'lib/duo_api/auth.rb', line 15 def check get('/auth/v2/check')[:response] end |
#enroll(**optional_params) ⇒ Object
23 24 25 26 |
# File 'lib/duo_api/auth.rb', line 23 def enroll(**optional_params) # optional_params: username, valid_secs post('/auth/v2/enroll', optional_params)[:response] end |
#enroll_status(user_id:, activation_code:) ⇒ Object
28 29 30 31 |
# File 'lib/duo_api/auth.rb', line 28 def enroll_status(user_id:, activation_code:) params = { user_id: user_id, activation_code: activation_code } post('/auth/v2/enroll_status', params)[:response] end |
#logo ⇒ Object
19 20 21 |
# File 'lib/duo_api/auth.rb', line 19 def logo get_image('/auth/v2/logo') end |
#ping ⇒ Object
11 12 13 |
# File 'lib/duo_api/auth.rb', line 11 def ping get('/auth/v2/ping')[:response] end |
#preauth(**optional_params) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/duo_api/auth.rb', line 33 def preauth(**optional_params) # optional_params: user_id, username, client_supports_verified_push, ipaddr, hostname, # trusted_device_token # # Note: user_id or username must be provided optional_params.tap do |p| if p[:client_supports_verified_push] p[:client_supports_verified_push] = stringified_binary_boolean(p[:client_supports_verified_push]) end end post('/auth/v2/preauth', optional_params)[:response] end |