rack-oauth2 1.0.6 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4f8ab7573542af30fbe99bfd06a10c441bfd525
4
- data.tar.gz: 842c686858c196d10450911d8dfc6122f765914a
3
+ metadata.gz: 20418667bda9c0f30843d9c378f39d99daa1791f
4
+ data.tar.gz: 33594f1506cd93c3e47e113bd0201360cc811509
5
5
  SHA512:
6
- metadata.gz: bca0b37a82253f9246926bd47438580da3f006d06280e3a211dab8c446737fe147c9d4906c09a5df28b331006c2c89adc692ba66ac17984405e606d42317f2db
7
- data.tar.gz: 3a0ce7a0ae2b2fd0d8e152e011fa5d054b304293f5674c5ffc3e64224639648658d8cb1851d06e39f0188c3c694df1b1cf6ec52fa7eb8c728d523ddd76bf453c
6
+ metadata.gz: f0f8f9efc3a36d4159f357b32a65f340c54892424713eb8a42dea00b278b22237dbd7d2ed4b36061d2b969265c3ced0ef2d9bcfa913fa3af9130380f66a7c627
7
+ data.tar.gz: 7971e3390e47f863cb676a09a1d1897fb8ae2a28a68587dca2bff279746b50b1ded7a71c641b9854a0ca61a0e7e8178720f1312d4e6c85ffdcaf7db6d83ba741
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.6
1
+ 1.0.7
@@ -27,7 +27,7 @@ module Rack
27
27
  end
28
28
 
29
29
  def access_token_in_header
30
- if @auth_header.provided? && @auth_header.scheme.to_s == 'bearer'
30
+ if @auth_header.provided? && !@auth_header.parts.first.nil? && @auth_header.scheme.to_s == 'bearer'
31
31
  @auth_header.params
32
32
  else
33
33
  nil
@@ -44,4 +44,4 @@ module Rack
44
44
  end
45
45
  end
46
46
 
47
- require 'rack/oauth2/server/resource/bearer/error'
47
+ require 'rack/oauth2/server/resource/bearer/error'
@@ -42,9 +42,7 @@ describe Rack::OAuth2::Server::Resource::Bearer do
42
42
  access_token.should be_nil
43
43
  end
44
44
  end
45
-
46
- context 'when no access token is given' do
47
- let(:env) { Rack::MockRequest.env_for('/protected_resource') }
45
+ shared_examples_for :skipped_authentication_request do
48
46
  it 'should skip OAuth 2.0 authentication' do
49
47
  status, header, response = request
50
48
  status.should == 200
@@ -52,6 +50,11 @@ describe Rack::OAuth2::Server::Resource::Bearer do
52
50
  end
53
51
  end
54
52
 
53
+ context 'when no access token is given' do
54
+ let(:env) { Rack::MockRequest.env_for('/protected_resource') }
55
+ it_behaves_like :skipped_authentication_request
56
+ end
57
+
55
58
  context 'when valid_token is given' do
56
59
  context 'when token is in Authorization header' do
57
60
  let(:env) { Rack::MockRequest.env_for('/protected_resource', 'HTTP_AUTHORIZATION' => 'Bearer valid_token') }
@@ -64,6 +67,11 @@ describe Rack::OAuth2::Server::Resource::Bearer do
64
67
  end
65
68
  end
66
69
 
70
+ context 'when invalid authorization header is given' do
71
+ let(:env) { Rack::MockRequest.env_for('/protected_resource', 'HTTP_AUTHORIZATION' => '') }
72
+ it_behaves_like :skipped_authentication_request
73
+ end
74
+
67
75
  context 'when invalid_token is given' do
68
76
  let(:env) { Rack::MockRequest.env_for('/protected_resource', 'HTTP_AUTHORIZATION' => 'Bearer invalid_token') }
69
77
 
@@ -112,4 +120,4 @@ describe Rack::OAuth2::Server::Resource::Bearer do
112
120
  it_behaves_like :bad_bearer_request
113
121
  end
114
122
  end
115
- end
123
+ 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.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-14 00:00:00.000000000 Z
11
+ date: 2013-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack