devise_oauth2_providable 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Oauth2Providable
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ class TokenEndpoint
25
25
  when :refresh_token
26
26
  refresh_token = client.refresh_tokens.valid.find_by_token(req.refresh_token)
27
27
  req.invalid_grant! unless refresh_token
28
- res.access_token = refresh_token.access_tokens.create.to_bearer_token
28
+ res.access_token = refresh_token.access_tokens.create(:client => client).to_bearer_token
29
29
  else
30
30
  # NOTE: extended assertion grant_types are not supported yet.
31
31
  req.unsupported_grant_type!
@@ -0,0 +1,7 @@
1
+ config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
2
+ ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
3
+ ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite'])
4
+
5
+ ActiveRecord::Schema.define(:version => 1) do
6
+
7
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+ require 'token_endpoint'
3
+ require 'active_record'
4
+ require File.join(File.dirname(__FILE__), '..', 'app', 'models', 'client')
5
+
6
+ describe TokenEndpoint do
7
+ #FIXME
8
+ describe 'refresh_token grant type' do
9
+ before do
10
+ params = {
11
+ :grant_type => 'refresh_token',
12
+ :client_id => 'client_id',
13
+ :code => 'authorization_code',
14
+ :redirect_uri => 'http://client.example.com/callback'
15
+ }
16
+
17
+ request = Rack::MockRequest.new TokenEndpoint.new
18
+ @response = request.post('/', :params => params)
19
+ end
20
+ it 'should create new access token' do
21
+
22
+ end
23
+ it { @response.status.should == 200 }
24
+ it { @response.content_type.should == 'application/json' }
25
+ it { @response.body.should include '"access_token"' }
26
+ end
27
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_oauth2_providable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-27 00:00:00 Z
18
+ date: 2011-04-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -117,7 +117,9 @@ files:
117
117
  - lib/expirable_token.rb
118
118
  - lib/token_endpoint.rb
119
119
  - spec/devise_oauth2_providable_spec.rb
120
+ - spec/setup_database.rb
120
121
  - spec/spec_helper.rb
122
+ - spec/token_endpoint_spec.rb
121
123
  homepage: ""
122
124
  licenses: []
123
125
 
@@ -153,4 +155,6 @@ specification_version: 3
153
155
  summary: OAuth2 Provider for Rails3 applications
154
156
  test_files:
155
157
  - spec/devise_oauth2_providable_spec.rb
158
+ - spec/setup_database.rb
156
159
  - spec/spec_helper.rb
160
+ - spec/token_endpoint_spec.rb