rack-oauth2 1.5.1 → 1.6.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
  SHA1:
3
- metadata.gz: f7dc18ee59e4655ffd7c657d472589b37fccdaa7
4
- data.tar.gz: 66cfadb5aba72e7d2bb57f21809a46b511b70695
3
+ metadata.gz: ec6f0bedd0aa554054e352cc7744ffeb8307c85a
4
+ data.tar.gz: 622e2e5431e43e8ccdf6c5c9a9195ed8973e0dff
5
5
  SHA512:
6
- metadata.gz: c1556152941722c0e600c15060341c6bcf3e9208b9d8041f6e157ce2fa4b22dafa5d5caa5fff04c39b7d1db57f8e8b1655d89a89005b5782170d7ad0a23f2630
7
- data.tar.gz: 5d4db8de2edf61ba0c01c4c7305c17da3866ae27d7c71825ad14996067ca3ce040f57c0c2033620339920f671d3ab169962eabd0c4cd8b8467be203805a3a529
6
+ metadata.gz: 10d2202a012472eb86e342177748dacbdd84e9a691b74566b55f4e1de8d39bc4b753d017833948825d82d6488fa7040546750de849b632410a742c266faf0988
7
+ data.tar.gz: 9d88f10022b6b94227e4a6ca3ce7a1b422cd0437d9a55c83f5b14435694909b84e3bd0ffd2f6dd61de93b83642d4cac99e3de6050f6f8ed48948199e176c5cb2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.1
1
+ 1.6.0
@@ -10,6 +10,14 @@ module Rack
10
10
  end
11
11
 
12
12
  def call(env)
13
+ # NOTE:
14
+ # Rack middleware is initialized only on the first request of the process.
15
+ # So any instance variables are acts like class variables, and modifying them in call() isn't thread-safe.
16
+ # ref.) http://stackoverflow.com/questions/23028226/rack-middleware-and-thread-safety
17
+ dup._call(env)
18
+ end
19
+
20
+ def _call(env)
13
21
  @authenticator.call(@request, @response) if @authenticator
14
22
  @response
15
23
  end
@@ -2,7 +2,7 @@ module Rack
2
2
  module OAuth2
3
3
  module Server
4
4
  class Authorize < Abstract::Handler
5
- def call(env)
5
+ def _call(env)
6
6
  request = Request.new(env)
7
7
  response_type_for(request).new(&@authenticator).call(env).finish
8
8
  rescue Rack::OAuth2::Server::Abstract::Error => e
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Authorize
5
5
  class Code < Abstract::Handler
6
- def call(env)
6
+ def _call(env)
7
7
  @request = Request.new env
8
8
  @response = Response.new request
9
9
  super
@@ -10,7 +10,7 @@ module Rack
10
10
  end
11
11
  end
12
12
 
13
- def call(env)
13
+ def _call(env)
14
14
  @request = Request.new env
15
15
  @response = Response.new request
16
16
  super
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Authorize
5
5
  class Token < Abstract::Handler
6
- def call(env)
6
+ def _call(env)
7
7
  @request = Request.new env
8
8
  @response = Response.new request
9
9
  super
@@ -8,7 +8,7 @@ module Rack
8
8
  @app = app
9
9
  end
10
10
 
11
- def call(env)
11
+ def _call(env)
12
12
  prepare_oauth_env env
13
13
  @app.call env
14
14
  rescue Rack::OAuth2::Server::Abstract::Error => e
@@ -12,7 +12,7 @@ module Rack
12
12
  super(&authenticator)
13
13
  end
14
14
 
15
- def call(env)
15
+ def _call(env)
16
16
  if request.oauth2?
17
17
  access_token = authenticate! request.setup!
18
18
  env[ACCESS_TOKEN] = access_token
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Resource
5
5
  class Bearer < Resource
6
- def call(env)
6
+ def _call(env)
7
7
  self.request = Request.new(env)
8
8
  super
9
9
  end
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Resource
5
5
  class MAC < Resource
6
- def call(env)
6
+ def _call(env)
7
7
  self.request = Request.new(env)
8
8
  super
9
9
  end
@@ -4,7 +4,7 @@ module Rack
4
4
  module OAuth2
5
5
  module Server
6
6
  class Token < Abstract::Handler
7
- def call(env)
7
+ def _call(env)
8
8
  request = Request.new(env)
9
9
  grant_type_for(request).new(&@authenticator).call(env).finish
10
10
  rescue Rack::OAuth2::Server::Abstract::Error => e
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Token
5
5
  class AuthorizationCode < Abstract::Handler
6
- def call(env)
6
+ def _call(env)
7
7
  @request = Request.new(env)
8
8
  @response = Response.new(request)
9
9
  super
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Token
5
5
  class ClientCredentials < Abstract::Handler
6
- def call(env)
6
+ def _call(env)
7
7
  @request = Request.new(env)
8
8
  @response = Response.new(request)
9
9
  super
@@ -12,7 +12,7 @@ module Rack
12
12
  end
13
13
  end
14
14
 
15
- def call(env)
15
+ def _call(env)
16
16
  @request = Request.new env
17
17
  @response = Response.new request
18
18
  super
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Token
5
5
  class JWTBearer < Abstract::Handler
6
- def call(env)
6
+ def _call(env)
7
7
  @request = Request.new env
8
8
  @response = Response.new request
9
9
  super
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Token
5
5
  class Password < Abstract::Handler
6
- def call(env)
6
+ def _call(env)
7
7
  @request = Request.new(env)
8
8
  @response = Response.new(request)
9
9
  super
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Token
5
5
  class RefreshToken < Abstract::Handler
6
- def call(env)
6
+ def _call(env)
7
7
  @request = Request.new(env)
8
8
  @response = Response.new(request)
9
9
  super
@@ -3,7 +3,7 @@ module Rack
3
3
  module Server
4
4
  class Token
5
5
  class SAML2Bearer < Abstract::Handler
6
- def call(env)
6
+ def _call(env)
7
7
  @request = Request.new env
8
8
  @response = Response.new request
9
9
  super
@@ -13,6 +13,6 @@ describe Rack::OAuth2::Client::Error do
13
13
  end
14
14
 
15
15
  its(:status) { should == 400 }
16
- its(:message) { should == error[:error_description] }
16
+ its(:message) { should == [error[:error], error[:error_description]].join(' :: ') }
17
17
  its(:response) { should == error }
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-18 00:00:00.000000000 Z
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack