rack-oauth2 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -26,8 +26,15 @@ http://github.com/nov/rack-oauth2-sample
26
26
 
27
27
  == Sample Client
28
28
 
29
+ Authorization Request (request_type: 'code' and 'token')
29
30
  https://gist.github.com/862393
30
31
 
32
+ Token Request (grant_type: 'client_credentials', 'password' and 'authorization_code')
33
+ https://gist.github.com/883541
34
+
35
+ Resource Request (request both for resource owner resource and for client resource)
36
+ https://gist.github.com/883575
37
+
31
38
  == Note on Patches/Pull Requests
32
39
 
33
40
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 0.4.6
@@ -3,7 +3,7 @@ module Rack
3
3
  class Client
4
4
  include AttrRequired, AttrOptional
5
5
  attr_required :identifier
6
- attr_optional :secret, :redirect_uri, :scheme, :host, :authorization_endpoint, :token_endpoint
6
+ attr_optional :secret, :redirect_uri, :scheme, :host, :port, :authorization_endpoint, :token_endpoint
7
7
 
8
8
  def initialize(attributes = {})
9
9
  (required_attributes + optional_attributes).each do |key|
@@ -38,6 +38,12 @@ module Rack
38
38
  )
39
39
  end
40
40
 
41
+ def refresh_token=(token)
42
+ @grant = Grant::RefreshToken.new(
43
+ :refresh_token => token
44
+ )
45
+ end
46
+
41
47
  def access_token!
42
48
  params = @grant.to_hash
43
49
  params.merge!(
@@ -55,6 +61,7 @@ module Rack
55
61
  _endpoint_ = Util.parse_uri endpoint
56
62
  _endpoint_.scheme ||= self.scheme || 'https'
57
63
  _endpoint_.host ||= self.host
64
+ _endpoint_.port ||= self.port
58
65
  _endpoint_.to_s
59
66
  end
60
67
 
@@ -25,4 +25,5 @@ end
25
25
 
26
26
  require 'rack/oauth2/client/grant/authorization_code'
27
27
  require 'rack/oauth2/client/grant/password'
28
- require 'rack/oauth2/client/grant/client_credentials'
28
+ require 'rack/oauth2/client/grant/client_credentials'
29
+ require 'rack/oauth2/client/grant/refresh_token'
@@ -0,0 +1,11 @@
1
+ module Rack
2
+ module OAuth2
3
+ class Client
4
+ class Grant
5
+ class RefreshToken < Grant
6
+ attr_required :refresh_token
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -47,11 +47,12 @@ module Rack
47
47
 
48
48
  class Response < Abstract::Response
49
49
  attr_required :access_token, :token_type
50
- attr_optional :expires_in, :refresh_token, :scope
50
+ attr_optional :refresh_token, :expires_in, :scope
51
51
 
52
52
  def protocol_params
53
53
  {
54
54
  :access_token => access_token,
55
+ :refresh_token => refresh_token,
55
56
  :token_type => token_type,
56
57
  :expires_in => expires_in,
57
58
  :scope => Array(scope).join(' ')
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: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 5
10
- version: 0.4.5
9
+ - 6
10
+ version: 0.4.6
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-03-24 00:00:00 +09:00
18
+ date: 2011-03-26 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -192,6 +192,7 @@ files:
192
192
  - lib/rack/oauth2/client/grant/authorization_code.rb
193
193
  - lib/rack/oauth2/client/grant/client_credentials.rb
194
194
  - lib/rack/oauth2/client/grant/password.rb
195
+ - lib/rack/oauth2/client/grant/refresh_token.rb
195
196
  - lib/rack/oauth2/server.rb
196
197
  - lib/rack/oauth2/server/abstract.rb
197
198
  - lib/rack/oauth2/server/abstract/error.rb