duo_api 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/duo_api.rb +5 -5
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c95a7be063c9af48ae2b7b67220b8072f131969762de7ad4196ad4de454c3bc9
4
- data.tar.gz: e12604cba304de2809af5de389816c1f941c922de82101ac06b3fd2b41c0c439
3
+ metadata.gz: b5cd10981ae6386d4aaaa0784cf89af0bb5bdd108f3c56a23c2360fd061c4e51
4
+ data.tar.gz: 7afea77b115e547d19bdc57ccafc71041dfcdf0aa20248692574fb9180833797
5
5
  SHA512:
6
- metadata.gz: d273082c4c2de87d7cbcc986602f6d2a6f8dd407de08c3f5116e355a44cf83a035dca4492b5acb2ca39a98687b30aea68ec625420366d18f722713e441631c55
7
- data.tar.gz: cd854506a52d924e86846c116193504ef0be411144d9a60cbdd5466ab758d4b64149688edb529c79c7ceef80954c50895bb3d9baa7c8afa06292518d780fc01e
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,7 +42,7 @@ 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.2.0'
45
+ request['User-Agent'] = 'duo_api_ruby/1.3.0'
46
46
 
47
47
  Net::HTTP.start(uri.host, uri.port, *@proxy,
48
48
  use_ssl: true, ca_file: @ca_file,
@@ -64,8 +64,8 @@ class DuoApi
64
64
 
65
65
  def encode_key_val(k, v)
66
66
  # encode the key and the value for a url
67
- key = URI.encode(k.to_s, @@encode_regex)
68
- 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)
69
69
  key + '=' + value
70
70
  end
71
71
 
@@ -106,6 +106,6 @@ class DuoApi
106
106
 
107
107
  def sign(method, host, path, params, options = {})
108
108
  date, canon = canonicalize(method, host, path, params, date: options[:date])
109
- [date, OpenSSL::HMAC.hexdigest('sha1', @skey, canon)]
109
+ [date, OpenSSL::HMAC.hexdigest('sha512', @skey, canon)]
110
110
  end
111
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.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duo Security
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-22 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
@@ -78,7 +78,7 @@ homepage: https://github.com/duosecurity/duo_api_ruby
78
78
  licenses:
79
79
  - BSD-3-Clause
80
80
  metadata: {}
81
- post_install_message:
81
+ post_install_message:
82
82
  rdoc_options: []
83
83
  require_paths:
84
84
  - lib
@@ -93,8 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.0.6
97
- signing_key:
96
+ rubygems_version: 3.0.3.1
97
+ signing_key:
98
98
  specification_version: 4
99
99
  summary: Duo API Ruby
100
100
  test_files: []