api-auth 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdc2295825296be5b720b2df6ca984f247a71f549af9f4a8397a68e37e08707e
4
- data.tar.gz: 9171431679afa0ab3bc8ab74a06a0bd14424034b0fb3af4202bfb45458f6b7a0
3
+ metadata.gz: 232d1199b2fd74328e77ba9dd3362789798585b3d88df7c6d4688cf843475190
4
+ data.tar.gz: 879689b7f0b691212e0c14a80e087a041769241221b7a88f094c1003b29cfa9c
5
5
  SHA512:
6
- metadata.gz: e07b3ad4db78a4f12339dc542827b0c43ee4aa3c7c1068f1ee639ca88c67ead6953e4158b6f9950127ab200fff06f7ee66312cc54dd6b3a59810ee1ceeb987b4
7
- data.tar.gz: '051628373d800d5248fa1d9bdd6f3b57ba27ad898199dc84a241be2b551f22468e79facf208ba47141ef2d6591d462bf2f279233d7f8df4d7cef05b179e87da7'
6
+ metadata.gz: 2cb0fbdf6f5984f7334bdfa8a16309837c35b146eab39cd723203cd6861c9ce1e51d66fa2f73a3bb6a9490eaec2af0e3c73b34a03726d26360fc664aa7095f32
7
+ data.tar.gz: 9a1e90785610686db8c1a84943d138f9528dd5ce28965774cfe3112ea74850d898694a7a2bd458ef513f0fd48db56015b8662c53ec78ec38d714080b6f59ed68
@@ -0,0 +1,67 @@
1
+ name: main
2
+ on:
3
+ - push
4
+ - pull_request
5
+ jobs:
6
+ rspec:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: true
10
+ matrix:
11
+ ruby-version:
12
+ - 2.5
13
+ - 2.6
14
+ - 2.7
15
+ - 3.0
16
+ gemfile:
17
+ - rails_52.gemfile
18
+ - rails_60.gemfile
19
+ - rails_61.gemfile
20
+ exclude:
21
+ - ruby-version: [ 2.6, 2.7, 3.0 ]
22
+ gemfile: rails_52.gemfile
23
+ - ruby-version: 3.0
24
+ gemfile: rails_60.gemfile
25
+ steps:
26
+ - name: Install packages required for `curb` gem
27
+ run: |
28
+ sudo apt-get update
29
+ sudo apt-get install -y libcurl4 libcurl3-gnutls libcurl4-openssl-dev
30
+
31
+ - name: Checkout repository
32
+ uses: actions/checkout@v2
33
+
34
+ - name: Install Ruby
35
+ uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby-version }}
38
+ bundler-cache: true
39
+
40
+ - name: Install required gems
41
+ run: BUNDLE_GEMFILE=gemfiles/${{ matrix.gemfile }} bundle install
42
+
43
+ - name: Run rspec tests
44
+ run: BUNDLE_GEMFILE=gemfiles/${{ matrix.gemfile }} bundle exec rspec
45
+
46
+ rubocop:
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - name: Install packages required for `curb` gem
50
+ run: |
51
+ sudo apt-get update
52
+ sudo apt-get install -y libcurl4 libcurl3-gnutls libcurl4-openssl-dev
53
+
54
+ - name: Checkout repository
55
+ uses: actions/checkout@v2
56
+
57
+ - name: Install Ruby
58
+ uses: ruby/setup-ruby@v1
59
+ with:
60
+ ruby-version: 3.0
61
+ bundler-cache: true
62
+
63
+ - name: Install required gems
64
+ run: bundle install
65
+
66
+ - name: Run rubocop
67
+ run: bundle exec rubocop
data/.gitignore CHANGED
@@ -8,4 +8,6 @@
8
8
  /doc
9
9
  /.yardoc
10
10
  gemfiles/*.lock
11
+ gemfiles/.bundle/
11
12
  /.idea
13
+ *.gem
data/.rubocop.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
+ NewCops: enable
4
5
  TargetRubyVersion: 2.5
5
6
 
6
7
  Metrics/AbcSize:
@@ -17,6 +18,7 @@ Metrics/MethodLength:
17
18
  Metrics/BlockLength:
18
19
  Exclude:
19
20
  - 'spec/**/*.rb'
21
+ - 'api_auth.gemspec'
20
22
 
21
23
  Naming/FileName:
22
24
  Exclude:
@@ -24,3 +26,10 @@ Naming/FileName:
24
26
 
25
27
  Style/FrozenStringLiteralComment:
26
28
  Enabled: false
29
+
30
+ Style/StringLiterals:
31
+ Exclude:
32
+ - 'gemfiles/*.gemfile'
33
+
34
+ Lint/DuplicateBranch:
35
+ Enabled: false
data/Appraisals CHANGED
@@ -1,23 +1,17 @@
1
- appraise 'rails-5' do
2
- gem 'actionpack', '~> 5.0.2'
3
- gem 'activeresource', '~> 5.0.2'
4
- gem 'activesupport', '~> 5.0.2'
1
+ appraise 'rails-52' do
2
+ gem 'actionpack', '~> 5.2'
3
+ gem 'activeresource', '~> 5.1'
4
+ gem 'activesupport', '~> 5.2'
5
5
  end
6
6
 
7
- appraise 'rails-42' do
8
- gem 'actionpack', '~> 4.2.0'
9
- gem 'activeresource', '~> 4.0.0'
10
- gem 'activesupport', '~> 4.2.0'
7
+ appraise 'rails-60' do
8
+ gem 'actionpack', '~> 6.0'
9
+ gem 'activeresource', '~> 5.1'
10
+ gem 'activesupport', '~> 6.0'
11
11
  end
12
12
 
13
- appraise 'rails-41' do
14
- gem 'actionpack', '~> 4.1.0'
15
- gem 'activeresource', '~> 4.0.0'
16
- gem 'activesupport', '~> 4.1.0'
17
- end
18
-
19
- appraise 'rails-4' do
20
- gem 'actionpack', '~> 4.0.4'
21
- gem 'activeresource', '~> 4.0.0'
22
- gem 'activesupport', '~> 4.0.4'
13
+ appraise 'rails-61' do
14
+ gem 'actionpack', '~> 6.1'
15
+ gem 'activeresource', '~> 5.1'
16
+ gem 'activesupport', '~> 6.1'
23
17
  end
data/Gemfile CHANGED
@@ -1,4 +1,2 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
-
4
- gem 'rubocop'
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ApiAuth
2
2
 
3
- [![Build Status](https://travis-ci.org/mgomes/api_auth.svg?branch=master)](https://travis-ci.org/mgomes/api_auth)
3
+ [![Build Status](https://github.com/mgomes/api_auth/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/mgomes/api_auth/actions)
4
4
  [![Gem Version](https://badge.fury.io/rb/api-auth.svg)](https://badge.fury.io/rb/api-auth)
5
5
 
6
6
  Logins and passwords are for humans. Communication between applications need to
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.0
1
+ 2.5.1
data/api_auth.gemspec CHANGED
@@ -8,6 +8,11 @@ Gem::Specification.new do |s|
8
8
  s.version = File.read(File.join(File.dirname(__FILE__), 'VERSION'))
9
9
  s.authors = ['Mauricio Gomes']
10
10
  s.email = 'mauricio@edge14.com'
11
+ s.license = 'MIT'
12
+
13
+ s.metadata = {
14
+ 'rubygems_mfa_required' => 'true'
15
+ }
11
16
 
12
17
  s.required_ruby_version = '>= 2.5.0'
13
18
 
@@ -27,6 +32,7 @@ Gem::Specification.new do |s|
27
32
  s.add_development_dependency 'grape', '~> 1.1.0'
28
33
  s.add_development_dependency 'rspec', '~> 3.4'
29
34
  s.add_development_dependency 'rexml'
35
+ s.add_development_dependency 'rubocop'
30
36
 
31
37
  s.files = `git ls-files`.split("\n")
32
38
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,9 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'actionpack', '~> 5.2.1'
6
- gem 'activeresource', '~> 5.1.0'
7
- gem 'activesupport', '~> 5.2.1'
5
+ gem "actionpack", "~> 5.2"
6
+ gem "activeresource", "~> 5.1"
7
+ gem "activesupport", "~> 5.2"
8
8
 
9
- gemspec path: '../'
9
+ gemspec path: "../"
@@ -1,9 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'actionpack', '~> 6.0.0'
6
- gem 'activeresource', '~> 5.1.0'
7
- gem 'activesupport', '~> 6.0.0'
5
+ gem "actionpack", "~> 6.0"
6
+ gem "activeresource", "~> 5.1"
7
+ gem "activesupport", "~> 6.0"
8
8
 
9
- gemspec path: '../'
9
+ gemspec path: "../"
@@ -1,11 +1,9 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'actionpack', '~> 6.1.0'
6
- gem 'activeresource', '~> 5.1.0'
7
- gem 'activesupport', '~> 6.1.0'
5
+ gem "actionpack", "~> 6.1"
6
+ gem "activeresource", "~> 5.1"
7
+ gem "activesupport", "~> 6.1"
8
8
 
9
- gem 'rubocop'
10
-
11
- gemspec path: '../'
9
+ gemspec path: "../"
@@ -48,7 +48,7 @@ module ApiAuth
48
48
  end
49
49
 
50
50
  def content_hash
51
- find_header(%w[X-AUTHORIZATION-CONTENT-SHA256])
51
+ find_header(%w[X-AUTHORIZATION-CONTENT-SHA256 X_AUTHORIZATION_CONTENT_SHA256 HTTP_X_AUTHORIZATION_CONTENT_SHA256])
52
52
  end
53
53
 
54
54
  def original_uri
@@ -4,6 +4,7 @@ if defined?(ActionController::Request)
4
4
 
5
5
  describe ApiAuth::RequestDrivers::ActionControllerRequest do
6
6
  let(:timestamp) { Time.now.utc.httpdate }
7
+ let(:content_sha256) { '47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' }
7
8
 
8
9
  let(:request) do
9
10
  ActionController::Request.new(
@@ -11,7 +12,35 @@ if defined?(ActionController::Request)
11
12
  'PATH_INFO' => '/resource.xml',
12
13
  'QUERY_STRING' => 'foo=bar&bar=foo',
13
14
  'REQUEST_METHOD' => 'PUT',
14
- 'X-Authorization-Content-SHA256' => '47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=',
15
+ 'HTTP_X_AUTHORIZATION_CONTENT_SHA256' => content_sha256,
16
+ 'CONTENT_TYPE' => 'text/plain',
17
+ 'CONTENT_LENGTH' => '11',
18
+ 'HTTP_DATE' => timestamp,
19
+ 'rack.input' => StringIO.new("hello\nworld")
20
+ )
21
+ end
22
+
23
+ let(:request2) do
24
+ ActionController::Request.new(
25
+ 'AUTHORIZATION' => 'APIAuth 1044:12345',
26
+ 'PATH_INFO' => '/resource.xml',
27
+ 'QUERY_STRING' => 'foo=bar&bar=foo',
28
+ 'REQUEST_METHOD' => 'PUT',
29
+ 'X_AUTHORIZATION_CONTENT_SHA256' => content_sha256,
30
+ 'CONTENT_TYPE' => 'text/plain',
31
+ 'CONTENT_LENGTH' => '11',
32
+ 'HTTP_DATE' => timestamp,
33
+ 'rack.input' => StringIO.new("hello\nworld")
34
+ )
35
+ end
36
+
37
+ let(:request3) do
38
+ ActionController::Request.new(
39
+ 'AUTHORIZATION' => 'APIAuth 1044:12345',
40
+ 'PATH_INFO' => '/resource.xml',
41
+ 'QUERY_STRING' => 'foo=bar&bar=foo',
42
+ 'REQUEST_METHOD' => 'PUT',
43
+ 'X-AUTHORIZATION-CONTENT-SHA256' => content_sha256,
15
44
  'CONTENT_TYPE' => 'text/plain',
16
45
  'CONTENT_LENGTH' => '11',
17
46
  'HTTP_DATE' => timestamp,
@@ -27,7 +56,17 @@ if defined?(ActionController::Request)
27
56
  end
28
57
 
29
58
  it 'gets the content_hash' do
30
- expect(driven_request.content_hash).to eq('47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=')
59
+ expect(driven_request.content_hash).to eq(content_sha256)
60
+ end
61
+
62
+ it 'gets the content_hash for request 2' do
63
+ example_request = ApiAuth::RequestDrivers::ActionControllerRequest.new(request2)
64
+ expect(example_request.content_hash).to eq(content_sha256)
65
+ end
66
+
67
+ it 'gets the content_hash for request 3' do
68
+ example_request = ApiAuth::RequestDrivers::ActionControllerRequest.new(request3)
69
+ expect(example_request.content_hash).to eq(content_sha256)
31
70
  end
32
71
 
33
72
  it 'gets the request_uri' do
@@ -50,7 +89,7 @@ if defined?(ActionController::Request)
50
89
  it 'treats no body as empty string' do
51
90
  request.env['rack.input'] = StringIO.new
52
91
  request.env['CONTENT_LENGTH'] = 0
53
- expect(driven_request.calculated_hash).to eq('47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=')
92
+ expect(driven_request.calculated_hash).to eq(content_sha256)
54
93
  end
55
94
  end
56
95
 
@@ -4,6 +4,7 @@ if defined?(ActionDispatch::Request)
4
4
 
5
5
  describe ApiAuth::RequestDrivers::ActionDispatchRequest do
6
6
  let(:timestamp) { Time.now.utc.httpdate }
7
+ let(:content_sha256) { '47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' }
7
8
 
8
9
  let(:request) do
9
10
  ActionDispatch::Request.new(
@@ -11,7 +12,35 @@ if defined?(ActionDispatch::Request)
11
12
  'PATH_INFO' => '/resource.xml',
12
13
  'QUERY_STRING' => 'foo=bar&bar=foo',
13
14
  'REQUEST_METHOD' => 'PUT',
14
- 'X-Authorization-Content-SHA256' => '47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=',
15
+ 'HTTP_X_AUTHORIZATION_CONTENT_SHA256' => content_sha256,
16
+ 'CONTENT_TYPE' => 'text/plain',
17
+ 'CONTENT_LENGTH' => '11',
18
+ 'HTTP_DATE' => timestamp,
19
+ 'rack.input' => StringIO.new("hello\nworld")
20
+ )
21
+ end
22
+
23
+ let(:request2) do
24
+ ActionDispatch::Request.new(
25
+ 'AUTHORIZATION' => 'APIAuth 1044:12345',
26
+ 'PATH_INFO' => '/resource.xml',
27
+ 'QUERY_STRING' => 'foo=bar&bar=foo',
28
+ 'REQUEST_METHOD' => 'PUT',
29
+ 'X_AUTHORIZATION_CONTENT_SHA256' => content_sha256,
30
+ 'CONTENT_TYPE' => 'text/plain',
31
+ 'CONTENT_LENGTH' => '11',
32
+ 'HTTP_DATE' => timestamp,
33
+ 'rack.input' => StringIO.new("hello\nworld")
34
+ )
35
+ end
36
+
37
+ let(:request3) do
38
+ ActionDispatch::Request.new(
39
+ 'AUTHORIZATION' => 'APIAuth 1044:12345',
40
+ 'PATH_INFO' => '/resource.xml',
41
+ 'QUERY_STRING' => 'foo=bar&bar=foo',
42
+ 'REQUEST_METHOD' => 'PUT',
43
+ 'X-AUTHORIZATION-CONTENT-SHA256' => content_sha256,
15
44
  'CONTENT_TYPE' => 'text/plain',
16
45
  'CONTENT_LENGTH' => '11',
17
46
  'HTTP_DATE' => timestamp,
@@ -27,7 +56,17 @@ if defined?(ActionDispatch::Request)
27
56
  end
28
57
 
29
58
  it 'gets the content_hash' do
30
- expect(driven_request.content_hash).to eq('47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=')
59
+ expect(driven_request.content_hash).to eq(content_sha256)
60
+ end
61
+
62
+ it 'gets the content_hash for request 2' do
63
+ example_request = ApiAuth::RequestDrivers::ActionDispatchRequest.new(request2)
64
+ expect(example_request.content_hash).to eq(content_sha256)
65
+ end
66
+
67
+ it 'gets the content_hash for request 3' do
68
+ example_request = ApiAuth::RequestDrivers::ActionDispatchRequest.new(request3)
69
+ expect(example_request.content_hash).to eq(content_sha256)
31
70
  end
32
71
 
33
72
  it 'gets the request_uri' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauricio Gomes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-11 00:00:00.000000000 Z
11
+ date: 2021-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -246,6 +246,20 @@ dependencies:
246
246
  - - ">="
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
+ - !ruby/object:Gem::Dependency
250
+ name: rubocop
251
+ requirement: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - ">="
254
+ - !ruby/object:Gem::Version
255
+ version: '0'
256
+ type: :development
257
+ prerelease: false
258
+ version_requirements: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - ">="
261
+ - !ruby/object:Gem::Version
262
+ version: '0'
249
263
  description: Full HMAC auth implementation for use in your gems and Rails apps.
250
264
  email: mauricio@edge14.com
251
265
  executables: []
@@ -253,11 +267,11 @@ extensions: []
253
267
  extra_rdoc_files: []
254
268
  files:
255
269
  - ".document"
270
+ - ".github/workflows/main.yml"
256
271
  - ".gitignore"
257
272
  - ".rspec"
258
273
  - ".rubocop.yml"
259
274
  - ".rubocop_todo.yml"
260
- - ".travis.yml"
261
275
  - Appraisals
262
276
  - CHANGELOG.md
263
277
  - Gemfile
@@ -266,7 +280,6 @@ files:
266
280
  - Rakefile
267
281
  - VERSION
268
282
  - api_auth.gemspec
269
- - gemfiles/http4.gemfile
270
283
  - gemfiles/rails_52.gemfile
271
284
  - gemfiles/rails_60.gemfile
272
285
  - gemfiles/rails_61.gemfile
@@ -304,8 +317,10 @@ files:
304
317
  - spec/request_drivers/rest_client_spec.rb
305
318
  - spec/spec_helper.rb
306
319
  homepage: https://github.com/mgomes/api_auth
307
- licenses: []
308
- metadata: {}
320
+ licenses:
321
+ - MIT
322
+ metadata:
323
+ rubygems_mfa_required: 'true'
309
324
  post_install_message:
310
325
  rdoc_options: []
311
326
  require_paths:
@@ -321,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
336
  - !ruby/object:Gem::Version
322
337
  version: '0'
323
338
  requirements: []
324
- rubygems_version: 3.1.4
339
+ rubygems_version: 3.1.6
325
340
  signing_key:
326
341
  specification_version: 4
327
342
  summary: Simple HMAC authentication for your APIs
data/.travis.yml DELETED
@@ -1,30 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
- rvm:
5
- - 2.5.3
6
- - 2.6.1
7
- - 2.7.1
8
- - 3.0.0
9
- gemfile:
10
- - gemfiles/rails_52.gemfile
11
- - gemfiles/rails_60.gemfile
12
- - gemfiles/rails_61.gemfile
13
- - gemfiles/http4.gemfile
14
- env:
15
- - TEST_SUITE=rake
16
-
17
- before_install:
18
- - gem update bundler
19
-
20
- script:
21
- - bundle exec $TEST_SUITE
22
-
23
- matrix:
24
- include:
25
- - rvm: 3.0.0
26
- gemfile: gemfiles/rails_61.gemfile
27
- env: TEST_SUITE="rubocop lib/ spec/"
28
-
29
- notifications:
30
- email: false
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'http', '~> 4.0'
6
-
7
- gemspec path: '../'