duo_api 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/duo_api.rb +6 -5
  3. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f2b8f7a8d60157304a3a8e84c3fece39dcd84cf42395cf6e4e960f95c948a2b
4
- data.tar.gz: a8dff536f99c10f9af74e9c105ae6df3c703c05d977ab1036e3e3f3a9cbcbe1d
3
+ metadata.gz: b5cd10981ae6386d4aaaa0784cf89af0bb5bdd108f3c56a23c2360fd061c4e51
4
+ data.tar.gz: 7afea77b115e547d19bdc57ccafc71041dfcdf0aa20248692574fb9180833797
5
5
  SHA512:
6
- metadata.gz: 7218998f5487aeac26d0dae382309e7ae2b671ff74516c2e34fe68198b3a96be04db976a796a2f145721b6a42873e338626cfae815912e5f7c5339291825a701
7
- data.tar.gz: ac33087ef7e635650708f73a52996f0a934fb42729a7455045336d5bccf5393690c93192d48df823b97139601d90ee39aae0837e36428cd07ea6621a693c5662
6
+ metadata.gz: faa3962d46a4c1644793f594b851e4dfd621221cee3ef60b23b48b9c28cbb0f591597b0b6e3625db20a194cb699b60211b3f691abe71bd483b8bc84e256b3869
7
+ data.tar.gz: 2b062c1ea82883dd8bfd75c1deeda2723d88ebd1a8d3349703c8af68ee8b6e55e2f0597fdd41ad681b73f98724b98be9835a106aeed7b2237df75a98a16b37c2
data/lib/duo_api.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'erb'
1
2
  require 'openssl'
2
3
  require 'net/https'
3
4
  require 'time'
@@ -7,7 +8,6 @@ require 'uri'
7
8
  # A Ruby implementation of the Duo API
8
9
  #
9
10
  class DuoApi
10
- @@encode_regex = Regexp.new('[^-_.~a-zA-Z\\d]')
11
11
  attr_accessor :ca_file
12
12
 
13
13
  # Constants for handling rate limit backoff
@@ -42,10 +42,11 @@ class DuoApi
42
42
  request = Net::HTTP.const_get(method.capitalize).new uri.to_s
43
43
  request.basic_auth(@ikey, signed)
44
44
  request['Date'] = current_date
45
+ request['User-Agent'] = 'duo_api_ruby/1.3.0'
45
46
 
46
47
  Net::HTTP.start(uri.host, uri.port, *@proxy,
47
48
  use_ssl: true, ca_file: @ca_file,
48
- verify_mode: OpenSSL::SSL::VERIFY_NONE) do |http|
49
+ verify_mode: OpenSSL::SSL::VERIFY_PEER) do |http|
49
50
  wait_secs = INITIAL_BACKOFF_WAIT_SECS
50
51
  while true do
51
52
  resp = http.request(request)
@@ -63,8 +64,8 @@ class DuoApi
63
64
 
64
65
  def encode_key_val(k, v)
65
66
  # encode the key and the value for a url
66
- key = URI.encode(k.to_s, @@encode_regex)
67
- value = URI.encode(v.to_s, @@encode_regex)
67
+ key = ERB::Util.url_encode(k.to_s)
68
+ value = ERB::Util.url_encode(v.to_s)
68
69
  key + '=' + value
69
70
  end
70
71
 
@@ -105,6 +106,6 @@ class DuoApi
105
106
 
106
107
  def sign(method, host, path, params, options = {})
107
108
  date, canon = canonicalize(method, host, path, params, date: options[:date])
108
- [date, OpenSSL::HMAC.hexdigest('sha1', @skey, canon)]
109
+ [date, OpenSSL::HMAC.hexdigest('sha512', @skey, canon)]
109
110
  end
110
111
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duo_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duo Security
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-06 00:00:00.000000000 Z
11
+ date: 2022-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -93,8 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.7.6
96
+ rubygems_version: 3.0.3.1
98
97
  signing_key:
99
98
  specification_version: 4
100
99
  summary: Duo API Ruby