rack-bearer_auth 0.1.1 → 1.0.0

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: 0565a4941f4f03c29d78b554a5e76efcce960817aba7dcb2f0c5847852e54581
4
- data.tar.gz: 42e1559aaf10510f8e894553594a40005283542d8e8c25dbdc3fddc9abb79874
3
+ metadata.gz: ec90e820596fcb27adc4b3c9e792bd520c4da51379e45100c2fbcbdd7e3b4a82
4
+ data.tar.gz: bc11452c3942896a487eca62efb5f38955304822faf48224685f3ecab1619f4b
5
5
  SHA512:
6
- metadata.gz: 738150271acbe8f82bddf0fe4aa257a03df761c6935a2a2bb2ecd4d5f3c4e6b26e8dc773d1223ab4b14c7858500c6d37da3c71c41094dde48d5df053d03cf318
7
- data.tar.gz: a7a7ea1270a0629d8b244efa483cf1b87b18c86cb743271b2deceb4787b029509bf234eade753cdce9529e7412039a07b61eb1b2e777c6beb7ad80e05f325a0d
6
+ metadata.gz: a62833393242870697f5149130c0dad4b73a9b8e17e810d20e9afe80342177c41603274555e54284b98c92fcc24f8a1f9b5993043fb06dfa1b673ff8f50293e7
7
+ data.tar.gz: b54b9ce933ea5cfb526b1a61cf6ac8dbf152ea9732974c0e7b8ad0038eab935bb6c1156c7aff02311b2c4c724a23181446984f7893643332b0ea9fc00314e1ec
@@ -18,6 +18,14 @@ Layout/EndOfLine:
18
18
  Enabled: true
19
19
  EnforcedStyle: lf
20
20
 
21
+ Layout/AlignHash:
22
+ EnforcedColonStyle: table
23
+ EnforcedHashRocketStyle: table
24
+
21
25
  Metrics/BlockLength:
22
26
  Exclude:
23
27
  - spec/**/*
28
+
29
+ Metrics/LineLength:
30
+ Max: 128
31
+ IgnoreCopDirectives: true
@@ -1,9 +1,9 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.7
5
- - 2.4.4
6
- - 2.5.1
7
- before_install: gem install bundler -v 1.16.1
4
+ - 2.3.8
5
+ - 2.4.5
6
+ - 2.5.5
7
+ - 2.6.2
8
8
  script:
9
9
  - bundle exec rake spec
@@ -1,8 +1,25 @@
1
1
  ## Unreleased
2
2
 
3
3
 
4
+ ## 1.0.0 (2019-04-08)
5
+
6
+ ### Changes
7
+
8
+ * Add support Ruby 2.6
9
+
10
+ ### Misc
11
+
12
+ * Change required rubocop version
13
+ * Fix rubocop offenses
14
+ * Fix file modes
15
+ * Relax bundler version
16
+ * Add examples
17
+
18
+
4
19
  ## 0.1.1 (2018-05-24)
5
20
 
21
+ ### Bug fixes
22
+
6
23
  * Fix warnings on unmatched routes
7
24
 
8
25
 
data/README.md CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
24
24
 
25
25
  ## Configuration
26
26
 
27
- ### Rsils configuration
27
+ ### Rails configuration
28
28
 
29
29
  ``` ruby
30
30
  module YourApp
@@ -32,13 +32,15 @@ module YourApp
32
32
 
33
33
  # ...
34
34
 
35
- config.middleware.use, Rack::BearerAuth::Middleware do
35
+ config.middleware.use Rack::BearerAuth::Middleware do
36
36
  match path: "/foo" do |token|
37
37
  # validate token
38
+ # AccessToken.where(token: token).exists?
38
39
  end
39
40
 
40
41
  match via: :all do |token|
41
42
  # validate token
43
+ # AccessToken.where(token: token).exists?
42
44
  end
43
45
 
44
46
  match path: "/bar", via: %i[post patch delete], token: "some_token"
@@ -53,10 +55,12 @@ end
53
55
  use Rack::BearerAuth::Middleware do
54
56
  match path: "/foo" do |token|
55
57
  # validate token
58
+ # AccessToken.where(token: token).exists?
56
59
  end
57
60
 
58
61
  match via: :all do |token|
59
62
  # validate token
63
+ # AccessToken.where(token: token).exists?
60
64
  end
61
65
 
62
66
  match path: "/bar", via: %i[post patch delete], token: "some_token"
@@ -16,6 +16,7 @@ module Rack
16
16
  def match(req)
17
17
  return :skip unless match_route?(req)
18
18
  return :token_required unless req.token
19
+
19
20
  token.match?(req.token) ? :ok : :invalid_token
20
21
  end
21
22
 
@@ -52,7 +53,7 @@ module Rack
52
53
 
53
54
  private
54
55
 
55
- def _match?(path_pattern, path_value)
56
+ def _match?(path_pattern, path_value) # rubocop:disable Metrics/MethodLength
56
57
  case path_pattern
57
58
  when nil
58
59
  true
@@ -77,7 +78,7 @@ module Rack
77
78
 
78
79
  private
79
80
 
80
- def _match?(via_pattern, via_value)
81
+ def _match?(via_pattern, via_value) # rubocop:disable Metrics/MethodLength
81
82
  case via_pattern
82
83
  when nil, :all
83
84
  true
@@ -102,7 +103,7 @@ module Rack
102
103
 
103
104
  private
104
105
 
105
- def _match?(token_pattern, token_value)
106
+ def _match?(token_pattern, token_value) # rubocop:disable Metrics/MethodLength
106
107
  case token_pattern
107
108
  when String
108
109
  token_pattern == token_value
@@ -32,7 +32,7 @@ module Rack
32
32
 
33
33
  private
34
34
 
35
- def handle(req)
35
+ def handle(req) # rubocop:disable Metrics/MethodLength
36
36
  @match_patterns.each do |pattern|
37
37
  case pattern.match(req)
38
38
  when :skip
@@ -7,7 +7,7 @@ module Rack
7
7
  # b64token = 1*( ALPHA / DIGIT /
8
8
  # "-" / "." / "_" / "~" / "+" / "/" ) *"="
9
9
  # credentials = "Bearer" 1*SP b64token
10
- BEARER_TOKEN_REGEXP = %r{\ABearer +([A-Za-z0-9\-._~+/]+=*)\z}
10
+ BEARER_TOKEN_REGEXP = %r{\ABearer +([A-Za-z0-9\-._~+/]+=*)\z}.freeze
11
11
 
12
12
  attr_reader :path, :via, :token
13
13
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  module BearerAuth
5
- VERSION = "0.1.1"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.required_ruby_version = ">= 2.3.0"
26
26
 
27
- spec.add_development_dependency "bundler", "~> 1.16"
27
+ spec.add_development_dependency "bundler", ">= 1.16"
28
28
  spec.add_development_dependency "pry", ">= 0.10.0"
29
29
  spec.add_development_dependency "pry-byebug", ">= 3.6.0"
30
30
  spec.add_development_dependency "rack-test", "~> 1.0.0"
31
31
  spec.add_development_dependency "rake", "~> 10.0"
32
32
  spec.add_development_dependency "rspec", "~> 3.0"
33
- spec.add_development_dependency "rubocop", ">= 0.51.0"
33
+ spec.add_development_dependency "rubocop", ">= 0.61.1"
34
34
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-bearer_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Hanamura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-24 00:00:00.000000000 Z
11
+ date: 2019-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.16'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.16'
27
27
  - !ruby/object:Gem::Dependency
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.51.0
103
+ version: 0.61.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.51.0
110
+ version: 0.61.1
111
111
  description: Middleware for using RFC 6750 bearer auth in Rack apps
112
112
  email:
113
113
  - yuji.developer@gmail.com
@@ -152,8 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []
155
- rubyforge_project:
156
- rubygems_version: 2.7.6
155
+ rubygems_version: 3.0.3
157
156
  signing_key:
158
157
  specification_version: 4
159
158
  summary: Middleware for using RFC 6750 bearer auth in Rack apps