rack-oauth2 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rack/oauth2/server/resource/bearer.rb +2 -2
- data/spec/rack/oauth2/server/resource/bearer_spec.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20418667bda9c0f30843d9c378f39d99daa1791f
|
4
|
+
data.tar.gz: 33594f1506cd93c3e47e113bd0201360cc811509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0f8f9efc3a36d4159f357b32a65f340c54892424713eb8a42dea00b278b22237dbd7d2ed4b36061d2b969265c3ced0ef2d9bcfa913fa3af9130380f66a7c627
|
7
|
+
data.tar.gz: 7971e3390e47f863cb676a09a1d1897fb8ae2a28a68587dca2bff279746b50b1ded7a71c641b9854a0ca61a0e7e8178720f1312d4e6c85ffdcaf7db6d83ba741
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
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.
|
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-
|
11
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|