rack-oauth2 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,10 +1,16 @@
1
1
  = rack-oauth2
2
2
 
3
- Rack Middleware for OAuth2 server.
4
- OAuth2 client library is also included.
3
+ OAuth 2.0 Server & Client Library.
4
+ Both Bearer and MAC token type are supported.
5
5
 
6
- This gem is based on OAuth 2.0 draft v.13
7
- http://tools.ietf.org/html/draft-ietf-oauth-v2-13
6
+ The OAuth 2.0 Authorization Protocol (draft 15)
7
+ http://tools.ietf.org/html/draft-ietf-oauth-v2-15
8
+
9
+ The OAuth 2.0 Protocol: Bearer Tokens (draft 03)
10
+ http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-03
11
+
12
+ HTTP Authentication: MAC Authentication (draft 02)
13
+ http://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-02
8
14
 
9
15
  == Installation
10
16
 
@@ -18,14 +24,26 @@ http://tools.ietf.org/html/draft-ietf-oauth-v2-13
18
24
 
19
25
  == Sample Server Application (Rails3)
20
26
 
27
+ === Bearer
28
+
21
29
  Running on Heroku
22
30
  http://rack-oauth2-sample.heroku.com
23
31
 
24
32
  Source on GitHub
25
33
  http://github.com/nov/rack-oauth2-sample
26
34
 
35
+ === MAC
36
+
37
+ Running on Heroku
38
+ http://rack-oauth2-sample-mac.heroku.com
39
+
40
+ Source on GitHub
41
+ http://github.com/nov/rack-oauth2-sample-mac
42
+
27
43
  == Sample Client
28
44
 
45
+ === Bearer
46
+
29
47
  Authorization Request (request_type: 'code' and 'token')
30
48
  https://gist.github.com/862393
31
49
 
@@ -35,6 +53,10 @@ https://gist.github.com/883541
35
53
  Resource Request (request both for resource owner resource and for client resource)
36
54
  https://gist.github.com/883575
37
55
 
56
+ === MAC
57
+
58
+ Coming soon..
59
+
38
60
  == Note on Patches/Pull Requests
39
61
 
40
62
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
@@ -88,12 +88,12 @@ module Rack
88
88
  end
89
89
 
90
90
  def authorization_header
91
- header = "MAC"
92
- header << " token=\"#{access_token}\""
93
- header << " timestamp=\"#{timestamp}\""
94
- header << " nonce=\"#{nonce}\""
95
- header << " bodyhash=\"#{body_hash}\"" if self.body_hash.present?
96
- header << " signature=\"#{signature}\""
91
+ header = "MAC "
92
+ header << "token=\"#{access_token}\","
93
+ header << "timestamp=\"#{timestamp}\","
94
+ header << "nonce=\"#{nonce}\","
95
+ header << "bodyhash=\"#{body_hash}\"," if self.body_hash.present?
96
+ header << "signature=\"#{signature}\""
97
97
  end
98
98
 
99
99
  def generate_nonce
@@ -14,7 +14,7 @@ module Rack
14
14
  attr_reader :timestamp, :nonce, :body_hash, :signature
15
15
 
16
16
  def setup!
17
- auth_params = @auth_header.params.split(' ').inject({}) do |auth_params, pair|
17
+ auth_params = @auth_header.params.split(',').inject({}) do |auth_params, pair|
18
18
  key, value = pair.scan(/^(.*)=\"(.*)\"/).flatten
19
19
  auth_params.merge!(key => value)
20
20
  end.with_indifferent_access
data/rack-oauth2.gemspec CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.version = File.read("VERSION")
4
4
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
5
5
  s.authors = ["nov matake"]
6
- s.description = %q{Rack Middleware for OAuth2 server. OAuth2 client library is also included.}
7
- s.summary = %q{Rack Middleware for OAuth2 server}
6
+ s.description = %q{OAuth 2.0 Server & Client Library. Both Bearer and MAC token type are supported.}
7
+ s.summary = %q{OAuth 2.0 Server & Client Library - Both Bearer and MAC token type are supported}
8
8
  s.email = "nov@matake.jp"
9
9
  s.extra_rdoc_files = ["LICENSE", "README.rdoc"]
10
10
  s.rdoc_options = ["--charset=UTF-8"]
@@ -37,7 +37,7 @@ describe Rack::OAuth2::AccessToken::MAC do
37
37
  Time.fix(Time.at(1302361200)) do
38
38
  RestClient.should_receive(:get).with(
39
39
  resource_endpoint,
40
- :AUTHORIZATION => "MAC token=\"access_token\" timestamp=\"1302361200\" nonce=\"51e74de734c05613f37520872e68db5f\" signature=\"yYDSkZMrEbOOqj0anHNLA9ougNA+lxU0zmPiMSPtmJ8=\""
40
+ :AUTHORIZATION => "MAC token=\"access_token\",timestamp=\"1302361200\",nonce=\"51e74de734c05613f37520872e68db5f\",signature=\"yYDSkZMrEbOOqj0anHNLA9ougNA+lxU0zmPiMSPtmJ8=\""
41
41
  )
42
42
  token.get resource_endpoint
43
43
  end
@@ -50,7 +50,7 @@ describe Rack::OAuth2::AccessToken::MAC do
50
50
  RestClient.should_receive(:post).with(
51
51
  resource_endpoint,
52
52
  {:key => :value},
53
- {:AUTHORIZATION => "MAC token=\"access_token\" timestamp=\"1302361200\" nonce=\"51e74de734c05613f37520872e68db5f\" bodyhash=\"Vj8DVxGNBe8UXWvd8pZswj6Gyo8vAT+RXlZa/fCfeiM=\" signature=\"xRvIiA+rmjhPjULVpyCCgiHEsOkLEHZik4ZaB+cyqgk=\""}
53
+ {:AUTHORIZATION => "MAC token=\"access_token\",timestamp=\"1302361200\",nonce=\"51e74de734c05613f37520872e68db5f\",bodyhash=\"Vj8DVxGNBe8UXWvd8pZswj6Gyo8vAT+RXlZa/fCfeiM=\",signature=\"xRvIiA+rmjhPjULVpyCCgiHEsOkLEHZik4ZaB+cyqgk=\""}
54
54
  )
55
55
  token.post resource_endpoint, :key => :value
56
56
  end
@@ -63,7 +63,7 @@ describe Rack::OAuth2::AccessToken::MAC do
63
63
  RestClient.should_receive(:put).with(
64
64
  resource_endpoint,
65
65
  {:key => :value},
66
- {:AUTHORIZATION => "MAC token=\"access_token\" timestamp=\"1302361200\" nonce=\"51e74de734c05613f37520872e68db5f\" bodyhash=\"Vj8DVxGNBe8UXWvd8pZswj6Gyo8vAT+RXlZa/fCfeiM=\" signature=\"2lWgkUCtD9lNBlDi5fe9eVDwEwbxfLGAqjgykaSV1ww=\""}
66
+ {:AUTHORIZATION => "MAC token=\"access_token\",timestamp=\"1302361200\",nonce=\"51e74de734c05613f37520872e68db5f\",bodyhash=\"Vj8DVxGNBe8UXWvd8pZswj6Gyo8vAT+RXlZa/fCfeiM=\",signature=\"2lWgkUCtD9lNBlDi5fe9eVDwEwbxfLGAqjgykaSV1ww=\""}
67
67
  )
68
68
  token.put resource_endpoint, :key => :value
69
69
  end
@@ -75,7 +75,7 @@ describe Rack::OAuth2::AccessToken::MAC do
75
75
  Time.fix(Time.at(1302361200)) do
76
76
  RestClient.should_receive(:delete).with(
77
77
  resource_endpoint,
78
- :AUTHORIZATION => "MAC token=\"access_token\" timestamp=\"1302361200\" nonce=\"51e74de734c05613f37520872e68db5f\" signature=\"PX2GhHuo5yYNEs51e4Zlllw8itQ4Te0v+6ZuRCK7k+s=\""
78
+ :AUTHORIZATION => "MAC token=\"access_token\",timestamp=\"1302361200\",nonce=\"51e74de734c05613f37520872e68db5f\",signature=\"PX2GhHuo5yYNEs51e4Zlllw8itQ4Te0v+6ZuRCK7k+s=\""
79
79
  )
80
80
  token.delete resource_endpoint
81
81
  end
@@ -90,7 +90,7 @@ describe Rack::OAuth2::AccessToken::MAC do
90
90
  let(:env) do
91
91
  Rack::MockRequest.env_for(
92
92
  '/protected_resources',
93
- 'HTTP_AUTHORIZATION' => "MAC token=\"access_token\" timestamp=\"1302361200\" nonce=\"51e74de734c05613f37520872e68db5f\" signature=\"#{signature}\""
93
+ 'HTTP_AUTHORIZATION' => "MAC token=\"access_token\",timestamp=\"1302361200\",nonce=\"51e74de734c05613f37520872e68db5f\",signature=\"#{signature}\""
94
94
  )
95
95
  end
96
96
 
@@ -122,7 +122,7 @@ describe Rack::OAuth2::AccessToken::MAC do
122
122
  :params => {
123
123
  :key1 => 'value1'
124
124
  },
125
- 'HTTP_AUTHORIZATION' => "MAC token=\"access_token\" timestamp=\"1302361200\" nonce=\"51e74de734c05613f37520872e68db5f\" bodyhash=\"#{body_hash}\" signature=\"#{signature}\""
125
+ 'HTTP_AUTHORIZATION' => "MAC token=\"access_token\",timestamp=\"1302361200\",nonce=\"51e74de734c05613f37520872e68db5f\",bodyhash=\"#{body_hash}\",signature=\"#{signature}\""
126
126
  )
127
127
  end
128
128
  let(:signature) { 'invalid' }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 0
10
- version: 0.6.0
9
+ - 1
10
+ version: 0.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-20 00:00:00 +09:00
18
+ date: 2011-04-21 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -167,7 +167,7 @@ dependencies:
167
167
  version: "1.3"
168
168
  type: :development
169
169
  version_requirements: *id010
170
- description: Rack Middleware for OAuth2 server. OAuth2 client library is also included.
170
+ description: OAuth 2.0 Server & Client Library. Both Bearer and MAC token type are supported.
171
171
  email: nov@matake.jp
172
172
  executables: []
173
173
 
@@ -288,7 +288,7 @@ rubyforge_project:
288
288
  rubygems_version: 1.5.3
289
289
  signing_key:
290
290
  specification_version: 3
291
- summary: Rack Middleware for OAuth2 server
291
+ summary: OAuth 2.0 Server & Client Library - Both Bearer and MAC token type are supported
292
292
  test_files:
293
293
  - spec/fake_response/facebook_token_response.txt
294
294
  - spec/fake_response/invalid_request.json