devise_oauth2_providable 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,7 +38,9 @@ class Oauth2::AuthorizationsController < ApplicationController
38
38
  authorization_code = current_user.authorization_codes.create(:client_id => @client, :redirect_uri => @redirect_uri)
39
39
  res.code = authorization_code.token
40
40
  when :token
41
- res.access_token = current_user.access_tokens.create(:client_id => @client).to_bearer_token
41
+ access_token = current_user.access_tokens.create(:client_id => @client).token
42
+ bearer_token = Rack::OAuth2::AccessToken::Bearer.new(:access_token => access_token)
43
+ res.access_token = bearer_token
42
44
  end
43
45
  res.approve!
44
46
  else
data/config/routes.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  Rails.application.routes.draw do
2
- scope '/oauth2', :name_prefix => 'oauth2' do
2
+ scope '/oauth2', :as => 'oauth2' do
3
3
  resources :authorizations, :controller => 'oauth2/authorizations', :only => :create
4
4
  resource :token, :controller => 'oauth2/tokens', :only => :create
5
5
  match 'authorize' => 'oauth2/authorizations#new'
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_runtime_dependency(%q<rails>, [">= 3.0.7"])
18
18
  s.add_runtime_dependency(%q<devise>, [">= 1.3.3"])
19
- s.add_runtime_dependency(%q<rack-oauth2>, ["~> 0.6.3"])
19
+ s.add_runtime_dependency(%q<rack-oauth2>, ["~> 0.8.2"])
20
20
  s.add_development_dependency(%q<rspec>, ['>= 2.5.0'])
21
21
 
22
22
  s.files = `git ls-files`.split("\n")
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Oauth2Providable
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.7"
4
4
  end
5
5
  end
@@ -5,7 +5,8 @@ gem 'rspec-rails', '2.6.0'
5
5
  gem 'devise_oauth2_providable', :path => '../../'
6
6
  gem 'shoulda-matchers', '1.0.0.beta2'
7
7
  gem 'sqlite3', '1.3.3'
8
- gem 'ruby-debug', '0.10.4'
8
+ gem 'ruby-debug', '0.10.4', :platform => :ruby_18
9
+ gem 'ruby-debug19', '0.11.6', :platform => :ruby_19
9
10
 
10
11
  # Bundle edge Rails instead:
11
12
  # gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -17,14 +17,14 @@ describe ProtectedController do
17
17
  end
18
18
  context 'with valid bearer token in query string' do
19
19
  before do
20
- get :index, :bearer_token => @token.token, :format => 'json'
20
+ get :index, :access_token => @token.token, :format => 'json'
21
21
  end
22
22
  it { should respond_with :ok }
23
23
  end
24
24
 
25
25
  context 'with invalid bearer token in query param' do
26
26
  before do
27
- get :index, :bearer_token => 'invalid', :format => 'json'
27
+ get :index, :access_token => 'invalid', :format => 'json'
28
28
  end
29
29
  it { should respond_with :unauthorized }
30
30
  end
@@ -34,7 +34,7 @@ describe ProtectedController do
34
34
  it 'raises error' do
35
35
  lambda {
36
36
  @request.env['HTTP_AUTHORIZATION'] = "Bearer #{@token.token}"
37
- get :index, :bearer_token => @token.token, :format => 'json'
37
+ get :index, :access_token => @token.token, :format => 'json'
38
38
  }.should raise_error
39
39
  end
40
40
  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: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 6
10
- version: 0.3.6
9
+ - 7
10
+ version: 0.3.7
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-07-15 00:00:00 Z
18
+ date: 2011-07-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -57,12 +57,12 @@ dependencies:
57
57
  requirements:
58
58
  - - ~>
59
59
  - !ruby/object:Gem::Version
60
- hash: 1
60
+ hash: 59
61
61
  segments:
62
62
  - 0
63
- - 6
64
- - 3
65
- version: 0.6.3
63
+ - 8
64
+ - 2
65
+ version: 0.8.2
66
66
  type: :runtime
67
67
  version_requirements: *id003
68
68
  - !ruby/object:Gem::Dependency