rack-oauth2 1.0.0 → 1.0.1

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-oauth2 (0.14.8)
4
+ rack-oauth2 (1.0.1)
5
5
  activesupport (>= 2.3)
6
6
  attr_required (>= 0.0.5)
7
7
  httpclient (>= 2.2.0.2)
@@ -12,7 +12,7 @@ PATH
12
12
  GEM
13
13
  remote: http://rubygems.org/
14
14
  specs:
15
- activesupport (3.2.8)
15
+ activesupport (3.2.11)
16
16
  i18n (~> 0.6)
17
17
  multi_json (~> 1.0)
18
18
  addressable (2.3.2)
@@ -23,25 +23,25 @@ GEM
23
23
  cover_me (1.2.0)
24
24
  configatron
25
25
  hashie
26
- crack (0.3.1)
26
+ crack (0.3.2)
27
27
  diff-lcs (1.1.3)
28
28
  hashie (1.2.0)
29
- httpclient (2.2.7)
30
- i18n (0.6.0)
31
- jruby-openssl (0.7.7)
29
+ httpclient (2.3.2)
30
+ i18n (0.6.1)
31
+ jruby-openssl (0.8.2)
32
32
  bouncy-castle-java (>= 1.5.0146.1)
33
- multi_json (1.3.6)
34
- rack (1.4.1)
35
- rake (0.9.2.2)
36
- rspec (2.11.0)
37
- rspec-core (~> 2.11.0)
38
- rspec-expectations (~> 2.11.0)
39
- rspec-mocks (~> 2.11.0)
40
- rspec-core (2.11.1)
41
- rspec-expectations (2.11.2)
33
+ multi_json (1.5.0)
34
+ rack (1.5.1)
35
+ rake (10.0.3)
36
+ rspec (2.12.0)
37
+ rspec-core (~> 2.12.0)
38
+ rspec-expectations (~> 2.12.0)
39
+ rspec-mocks (~> 2.12.0)
40
+ rspec-core (2.12.2)
41
+ rspec-expectations (2.12.1)
42
42
  diff-lcs (~> 1.1.3)
43
- rspec-mocks (2.11.2)
44
- webmock (1.8.9)
43
+ rspec-mocks (2.12.1)
44
+ webmock (1.9.0)
45
45
  addressable (>= 2.2.7)
46
46
  crack (>= 0.1.7)
47
47
  yamler (0.1.0)
data/README.rdoc CHANGED
@@ -3,14 +3,17 @@
3
3
  OAuth 2.0 Server & Client Library.
4
4
  Both Bearer and MAC token type are supported.
5
5
 
6
- The OAuth 2.0 Authorization Protocol (draft 18)
7
- http://tools.ietf.org/html/draft-ietf-oauth-v2-18
6
+ {<img src="https://secure.travis-ci.org/nov/rack-oauth2.png" />}[http://travis-ci.org/nov/rack-oauth2]
7
+ {<img src="http://www.pledgie.com/campaigns/19044.png?skin_name=chrome" />}[http://www.pledgie.com/campaigns/19044]
8
8
 
9
- The OAuth 2.0 Protocol: Bearer Tokens (draft 06)
9
+ The OAuth 2.0 Authorization Framework (RFC 6749)
10
+ http://www.rfc-editor.org/rfc/rfc6749.txt
11
+
12
+ The OAuth 2.0 Authorization Framework: Bearer Token Usage (RFC 6750)
10
13
  http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-06
11
14
 
12
15
  HTTP Authentication: MAC Access Authentication (draft 01)
13
- http://www.ietf.org/id/draft-ietf-oauth-v2-http-mac-01.txt
16
+ http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01
14
17
 
15
18
  == Installation
16
19
 
@@ -62,7 +65,7 @@ Resource Request (request both for resource owner resource and for client resour
62
65
  https://gist.github.com/933885
63
66
 
64
67
  == Note on Patches/Pull Requests
65
-
68
+
66
69
  * Fork the project.
67
70
  * Make your feature addition or bug fix.
68
71
  * Add tests for it. This is important so I don't break it in a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -4,7 +4,10 @@ module Rack
4
4
  class Legacy < AccessToken
5
5
  def initialize(attributes = {})
6
6
  super
7
- self.expires_in = self.expires_in.try(:to_i)
7
+ self.expires_in = (
8
+ self.expires_in ||
9
+ attributes[:expires]
10
+ ).try(:to_i)
8
11
  end
9
12
 
10
13
  def to_s # This is for fb_graph
@@ -6,7 +6,7 @@ module Rack
6
6
  # request:: HTTP::Message
7
7
  def filter_request(request)
8
8
  started = "======= [Rack::OAuth2] HTTP REQUEST STARTED ======="
9
- OAuth2.logger.info [started, request.dump].join("\n")
9
+ log started, request.dump
10
10
  end
11
11
 
12
12
  # Callback called in HTTPClient (after received a response)
@@ -14,7 +14,15 @@ module Rack
14
14
  # response:: HTTP::Message
15
15
  def filter_response(request, response)
16
16
  finished = "======= [Rack::OAuth2] HTTP REQUEST FINISHED ======="
17
- OAuth2.logger.info ['-' * 50, response.dump, finished].join("\n")
17
+ log '-' * 50, response.dump, finished
18
+ end
19
+
20
+ private
21
+
22
+ def log(*outputs)
23
+ outputs.each do |output|
24
+ OAuth2.logger.info output
25
+ end
18
26
  end
19
27
  end
20
28
  end
@@ -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 == :bearer
30
+ if @auth_header.provided? && @auth_header.scheme.to_s == 'bearer'
31
31
  @auth_header.params
32
32
  else
33
33
  nil
@@ -24,7 +24,7 @@ module Rack
24
24
  end
25
25
 
26
26
  def oauth2?
27
- @auth_header.provided? && @auth_header.scheme == :mac
27
+ @auth_header.provided? && @auth_header.scheme.to_s == 'mac'
28
28
  end
29
29
  end
30
30
  end
@@ -1 +1 @@
1
- access_token=access_token&expires_in=3600
1
+ access_token=access_token&expires=3600
@@ -8,21 +8,25 @@ describe Rack::OAuth2::Debugger::RequestFilter do
8
8
 
9
9
  describe '#filter_request' do
10
10
  it 'should log request' do
11
- Rack::OAuth2.logger.should_receive(:info).with(
12
- "======= [Rack::OAuth2] HTTP REQUEST STARTED =======\n" +
11
+ [
12
+ "======= [Rack::OAuth2] HTTP REQUEST STARTED =======",
13
13
  request.dump
14
- )
14
+ ].each do |output|
15
+ Rack::OAuth2.logger.should_receive(:info).with output
16
+ end
15
17
  request_filter.filter_request(request)
16
18
  end
17
19
  end
18
20
 
19
21
  describe '#filter_response' do
20
22
  it 'should log response' do
21
- Rack::OAuth2.logger.should_receive(:info).with(
22
- "--------------------------------------------------\n" +
23
- response.dump +
24
- "\n======= [Rack::OAuth2] HTTP REQUEST FINISHED ======="
25
- )
23
+ [
24
+ "--------------------------------------------------",
25
+ response.dump,
26
+ "======= [Rack::OAuth2] HTTP REQUEST FINISHED ======="
27
+ ].each do |output|
28
+ Rack::OAuth2.logger.should_receive(:info).with output
29
+ end
26
30
  request_filter.filter_response(request, response)
27
31
  end
28
32
  end
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: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-13 00:00:00.000000000 Z
12
+ date: 2013-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -296,6 +296,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
296
296
  - - ! '>='
297
297
  - !ruby/object:Gem::Version
298
298
  version: '0'
299
+ segments:
300
+ - 0
301
+ hash: 1898578761038848884
299
302
  required_rubygems_version: !ruby/object:Gem::Requirement
300
303
  none: false
301
304
  requirements: