rack-oauth2 0.12.2 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-oauth2 (0.11.0)
4
+ rack-oauth2 (0.12.2)
5
5
  activesupport (>= 2.3)
6
6
  attr_required (>= 0.0.3)
7
7
  httpclient (>= 2.2.0.2)
@@ -31,7 +31,6 @@ GEM
31
31
  jruby-openssl (0.7.5)
32
32
  bouncy-castle-java (>= 1.5.0146.1)
33
33
  json (1.6.5)
34
- json (1.6.5-java)
35
34
  multi_json (1.0.4)
36
35
  rack (1.4.1)
37
36
  rake (0.9.2.2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.2
1
+ 0.13.0
@@ -14,8 +14,8 @@ module Rack
14
14
 
15
15
  def call(env)
16
16
  if request.oauth2?
17
- authenticate! request.setup!
18
- env[ACCESS_TOKEN] = request.access_token
17
+ access_token = authenticate! request.setup!
18
+ env[ACCESS_TOKEN] = access_token
19
19
  end
20
20
  @app.call(env)
21
21
  rescue Rack::OAuth2::Server::Abstract::Error => e
@@ -5,7 +5,7 @@ describe Rack::OAuth2::Server::Resource::Bearer do
5
5
  Rack::OAuth2::Server::Resource::Bearer.new(simple_app) do |request|
6
6
  case request.access_token
7
7
  when 'valid_token'
8
- # nothing to do
8
+ bearer_token
9
9
  when 'insufficient_scope_token'
10
10
  request.insufficient_scope!
11
11
  else
@@ -13,6 +13,9 @@ describe Rack::OAuth2::Server::Resource::Bearer do
13
13
  end
14
14
  end
15
15
  end
16
+ let(:bearer_token) do
17
+ Rack::OAuth2::AccessToken::Bearer.new(:access_token => 'valid_token')
18
+ end
16
19
  let(:access_token) { env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN] }
17
20
  let(:request) { app.call(env) }
18
21
  subject { app.call(env) }
@@ -21,7 +24,7 @@ describe Rack::OAuth2::Server::Resource::Bearer do
21
24
  it 'should be authenticated' do
22
25
  status, header, response = request
23
26
  status.should == 200
24
- access_token.should == 'valid_token'
27
+ access_token.should == bearer_token
25
28
  end
26
29
  end
27
30
  shared_examples_for :unauthorized_bearer_request do
@@ -5,11 +5,9 @@ describe Rack::OAuth2::Server::Resource::MAC do
5
5
  Rack::OAuth2::Server::Resource::MAC.new(simple_app) do |request|
6
6
  case request.access_token
7
7
  when 'valid_token'
8
- Rack::OAuth2::AccessToken::MAC.new(
9
- :access_token => 'valid_token',
10
- :mac_key => 'secret',
11
- :mac_algorithm => 'hmac-sha-256'
12
- ).verify!(request)
8
+ token = mac_token
9
+ token.verify!(request)
10
+ token
13
11
  when 'insufficient_scope_token'
14
12
  request.insufficient_scope!
15
13
  else
@@ -17,6 +15,13 @@ describe Rack::OAuth2::Server::Resource::MAC do
17
15
  end
18
16
  end
19
17
  end
18
+ let(:mac_token) do
19
+ Rack::OAuth2::AccessToken::MAC.new(
20
+ :access_token => 'valid_token',
21
+ :mac_key => 'secret',
22
+ :mac_algorithm => 'hmac-sha-256'
23
+ )
24
+ end
20
25
  let(:access_token) { env[Rack::OAuth2::Server::Resource::ACCESS_TOKEN] }
21
26
  let(:request) { app.call(env) }
22
27
  subject { app.call(env) }
@@ -32,7 +37,7 @@ describe Rack::OAuth2::Server::Resource::MAC do
32
37
  it 'should be authenticated' do
33
38
  status, header, response = request
34
39
  status.should == 200
35
- access_token.should == 'valid_token'
40
+ access_token.should == mac_token
36
41
  end
37
42
  end
38
43
  shared_examples_for :unauthorized_mac_request do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.13.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70240383423520 !ruby/object:Gem::Requirement
16
+ requirement: &70115895469580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70240383423520
24
+ version_requirements: *70115895469580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70240383422440 !ruby/object:Gem::Requirement
27
+ requirement: &70115895468640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.4.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70240383422440
35
+ version_requirements: *70115895468640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: httpclient
38
- requirement: &70240383421700 !ruby/object:Gem::Requirement
38
+ requirement: &70115895467660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.2.0.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70240383421700
46
+ version_requirements: *70115895467660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activesupport
49
- requirement: &70240383420980 !ruby/object:Gem::Requirement
49
+ requirement: &70115895466860 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.3'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70240383420980
57
+ version_requirements: *70115895466860
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: i18n
60
- requirement: &70240383412240 !ruby/object:Gem::Requirement
60
+ requirement: &70115895466100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70240383412240
68
+ version_requirements: *70115895466100
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: attr_required
71
- requirement: &70240383411180 !ruby/object:Gem::Requirement
71
+ requirement: &70115895465300 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.0.3
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70240383411180
79
+ version_requirements: *70115895465300
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rake
82
- requirement: &70240383410500 !ruby/object:Gem::Requirement
82
+ requirement: &70115895450420 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0.8'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70240383410500
90
+ version_requirements: *70115895450420
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: cover_me
93
- requirement: &70240383409100 !ruby/object:Gem::Requirement
93
+ requirement: &70115895449520 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 1.2.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70240383409100
101
+ version_requirements: *70115895449520
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rspec
104
- requirement: &70240383408040 !ruby/object:Gem::Requirement
104
+ requirement: &70115895448460 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '2'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70240383408040
112
+ version_requirements: *70115895448460
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: webmock
115
- requirement: &70240383406920 !ruby/object:Gem::Requirement
115
+ requirement: &70115895447420 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: 1.6.2
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70240383406920
123
+ version_requirements: *70115895447420
124
124
  description: OAuth 2.0 Server & Client Library. Both Bearer and MAC token type are
125
125
  supported.
126
126
  email: nov@matake.jp