api-auth 2.2.0 → 2.2.1
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -52
- data/.rubocop_todo.yml +60 -0
- data/.travis.yml +17 -7
- data/README.md +3 -3
- data/VERSION +1 -1
- data/api_auth.gemspec +12 -9
- data/gemfiles/http2.gemfile +7 -0
- data/gemfiles/http3.gemfile +7 -0
- data/gemfiles/http4.gemfile +7 -0
- data/lib/api_auth.rb +2 -0
- data/lib/api_auth/headers.rb +3 -3
- data/lib/api_auth/railtie.rb +1 -3
- data/lib/api_auth/request_drivers/http.rb +91 -0
- data/lib/api_auth/request_drivers/net_http.rb +0 -1
- data/lib/api_auth/request_drivers/rest_client.rb +2 -2
- data/spec/headers_spec.rb +0 -8
- data/spec/request_drivers/http_spec.rb +184 -0
- data/spec/request_drivers/rest_client_spec.rb +87 -15
- data/spec/spec_helper.rb +1 -3
- metadata +79 -58
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74847c2470f870ce0206badfda86189773a6bb96b109d0fca6ab276f5bb70523
|
|
4
|
+
data.tar.gz: 5b24a84ec9a7617b3dfe33e9c97cccf5edc7caa627b51b76b3044f2952e32e80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 507f3c7f5e1570c9014e953179a42c13c5502ea50483172fd7650a6b9853297e9220cb096599c4498a95f1873bf06d37852355cb2bc566481c2b93c61a4a9cb6
|
|
7
|
+
data.tar.gz: 05515f1bd95793f5c0497e2d3e0ea9cd65d9d14015f8f2abe151aa40ea0dfb849250505f0a132ba6b161d31d0839ebaec6adb7e8cef91dc286d123f7b04a1f37
|
data/.rubocop.yml
CHANGED
|
@@ -1,63 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2016-02-10 17:06:30 +0100 using RuboCop version 0.37.1.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
|
8
2
|
|
|
9
|
-
# Offense count: 1
|
|
10
|
-
# Configuration parameters: AllowSafeAssignment.
|
|
11
|
-
Lint/AssignmentInCondition:
|
|
12
|
-
Exclude:
|
|
13
|
-
- 'lib/api_auth/base.rb'
|
|
14
|
-
|
|
15
|
-
# Offense count: 2
|
|
16
3
|
Metrics/AbcSize:
|
|
17
4
|
Max: 25
|
|
18
5
|
|
|
19
|
-
#
|
|
20
|
-
Metrics/CyclomaticComplexity:
|
|
21
|
-
Max: 13
|
|
22
|
-
|
|
23
|
-
# Offense count: 74
|
|
24
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
|
6
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
25
7
|
# URISchemes: http, https
|
|
26
8
|
Metrics/LineLength:
|
|
27
|
-
Max:
|
|
9
|
+
Max: 140
|
|
28
10
|
|
|
29
|
-
# Offense count: 4
|
|
30
|
-
# Configuration parameters: CountComments.
|
|
31
11
|
Metrics/MethodLength:
|
|
32
|
-
Max:
|
|
33
|
-
|
|
34
|
-
# Offense count: 1
|
|
35
|
-
Metrics/PerceivedComplexity:
|
|
36
|
-
Max: 8
|
|
37
|
-
|
|
38
|
-
# Offense count: 8
|
|
39
|
-
Style/AccessorMethodName:
|
|
40
|
-
Exclude:
|
|
41
|
-
- 'lib/api_auth/railtie.rb'
|
|
42
|
-
- 'lib/api_auth/request_drivers/action_controller.rb'
|
|
43
|
-
- 'lib/api_auth/request_drivers/curb.rb'
|
|
44
|
-
- 'lib/api_auth/request_drivers/faraday.rb'
|
|
45
|
-
- 'lib/api_auth/request_drivers/httpi.rb'
|
|
46
|
-
- 'lib/api_auth/request_drivers/net_http.rb'
|
|
47
|
-
- 'lib/api_auth/request_drivers/rack.rb'
|
|
48
|
-
- 'lib/api_auth/request_drivers/rest_client.rb'
|
|
49
|
-
|
|
50
|
-
# Offense count: 4
|
|
51
|
-
Style/Documentation:
|
|
52
|
-
Exclude:
|
|
53
|
-
- 'spec/**/*'
|
|
54
|
-
- 'test/**/*'
|
|
55
|
-
- 'lib/api_auth/railtie.rb'
|
|
56
|
-
- 'lib/api_auth/request_drivers/rest_client.rb'
|
|
12
|
+
Max: 40
|
|
57
13
|
|
|
58
|
-
|
|
59
|
-
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
|
|
60
|
-
Style/FileName:
|
|
14
|
+
Naming/FileName:
|
|
61
15
|
Exclude:
|
|
62
16
|
- 'lib/api-auth.rb'
|
|
63
|
-
- 'Appraisals'
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2018-02-12 13:27:16 +0300 using RuboCop version 0.52.1.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
10
|
+
# Configuration parameters: AllowSafeAssignment.
|
|
11
|
+
Lint/AssignmentInCondition:
|
|
12
|
+
Exclude:
|
|
13
|
+
- 'lib/api_auth/base.rb'
|
|
14
|
+
|
|
15
|
+
# Offense count: 8
|
|
16
|
+
Lint/Void:
|
|
17
|
+
Exclude:
|
|
18
|
+
- 'lib/api_auth/headers.rb'
|
|
19
|
+
- 'lib/api_auth/request_drivers/action_controller.rb'
|
|
20
|
+
- 'lib/api_auth/request_drivers/curb.rb'
|
|
21
|
+
- 'lib/api_auth/request_drivers/faraday.rb'
|
|
22
|
+
- 'lib/api_auth/request_drivers/httpi.rb'
|
|
23
|
+
- 'lib/api_auth/request_drivers/net_http.rb'
|
|
24
|
+
- 'lib/api_auth/request_drivers/rack.rb'
|
|
25
|
+
- 'lib/api_auth/request_drivers/rest_client.rb'
|
|
26
|
+
|
|
27
|
+
# Offense count: 1
|
|
28
|
+
Metrics/CyclomaticComplexity:
|
|
29
|
+
Max: 14
|
|
30
|
+
|
|
31
|
+
# Offense count: 1
|
|
32
|
+
Metrics/PerceivedComplexity:
|
|
33
|
+
Max: 8
|
|
34
|
+
|
|
35
|
+
# Offense count: 9
|
|
36
|
+
Naming/AccessorMethodName:
|
|
37
|
+
Exclude:
|
|
38
|
+
- 'lib/api_auth/railtie.rb'
|
|
39
|
+
- 'lib/api_auth/request_drivers/action_controller.rb'
|
|
40
|
+
- 'lib/api_auth/request_drivers/curb.rb'
|
|
41
|
+
- 'lib/api_auth/request_drivers/faraday.rb'
|
|
42
|
+
- 'lib/api_auth/request_drivers/http.rb'
|
|
43
|
+
- 'lib/api_auth/request_drivers/httpi.rb'
|
|
44
|
+
- 'lib/api_auth/request_drivers/net_http.rb'
|
|
45
|
+
- 'lib/api_auth/request_drivers/rack.rb'
|
|
46
|
+
- 'lib/api_auth/request_drivers/rest_client.rb'
|
|
47
|
+
|
|
48
|
+
# Offense count: 9
|
|
49
|
+
Style/CommentedKeyword:
|
|
50
|
+
Exclude:
|
|
51
|
+
- 'lib/api_auth/base.rb'
|
|
52
|
+
- 'lib/api_auth/railtie.rb'
|
|
53
|
+
|
|
54
|
+
# Offense count: 4
|
|
55
|
+
Style/Documentation:
|
|
56
|
+
Exclude:
|
|
57
|
+
- 'spec/**/*'
|
|
58
|
+
- 'test/**/*'
|
|
59
|
+
- 'lib/api_auth/railtie.rb'
|
|
60
|
+
- 'lib/api_auth/request_drivers/rest_client.rb'
|
data/.travis.yml
CHANGED
|
@@ -2,16 +2,20 @@ language: ruby
|
|
|
2
2
|
sudo: false
|
|
3
3
|
cache: bundler
|
|
4
4
|
rvm:
|
|
5
|
-
- 2.1.
|
|
6
|
-
- 2.2.
|
|
7
|
-
- 2.3.
|
|
8
|
-
- 2.4.
|
|
5
|
+
- 2.1.10
|
|
6
|
+
- 2.2.9
|
|
7
|
+
- 2.3.6
|
|
8
|
+
- 2.4.3
|
|
9
|
+
- 2.5.0
|
|
9
10
|
gemfile:
|
|
10
11
|
- gemfiles/rails_4.gemfile
|
|
11
12
|
- gemfiles/rails_41.gemfile
|
|
12
13
|
- gemfiles/rails_42.gemfile
|
|
13
14
|
- gemfiles/rails_5.gemfile
|
|
14
15
|
- gemfiles/rails_51.gemfile
|
|
16
|
+
- gemfiles/http2.gemfile
|
|
17
|
+
- gemfiles/http3.gemfile
|
|
18
|
+
- gemfiles/http4.gemfile
|
|
15
19
|
env:
|
|
16
20
|
- TEST_SUITE=rake
|
|
17
21
|
|
|
@@ -23,12 +27,18 @@ script:
|
|
|
23
27
|
|
|
24
28
|
matrix:
|
|
25
29
|
exclude:
|
|
26
|
-
- rvm: 2.1.
|
|
30
|
+
- rvm: 2.1.10
|
|
27
31
|
gemfile: gemfiles/rails_5.gemfile
|
|
28
|
-
- rvm: 2.1.
|
|
32
|
+
- rvm: 2.1.10
|
|
29
33
|
gemfile: gemfiles/rails_51.gemfile
|
|
34
|
+
- rvm: 2.1.9
|
|
35
|
+
gemfile: gemfiles/http2.gemfile
|
|
36
|
+
- rvm: 2.1.9
|
|
37
|
+
gemfile: gemfiles/http3.gemfile
|
|
38
|
+
- rvm: 2.1.9
|
|
39
|
+
gemfile: gemfiles/http4.gemfile
|
|
30
40
|
include:
|
|
31
|
-
- rvm: 2.
|
|
41
|
+
- rvm: 2.5.0
|
|
32
42
|
gemfile: gemfiles/rails_5.gemfile
|
|
33
43
|
env: TEST_SUITE="rubocop lib/ spec/"
|
|
34
44
|
|
data/README.md
CHANGED
|
@@ -51,7 +51,7 @@ minutes in order to avoid replay attacks.
|
|
|
51
51
|
|
|
52
52
|
## Requirement
|
|
53
53
|
|
|
54
|
-
v3.X require Ruby 2.
|
|
54
|
+
v3.X require Ruby >= 2.1 and Rails >= 4.0 if you use rails.
|
|
55
55
|
|
|
56
56
|
For older version of Ruby or Rails, please use ApiAuth v2.X.
|
|
57
57
|
|
|
@@ -78,8 +78,8 @@ Here is the current list of supported request objects:
|
|
|
78
78
|
* Curb (Curl::Easy)
|
|
79
79
|
* RestClient
|
|
80
80
|
* Faraday
|
|
81
|
-
*
|
|
82
|
-
*
|
|
81
|
+
* HTTPI
|
|
82
|
+
* HTTP
|
|
83
83
|
|
|
84
84
|
### HTTP Client Objects
|
|
85
85
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.2.
|
|
1
|
+
2.2.1
|
data/api_auth.gemspec
CHANGED
|
@@ -9,19 +9,22 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.authors = ['Mauricio Gomes']
|
|
10
10
|
s.email = 'mauricio@edge14.com'
|
|
11
11
|
|
|
12
|
-
s.
|
|
13
|
-
|
|
14
|
-
s.add_development_dependency 'amatch'
|
|
15
|
-
s.add_development_dependency 'rspec', '~> 3.4'
|
|
12
|
+
s.required_ruby_version = '>= 2.1.0'
|
|
13
|
+
|
|
16
14
|
s.add_development_dependency 'actionpack', '< 6.0', '> 4.0'
|
|
15
|
+
s.add_development_dependency 'activeresource', '>= 4.0'
|
|
17
16
|
s.add_development_dependency 'activesupport', '< 6.0', '> 4.0'
|
|
18
|
-
s.add_development_dependency '
|
|
19
|
-
s.add_development_dependency '
|
|
20
|
-
s.add_development_dependency 'curb', '~> 0.8
|
|
21
|
-
s.add_development_dependency 'httpi'
|
|
17
|
+
s.add_development_dependency 'amatch'
|
|
18
|
+
s.add_development_dependency 'appraisal'
|
|
19
|
+
s.add_development_dependency 'curb', '~> 0.8'
|
|
22
20
|
s.add_development_dependency 'faraday', '>= 0.10'
|
|
21
|
+
s.add_development_dependency 'http'
|
|
22
|
+
s.add_development_dependency 'httpi'
|
|
23
23
|
s.add_development_dependency 'multipart-post', '~> 2.0'
|
|
24
|
-
s.add_development_dependency '
|
|
24
|
+
s.add_development_dependency 'pry'
|
|
25
|
+
s.add_development_dependency 'rake'
|
|
26
|
+
s.add_development_dependency 'rest-client', '~> 2.0'
|
|
27
|
+
s.add_development_dependency 'rspec', '~> 3.4'
|
|
25
28
|
|
|
26
29
|
s.files = `git ls-files`.split("\n")
|
|
27
30
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/api_auth.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'openssl'
|
|
2
2
|
require 'base64'
|
|
3
|
+
require 'time'
|
|
3
4
|
|
|
4
5
|
require 'api_auth/errors'
|
|
5
6
|
require 'api_auth/helpers'
|
|
@@ -12,6 +13,7 @@ require 'api_auth/request_drivers/action_dispatch'
|
|
|
12
13
|
require 'api_auth/request_drivers/rack'
|
|
13
14
|
require 'api_auth/request_drivers/httpi'
|
|
14
15
|
require 'api_auth/request_drivers/faraday'
|
|
16
|
+
require 'api_auth/request_drivers/http'
|
|
15
17
|
|
|
16
18
|
require 'api_auth/headers'
|
|
17
19
|
require 'api_auth/base'
|
data/lib/api_auth/headers.rb
CHANGED
|
@@ -34,6 +34,8 @@ module ApiAuth
|
|
|
34
34
|
HttpiRequest.new(request)
|
|
35
35
|
when /Faraday::Request/
|
|
36
36
|
FaradayRequest.new(request)
|
|
37
|
+
when /HTTP::Request/
|
|
38
|
+
HttpRequest.new(request)
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
return new_request if new_request
|
|
@@ -50,9 +52,7 @@ module ApiAuth
|
|
|
50
52
|
def canonical_string(override_method = nil)
|
|
51
53
|
request_method = override_method || @request.http_method
|
|
52
54
|
|
|
53
|
-
if request_method.nil?
|
|
54
|
-
raise ArgumentError, 'unable to determine the http method from the request, please supply an override'
|
|
55
|
-
end
|
|
55
|
+
raise ArgumentError, 'unable to determine the http method from the request, please supply an override' if request_method.nil?
|
|
56
56
|
|
|
57
57
|
[request_method.upcase,
|
|
58
58
|
@request.content_type,
|
data/lib/api_auth/railtie.rb
CHANGED
|
@@ -13,9 +13,7 @@ module ApiAuth
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
if defined?(ActionController::Base)
|
|
17
|
-
ActionController::Base.send(:include, ControllerMethods::InstanceMethods)
|
|
18
|
-
end
|
|
16
|
+
ActionController::Base.send(:include, ControllerMethods::InstanceMethods) if defined?(ActionController::Base)
|
|
19
17
|
end # ControllerMethods
|
|
20
18
|
|
|
21
19
|
module ActiveResourceExtension # :nodoc:
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
module ApiAuth
|
|
2
|
+
module RequestDrivers # :nodoc:
|
|
3
|
+
class HttpRequest # :nodoc:
|
|
4
|
+
include ApiAuth::Helpers
|
|
5
|
+
|
|
6
|
+
def initialize(request)
|
|
7
|
+
@request = request
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def set_auth_header(header)
|
|
11
|
+
@request['Authorization'] = header
|
|
12
|
+
@request
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def calculated_md5
|
|
16
|
+
md5_base64digest(body)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def populate_content_md5
|
|
20
|
+
return unless %w[POST PUT].include?(http_method)
|
|
21
|
+
@request['Content-MD5'] = calculated_md5
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def md5_mismatch?
|
|
25
|
+
if %w[POST PUT].include?(http_method)
|
|
26
|
+
calculated_md5 != content_md5
|
|
27
|
+
else
|
|
28
|
+
false
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def http_method
|
|
33
|
+
@request.verb.to_s.upcase
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def content_type
|
|
37
|
+
find_header(%w[CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE])
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def content_md5
|
|
41
|
+
find_header(%w[CONTENT-MD5 CONTENT_MD5])
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def original_uri
|
|
45
|
+
find_header(%w[X-ORIGINAL-URI X_ORIGINAL_URI HTTP_X_ORIGINAL_URI])
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def request_uri
|
|
49
|
+
@request.uri.request_uri
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def set_date
|
|
53
|
+
@request['Date'] = Time.now.utc.httpdate
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def timestamp
|
|
57
|
+
find_header(%w[DATE HTTP_DATE])
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def authorization_header
|
|
61
|
+
find_header %w[Authorization AUTHORIZATION HTTP_AUTHORIZATION]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def body
|
|
65
|
+
if body_source.respond_to?(:read)
|
|
66
|
+
result = body_source.read
|
|
67
|
+
body_source.rewind
|
|
68
|
+
result
|
|
69
|
+
else
|
|
70
|
+
body_source.to_s
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
private
|
|
75
|
+
|
|
76
|
+
def find_header(keys)
|
|
77
|
+
keys.map { |key| @request[key] }.compact.first
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def body_source
|
|
81
|
+
body = @request.body
|
|
82
|
+
|
|
83
|
+
if defined?(::HTTP::Request::Body)
|
|
84
|
+
body.respond_to?(:source) ? body.source : body.instance_variable_get(:@body)
|
|
85
|
+
else
|
|
86
|
+
body
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -29,13 +29,13 @@ module ApiAuth
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def populate_content_md5
|
|
32
|
-
return unless %
|
|
32
|
+
return unless %w[post put].include?(@request.method.to_s)
|
|
33
33
|
@request.headers['Content-MD5'] = calculated_md5
|
|
34
34
|
save_headers
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def md5_mismatch?
|
|
38
|
-
if %
|
|
38
|
+
if %w[post put].include?(@request.method.to_s)
|
|
39
39
|
calculated_md5 != content_md5
|
|
40
40
|
else
|
|
41
41
|
false
|
data/spec/headers_spec.rb
CHANGED
|
@@ -7,14 +7,6 @@ describe ApiAuth::Headers do
|
|
|
7
7
|
subject(:headers) { described_class.new(request) }
|
|
8
8
|
let(:uri) { '' }
|
|
9
9
|
|
|
10
|
-
context 'empty uri' do
|
|
11
|
-
let(:uri) { ''.freeze }
|
|
12
|
-
|
|
13
|
-
it 'adds / to canonical string' do
|
|
14
|
-
expect(subject.canonical_string).to eq('GET,,,/,')
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
10
|
context 'uri with just host without /' do
|
|
19
11
|
let(:uri) { 'http://google.com'.freeze }
|
|
20
12
|
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe ApiAuth::RequestDrivers::HttpRequest do
|
|
4
|
+
let(:timestamp) { Time.now.utc.httpdate }
|
|
5
|
+
|
|
6
|
+
let(:request) do
|
|
7
|
+
HTTP::Request.new(
|
|
8
|
+
verb: verb,
|
|
9
|
+
uri: uri,
|
|
10
|
+
headers: headers,
|
|
11
|
+
body: body
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
let(:verb) { :put }
|
|
16
|
+
let(:uri) { 'http://localhost/resource.xml?foo=bar&bar=foo' }
|
|
17
|
+
let(:body) { "hello\nworld" }
|
|
18
|
+
|
|
19
|
+
let(:headers) do
|
|
20
|
+
{
|
|
21
|
+
'Authorization' => 'APIAuth 1044:12345',
|
|
22
|
+
'content-md5' => '1B2M2Y8AsgTpgAmY7PhCfg==',
|
|
23
|
+
'content-type' => 'text/plain',
|
|
24
|
+
'date' => timestamp
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
subject(:driven_request) { described_class.new(request) }
|
|
29
|
+
|
|
30
|
+
describe 'getting headers correctly' do
|
|
31
|
+
it 'gets the content_type' do
|
|
32
|
+
expect(driven_request.content_type).to eq('text/plain')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'gets the content_md5' do
|
|
36
|
+
expect(driven_request.content_md5).to eq('1B2M2Y8AsgTpgAmY7PhCfg==')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'gets the request_uri' do
|
|
40
|
+
expect(driven_request.request_uri).to eq('/resource.xml?foo=bar&bar=foo')
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it 'gets the timestamp' do
|
|
44
|
+
expect(driven_request.timestamp).to eq(timestamp)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it 'gets the authorization_header' do
|
|
48
|
+
expect(driven_request.authorization_header).to eq('APIAuth 1044:12345')
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe '#calculated_md5' do
|
|
52
|
+
it 'calculates md5 from the body' do
|
|
53
|
+
expect(driven_request.calculated_md5).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
|
54
|
+
expect(driven_request.body.bytesize).to eq(11)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
context 'no body' do
|
|
58
|
+
let(:body) { nil }
|
|
59
|
+
|
|
60
|
+
it 'treats no body as empty string' do
|
|
61
|
+
expect(driven_request.calculated_md5).to eq('1B2M2Y8AsgTpgAmY7PhCfg==')
|
|
62
|
+
expect(driven_request.body.bytesize).to eq(0)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
context 'multipart content' do
|
|
67
|
+
let(:body) { File.new('spec/fixtures/upload.png') }
|
|
68
|
+
|
|
69
|
+
it 'calculates correctly for multipart content' do
|
|
70
|
+
expect(driven_request.calculated_md5).to eq('k4U8MTA3RHDcewBzymVNEQ==')
|
|
71
|
+
expect(driven_request.body.bytesize).to eq(5112)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
describe 'http_method' do
|
|
77
|
+
context 'when put request' do
|
|
78
|
+
let(:verb) { :put }
|
|
79
|
+
|
|
80
|
+
it 'returns upcased put' do
|
|
81
|
+
expect(driven_request.http_method).to eq('PUT')
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
context 'when get request' do
|
|
86
|
+
let(:verb) { :get }
|
|
87
|
+
|
|
88
|
+
it 'returns upcased get' do
|
|
89
|
+
expect(driven_request.http_method).to eq('GET')
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
describe 'setting headers correctly' do
|
|
96
|
+
let(:headers) do
|
|
97
|
+
{
|
|
98
|
+
'content-type' => 'text/plain'
|
|
99
|
+
}
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
describe '#populate_content_md5' do
|
|
103
|
+
context 'when request type has no body' do
|
|
104
|
+
let(:verb) { :get }
|
|
105
|
+
|
|
106
|
+
it "doesn't populate content-md5" do
|
|
107
|
+
driven_request.populate_content_md5
|
|
108
|
+
expect(request['Content-MD5']).to be_nil
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
context 'when request type has a body' do
|
|
113
|
+
let(:verb) { :put }
|
|
114
|
+
|
|
115
|
+
it 'populates content-md5' do
|
|
116
|
+
driven_request.populate_content_md5
|
|
117
|
+
expect(request['Content-MD5']).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it 'refreshes the cached headers' do
|
|
121
|
+
driven_request.populate_content_md5
|
|
122
|
+
expect(driven_request.content_md5).to eq('kZXQvrKoieG+Be1rsZVINw==')
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
describe '#set_date' do
|
|
128
|
+
before do
|
|
129
|
+
allow(Time).to receive_message_chain(:now, :utc, :httpdate).and_return(timestamp)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'sets the date header of the request' do
|
|
133
|
+
driven_request.set_date
|
|
134
|
+
expect(request['DATE']).to eq(timestamp)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
it 'refreshes the cached headers' do
|
|
138
|
+
driven_request.set_date
|
|
139
|
+
expect(driven_request.timestamp).to eq(timestamp)
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
describe '#set_auth_header' do
|
|
144
|
+
it 'sets the auth header' do
|
|
145
|
+
driven_request.set_auth_header('APIAuth 1044:54321')
|
|
146
|
+
expect(request['Authorization']).to eq('APIAuth 1044:54321')
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
describe 'md5_mismatch?' do
|
|
152
|
+
context 'when request type has no body' do
|
|
153
|
+
let(:verb) { :get }
|
|
154
|
+
|
|
155
|
+
it 'is false' do
|
|
156
|
+
expect(driven_request.md5_mismatch?).to be false
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
context 'when request type has a body' do
|
|
161
|
+
let(:verb) { :put }
|
|
162
|
+
|
|
163
|
+
context 'when calculated matches sent' do
|
|
164
|
+
before do
|
|
165
|
+
request['Content-MD5'] = 'kZXQvrKoieG+Be1rsZVINw=='
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
it 'is false' do
|
|
169
|
+
expect(driven_request.md5_mismatch?).to be false
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
context "when calculated doesn't match sent" do
|
|
174
|
+
before do
|
|
175
|
+
request['Content-MD5'] = '3'
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
it 'is true' do
|
|
179
|
+
expect(driven_request.md5_mismatch?).to be true
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
end
|
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
|
3
3
|
describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
4
4
|
let(:timestamp) { Time.now.utc.httpdate }
|
|
5
5
|
|
|
6
|
-
let(:request_path) { '/resource.xml?foo=bar&bar=foo' }
|
|
6
|
+
let(:request_path) { 'http://localhost/resource.xml?foo=bar&bar=foo' }
|
|
7
7
|
|
|
8
8
|
let(:request_headers) do
|
|
9
9
|
{
|
|
@@ -16,7 +16,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
16
16
|
|
|
17
17
|
let(:request) do
|
|
18
18
|
RestClient::Request.new(
|
|
19
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
19
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
20
20
|
headers: request_headers,
|
|
21
21
|
method: :put,
|
|
22
22
|
payload: "hello\nworld"
|
|
@@ -35,7 +35,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
it 'gets the request_uri' do
|
|
38
|
-
expect(driven_request.request_uri).to eq('/resource.xml?foo=bar&bar=foo')
|
|
38
|
+
expect(driven_request.request_uri).to eq('http://localhost/resource.xml?foo=bar&bar=foo')
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
it 'gets the timestamp' do
|
|
@@ -53,7 +53,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
53
53
|
|
|
54
54
|
it 'treats no body as empty string' do
|
|
55
55
|
request = RestClient::Request.new(
|
|
56
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
56
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
57
57
|
headers: request_headers,
|
|
58
58
|
method: :put
|
|
59
59
|
)
|
|
@@ -66,7 +66,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
66
66
|
context 'when put request' do
|
|
67
67
|
let(:request) do
|
|
68
68
|
RestClient::Request.new(
|
|
69
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
69
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
70
70
|
headers: request_headers,
|
|
71
71
|
method: :put
|
|
72
72
|
)
|
|
@@ -80,7 +80,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
80
80
|
context 'when get request' do
|
|
81
81
|
let(:request) do
|
|
82
82
|
RestClient::Request.new(
|
|
83
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
83
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
84
84
|
headers: request_headers,
|
|
85
85
|
method: :get
|
|
86
86
|
)
|
|
@@ -104,7 +104,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
104
104
|
context 'when getting' do
|
|
105
105
|
let(:request) do
|
|
106
106
|
RestClient::Request.new(
|
|
107
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
107
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
108
108
|
headers: request_headers,
|
|
109
109
|
method: :get
|
|
110
110
|
)
|
|
@@ -119,7 +119,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
119
119
|
context 'when posting' do
|
|
120
120
|
let(:request) do
|
|
121
121
|
RestClient::Request.new(
|
|
122
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
122
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
123
123
|
headers: request_headers,
|
|
124
124
|
method: :post,
|
|
125
125
|
payload: "hello\nworld"
|
|
@@ -140,7 +140,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
140
140
|
context 'when putting' do
|
|
141
141
|
let(:request) do
|
|
142
142
|
RestClient::Request.new(
|
|
143
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
143
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
144
144
|
headers: request_headers,
|
|
145
145
|
method: :put,
|
|
146
146
|
payload: "hello\nworld"
|
|
@@ -161,7 +161,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
161
161
|
context 'when deleting' do
|
|
162
162
|
let(:request) do
|
|
163
163
|
RestClient::Request.new(
|
|
164
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
164
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
165
165
|
headers: request_headers,
|
|
166
166
|
method: :delete
|
|
167
167
|
)
|
|
@@ -203,7 +203,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
203
203
|
context 'when getting' do
|
|
204
204
|
let(:request) do
|
|
205
205
|
RestClient::Request.new(
|
|
206
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
206
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
207
207
|
headers: request_headers,
|
|
208
208
|
method: :get
|
|
209
209
|
)
|
|
@@ -217,7 +217,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
217
217
|
context 'when posting' do
|
|
218
218
|
let(:request) do
|
|
219
219
|
RestClient::Request.new(
|
|
220
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
220
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
221
221
|
headers: request_headers,
|
|
222
222
|
method: :post,
|
|
223
223
|
payload: "hello\nworld"
|
|
@@ -258,7 +258,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
258
258
|
context 'when putting' do
|
|
259
259
|
let(:request) do
|
|
260
260
|
RestClient::Request.new(
|
|
261
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
261
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
262
262
|
headers: request_headers,
|
|
263
263
|
method: :put,
|
|
264
264
|
payload: "hello\nworld"
|
|
@@ -299,7 +299,7 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
299
299
|
context 'when deleting' do
|
|
300
300
|
let(:request) do
|
|
301
301
|
RestClient::Request.new(
|
|
302
|
-
url: '/resource.xml?foo=bar&bar=foo',
|
|
302
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
303
303
|
headers: request_headers,
|
|
304
304
|
method: :delete
|
|
305
305
|
)
|
|
@@ -311,12 +311,84 @@ describe ApiAuth::RequestDrivers::RestClientRequest do
|
|
|
311
311
|
end
|
|
312
312
|
end
|
|
313
313
|
|
|
314
|
+
describe 'authentics?' do
|
|
315
|
+
context 'when getting' do
|
|
316
|
+
let(:request) do
|
|
317
|
+
RestClient::Request.new(
|
|
318
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
319
|
+
method: :get
|
|
320
|
+
)
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
let(:signed_request) do
|
|
324
|
+
ApiAuth.sign!(request, '1044', '123')
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
it 'validates that the signature in the request header matches the way we sign it' do
|
|
328
|
+
expect(ApiAuth.authentic?(signed_request, '123')).to eq true
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
context 'when posting' do
|
|
333
|
+
let(:request) do
|
|
334
|
+
RestClient::Request.new(
|
|
335
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
336
|
+
method: :post,
|
|
337
|
+
payload: "hello\nworld"
|
|
338
|
+
)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
let(:signed_request) do
|
|
342
|
+
ApiAuth.sign!(request, '1044', '123')
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
it 'validates that the signature in the request header matches the way we sign it' do
|
|
346
|
+
expect(ApiAuth.authentic?(signed_request, '123')).to eq true
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
context 'when putting' do
|
|
351
|
+
let(:request) do
|
|
352
|
+
RestClient::Request.new(
|
|
353
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
354
|
+
method: :put,
|
|
355
|
+
payload: "hello\nworld"
|
|
356
|
+
)
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
let(:signed_request) do
|
|
360
|
+
ApiAuth.sign!(request, '1044', '123')
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
it 'validates that the signature in the request header matches the way we sign it' do
|
|
364
|
+
expect(ApiAuth.authentic?(signed_request, '123')).to eq true
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
context 'when deleting' do
|
|
369
|
+
let(:request) do
|
|
370
|
+
RestClient::Request.new(
|
|
371
|
+
url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
372
|
+
method: :delete
|
|
373
|
+
)
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
let(:signed_request) do
|
|
377
|
+
ApiAuth.sign!(request, '1044', '123')
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
it 'validates that the signature in the request header matches the way we sign it' do
|
|
381
|
+
expect(ApiAuth.authentic?(signed_request, '123')).to eq true
|
|
382
|
+
end
|
|
383
|
+
end
|
|
384
|
+
end
|
|
385
|
+
|
|
314
386
|
describe 'edge cases' do
|
|
315
387
|
it "doesn't mess up symbol based headers" do
|
|
316
388
|
headers = { 'Content-MD5' => 'e59ff97941044f85df5297e1c302d260',
|
|
317
389
|
:content_type => 'text/plain',
|
|
318
390
|
'Date' => 'Mon, 23 Jan 1984 03:29:56 GMT' }
|
|
319
|
-
request = RestClient::Request.new(url: '/resource.xml?foo=bar&bar=foo',
|
|
391
|
+
request = RestClient::Request.new(url: 'http://localhost/resource.xml?foo=bar&bar=foo',
|
|
320
392
|
headers: headers,
|
|
321
393
|
method: :put)
|
|
322
394
|
ApiAuth.sign!(request, 'some access id', 'some secret key')
|
data/spec/spec_helper.rb
CHANGED
|
@@ -13,6 +13,7 @@ require 'api_auth'
|
|
|
13
13
|
require 'amatch'
|
|
14
14
|
require 'rest_client'
|
|
15
15
|
require 'curb'
|
|
16
|
+
require 'http'
|
|
16
17
|
require 'httpi'
|
|
17
18
|
require 'faraday'
|
|
18
19
|
require 'net/http/post/multipart'
|
|
@@ -20,6 +21,3 @@ require 'net/http/post/multipart'
|
|
|
20
21
|
# Requires supporting files with custom matchers and macros, etc,
|
|
21
22
|
# in ./support/ and its subdirectories.
|
|
22
23
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
|
23
|
-
|
|
24
|
-
RSpec.configure do |config|
|
|
25
|
-
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: api-auth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mauricio Gomes
|
|
@@ -11,33 +11,59 @@ cert_chain: []
|
|
|
11
11
|
date: 2018-03-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: actionpack
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "<"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
19
|
+
version: '6.0'
|
|
20
|
+
- - ">"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '4.0'
|
|
20
23
|
type: :development
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- - "
|
|
27
|
+
- - "<"
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
29
|
+
version: '6.0'
|
|
30
|
+
- - ">"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '4.0'
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
34
|
+
name: activeresource
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
30
36
|
requirements:
|
|
31
37
|
- - ">="
|
|
32
38
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
39
|
+
version: '4.0'
|
|
34
40
|
type: :development
|
|
35
41
|
prerelease: false
|
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
43
|
requirements:
|
|
38
44
|
- - ">="
|
|
39
45
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
46
|
+
version: '4.0'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: activesupport
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "<"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '6.0'
|
|
54
|
+
- - ">"
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: '4.0'
|
|
57
|
+
type: :development
|
|
58
|
+
prerelease: false
|
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - "<"
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: '6.0'
|
|
64
|
+
- - ">"
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '4.0'
|
|
41
67
|
- !ruby/object:Gem::Dependency
|
|
42
68
|
name: amatch
|
|
43
69
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -53,103 +79,91 @@ dependencies:
|
|
|
53
79
|
- !ruby/object:Gem::Version
|
|
54
80
|
version: '0'
|
|
55
81
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
82
|
+
name: appraisal
|
|
57
83
|
requirement: !ruby/object:Gem::Requirement
|
|
58
84
|
requirements:
|
|
59
|
-
- - "
|
|
85
|
+
- - ">="
|
|
60
86
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
87
|
+
version: '0'
|
|
62
88
|
type: :development
|
|
63
89
|
prerelease: false
|
|
64
90
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
91
|
requirements:
|
|
66
|
-
- - "
|
|
92
|
+
- - ">="
|
|
67
93
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
94
|
+
version: '0'
|
|
69
95
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
96
|
+
name: curb
|
|
71
97
|
requirement: !ruby/object:Gem::Requirement
|
|
72
98
|
requirements:
|
|
73
|
-
- - "
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '6.0'
|
|
76
|
-
- - ">"
|
|
99
|
+
- - "~>"
|
|
77
100
|
- !ruby/object:Gem::Version
|
|
78
|
-
version: '
|
|
101
|
+
version: '0.8'
|
|
79
102
|
type: :development
|
|
80
103
|
prerelease: false
|
|
81
104
|
version_requirements: !ruby/object:Gem::Requirement
|
|
82
105
|
requirements:
|
|
83
|
-
- - "
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: '6.0'
|
|
86
|
-
- - ">"
|
|
106
|
+
- - "~>"
|
|
87
107
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '
|
|
108
|
+
version: '0.8'
|
|
89
109
|
- !ruby/object:Gem::Dependency
|
|
90
|
-
name:
|
|
110
|
+
name: faraday
|
|
91
111
|
requirement: !ruby/object:Gem::Requirement
|
|
92
112
|
requirements:
|
|
93
|
-
- - "
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: '6.0'
|
|
96
|
-
- - ">"
|
|
113
|
+
- - ">="
|
|
97
114
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: '
|
|
115
|
+
version: '0.10'
|
|
99
116
|
type: :development
|
|
100
117
|
prerelease: false
|
|
101
118
|
version_requirements: !ruby/object:Gem::Requirement
|
|
102
119
|
requirements:
|
|
103
|
-
- - "
|
|
104
|
-
- !ruby/object:Gem::Version
|
|
105
|
-
version: '6.0'
|
|
106
|
-
- - ">"
|
|
120
|
+
- - ">="
|
|
107
121
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '
|
|
122
|
+
version: '0.10'
|
|
109
123
|
- !ruby/object:Gem::Dependency
|
|
110
|
-
name:
|
|
124
|
+
name: http
|
|
111
125
|
requirement: !ruby/object:Gem::Requirement
|
|
112
126
|
requirements:
|
|
113
|
-
- - "
|
|
127
|
+
- - ">="
|
|
114
128
|
- !ruby/object:Gem::Version
|
|
115
|
-
version: '
|
|
129
|
+
version: '0'
|
|
116
130
|
type: :development
|
|
117
131
|
prerelease: false
|
|
118
132
|
version_requirements: !ruby/object:Gem::Requirement
|
|
119
133
|
requirements:
|
|
120
|
-
- - "
|
|
134
|
+
- - ">="
|
|
121
135
|
- !ruby/object:Gem::Version
|
|
122
|
-
version: '
|
|
136
|
+
version: '0'
|
|
123
137
|
- !ruby/object:Gem::Dependency
|
|
124
|
-
name:
|
|
138
|
+
name: httpi
|
|
125
139
|
requirement: !ruby/object:Gem::Requirement
|
|
126
140
|
requirements:
|
|
127
|
-
- - "
|
|
141
|
+
- - ">="
|
|
128
142
|
- !ruby/object:Gem::Version
|
|
129
|
-
version:
|
|
143
|
+
version: '0'
|
|
130
144
|
type: :development
|
|
131
145
|
prerelease: false
|
|
132
146
|
version_requirements: !ruby/object:Gem::Requirement
|
|
133
147
|
requirements:
|
|
134
|
-
- - "
|
|
148
|
+
- - ">="
|
|
135
149
|
- !ruby/object:Gem::Version
|
|
136
|
-
version:
|
|
150
|
+
version: '0'
|
|
137
151
|
- !ruby/object:Gem::Dependency
|
|
138
|
-
name:
|
|
152
|
+
name: multipart-post
|
|
139
153
|
requirement: !ruby/object:Gem::Requirement
|
|
140
154
|
requirements:
|
|
141
155
|
- - "~>"
|
|
142
156
|
- !ruby/object:Gem::Version
|
|
143
|
-
version: 0
|
|
157
|
+
version: '2.0'
|
|
144
158
|
type: :development
|
|
145
159
|
prerelease: false
|
|
146
160
|
version_requirements: !ruby/object:Gem::Requirement
|
|
147
161
|
requirements:
|
|
148
162
|
- - "~>"
|
|
149
163
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: 0
|
|
164
|
+
version: '2.0'
|
|
151
165
|
- !ruby/object:Gem::Dependency
|
|
152
|
-
name:
|
|
166
|
+
name: pry
|
|
153
167
|
requirement: !ruby/object:Gem::Requirement
|
|
154
168
|
requirements:
|
|
155
169
|
- - ">="
|
|
@@ -163,21 +177,21 @@ dependencies:
|
|
|
163
177
|
- !ruby/object:Gem::Version
|
|
164
178
|
version: '0'
|
|
165
179
|
- !ruby/object:Gem::Dependency
|
|
166
|
-
name:
|
|
180
|
+
name: rake
|
|
167
181
|
requirement: !ruby/object:Gem::Requirement
|
|
168
182
|
requirements:
|
|
169
183
|
- - ">="
|
|
170
184
|
- !ruby/object:Gem::Version
|
|
171
|
-
version: '0
|
|
185
|
+
version: '0'
|
|
172
186
|
type: :development
|
|
173
187
|
prerelease: false
|
|
174
188
|
version_requirements: !ruby/object:Gem::Requirement
|
|
175
189
|
requirements:
|
|
176
190
|
- - ">="
|
|
177
191
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '0
|
|
192
|
+
version: '0'
|
|
179
193
|
- !ruby/object:Gem::Dependency
|
|
180
|
-
name:
|
|
194
|
+
name: rest-client
|
|
181
195
|
requirement: !ruby/object:Gem::Requirement
|
|
182
196
|
requirements:
|
|
183
197
|
- - "~>"
|
|
@@ -191,19 +205,19 @@ dependencies:
|
|
|
191
205
|
- !ruby/object:Gem::Version
|
|
192
206
|
version: '2.0'
|
|
193
207
|
- !ruby/object:Gem::Dependency
|
|
194
|
-
name:
|
|
208
|
+
name: rspec
|
|
195
209
|
requirement: !ruby/object:Gem::Requirement
|
|
196
210
|
requirements:
|
|
197
211
|
- - "~>"
|
|
198
212
|
- !ruby/object:Gem::Version
|
|
199
|
-
version:
|
|
213
|
+
version: '3.4'
|
|
200
214
|
type: :development
|
|
201
215
|
prerelease: false
|
|
202
216
|
version_requirements: !ruby/object:Gem::Requirement
|
|
203
217
|
requirements:
|
|
204
218
|
- - "~>"
|
|
205
219
|
- !ruby/object:Gem::Version
|
|
206
|
-
version:
|
|
220
|
+
version: '3.4'
|
|
207
221
|
description: Full HMAC auth implementation for use in your gems and Rails apps.
|
|
208
222
|
email: mauricio@edge14.com
|
|
209
223
|
executables: []
|
|
@@ -214,6 +228,7 @@ files:
|
|
|
214
228
|
- ".gitignore"
|
|
215
229
|
- ".rspec"
|
|
216
230
|
- ".rubocop.yml"
|
|
231
|
+
- ".rubocop_todo.yml"
|
|
217
232
|
- ".travis.yml"
|
|
218
233
|
- Appraisals
|
|
219
234
|
- CHANGELOG.md
|
|
@@ -223,6 +238,9 @@ files:
|
|
|
223
238
|
- Rakefile
|
|
224
239
|
- VERSION
|
|
225
240
|
- api_auth.gemspec
|
|
241
|
+
- gemfiles/http2.gemfile
|
|
242
|
+
- gemfiles/http3.gemfile
|
|
243
|
+
- gemfiles/http4.gemfile
|
|
226
244
|
- gemfiles/rails_4.gemfile
|
|
227
245
|
- gemfiles/rails_41.gemfile
|
|
228
246
|
- gemfiles/rails_42.gemfile
|
|
@@ -239,6 +257,7 @@ files:
|
|
|
239
257
|
- lib/api_auth/request_drivers/action_dispatch.rb
|
|
240
258
|
- lib/api_auth/request_drivers/curb.rb
|
|
241
259
|
- lib/api_auth/request_drivers/faraday.rb
|
|
260
|
+
- lib/api_auth/request_drivers/http.rb
|
|
242
261
|
- lib/api_auth/request_drivers/httpi.rb
|
|
243
262
|
- lib/api_auth/request_drivers/net_http.rb
|
|
244
263
|
- lib/api_auth/request_drivers/rack.rb
|
|
@@ -253,6 +272,7 @@ files:
|
|
|
253
272
|
- spec/request_drivers/action_dispatch_spec.rb
|
|
254
273
|
- spec/request_drivers/curb_spec.rb
|
|
255
274
|
- spec/request_drivers/faraday_spec.rb
|
|
275
|
+
- spec/request_drivers/http_spec.rb
|
|
256
276
|
- spec/request_drivers/httpi_spec.rb
|
|
257
277
|
- spec/request_drivers/net_http_spec.rb
|
|
258
278
|
- spec/request_drivers/rack_spec.rb
|
|
@@ -269,7 +289,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
269
289
|
requirements:
|
|
270
290
|
- - ">="
|
|
271
291
|
- !ruby/object:Gem::Version
|
|
272
|
-
version:
|
|
292
|
+
version: 2.1.0
|
|
273
293
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
294
|
requirements:
|
|
275
295
|
- - ">="
|
|
@@ -291,6 +311,7 @@ test_files:
|
|
|
291
311
|
- spec/request_drivers/action_dispatch_spec.rb
|
|
292
312
|
- spec/request_drivers/curb_spec.rb
|
|
293
313
|
- spec/request_drivers/faraday_spec.rb
|
|
314
|
+
- spec/request_drivers/http_spec.rb
|
|
294
315
|
- spec/request_drivers/httpi_spec.rb
|
|
295
316
|
- spec/request_drivers/net_http_spec.rb
|
|
296
317
|
- spec/request_drivers/rack_spec.rb
|