devise_oauth2_providable 0.3.8 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/.gitignore +33 -2
  2. data/README.md +23 -11
  3. data/Rakefile +8 -1
  4. data/app/controllers/devise/oauth2_providable/authorizations_controller.rb +59 -0
  5. data/app/controllers/{oauth2 → devise/oauth2_providable}/tokens_controller.rb +1 -1
  6. data/app/models/{access_token.rb → devise/oauth2_providable/access_token.rb} +1 -1
  7. data/app/models/{authorization_code.rb → devise/oauth2_providable/authorization_code.rb} +1 -1
  8. data/app/models/{client.rb → devise/oauth2_providable/client.rb} +2 -1
  9. data/app/models/{refresh_token.rb → devise/oauth2_providable/refresh_token.rb} +1 -1
  10. data/app/views/{oauth2 → devise/oauth2_providable}/authorizations/_form.html.erb +1 -1
  11. data/app/views/{oauth2 → devise/oauth2_providable}/authorizations/error.html.erb +0 -0
  12. data/app/views/devise/oauth2_providable/authorizations/new.html.erb +4 -0
  13. data/config/routes.rb +6 -6
  14. data/db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb +55 -0
  15. data/devise_oauth2_providable.gemspec +7 -4
  16. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/engine.rb +2 -1
  17. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_authorization_code_grantable.rb +0 -0
  18. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_password_grantable.rb +0 -0
  19. data/lib/devise/oauth2_providable/models/oauth2_providable.rb +13 -0
  20. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/models/oauth2_refresh_token_grantable.rb +0 -0
  21. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_authorization_code_grant_type_strategy.rb +2 -2
  22. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_grant_type_strategy.rb +2 -2
  23. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_password_grant_type_strategy.rb +1 -1
  24. data/lib/{devise_oauth2_providable/strategy.rb → devise/oauth2_providable/strategies/oauth2_providable_strategy.rb} +1 -1
  25. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/strategies/oauth2_refresh_token_grant_type_strategy.rb +1 -1
  26. data/lib/{devise_oauth2_providable → devise/oauth2_providable}/version.rb +1 -1
  27. data/lib/devise_oauth2_providable.rb +16 -14
  28. data/script/rails +6 -0
  29. data/spec/{rails_app/spec/controllers → controllers}/protected_controller_spec.rb +3 -3
  30. data/spec/{rails_app → dummy}/Rakefile +2 -2
  31. data/spec/dummy/app/assets/javascripts/application.js +7 -0
  32. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  33. data/spec/{rails_app → dummy}/app/controllers/application_controller.rb +0 -0
  34. data/spec/{rails_app → dummy}/app/controllers/protected_controller.rb +0 -0
  35. data/spec/{rails_app → dummy}/app/helpers/application_helper.rb +0 -0
  36. data/spec/{rails_app/lib/tasks → dummy/app/mailers}/.gitkeep +0 -0
  37. data/spec/{rails_app/public/javascripts → dummy/app/models}/.gitkeep +0 -0
  38. data/spec/{rails_app → dummy}/app/models/user.rb +0 -0
  39. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  40. data/spec/{rails_app → dummy}/config/application.rb +10 -7
  41. data/spec/dummy/config/boot.rb +10 -0
  42. data/spec/{rails_app → dummy}/config/database.yml +3 -0
  43. data/spec/{rails_app → dummy}/config/environment.rb +1 -1
  44. data/spec/{rails_app → dummy}/config/environments/development.rb +8 -4
  45. data/spec/{rails_app → dummy}/config/environments/production.rb +24 -13
  46. data/spec/{rails_app → dummy}/config/environments/test.rb +6 -2
  47. data/spec/{rails_app → dummy}/config/initializers/backtrace_silencers.rb +0 -0
  48. data/spec/{rails_app → dummy}/config/initializers/devise.rb +29 -17
  49. data/spec/{rails_app → dummy}/config/initializers/inflections.rb +0 -0
  50. data/spec/{rails_app → dummy}/config/initializers/mime_types.rb +0 -0
  51. data/spec/{rails_app → dummy}/config/initializers/secret_token.rb +1 -1
  52. data/spec/{rails_app → dummy}/config/initializers/session_store.rb +2 -2
  53. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  54. data/spec/{rails_app → dummy}/config/locales/devise.en.yml +8 -0
  55. data/spec/{rails_app → dummy}/config/locales/en.yml +1 -1
  56. data/spec/dummy/config/routes.rb +7 -0
  57. data/spec/{rails_app → dummy}/config.ru +1 -1
  58. data/spec/{rails_app/db/migrate/20110511210926_create_users.rb → dummy/db/migrate/20111014142838_create_users.rb} +1 -7
  59. data/spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb +55 -0
  60. data/spec/dummy/db/schema.rb +78 -0
  61. data/spec/{rails_app/public/stylesheets → dummy/lib/assets}/.gitkeep +0 -0
  62. data/spec/{rails_app/vendor/plugins → dummy/log}/.gitkeep +0 -0
  63. data/spec/{rails_app → dummy}/public/404.html +0 -0
  64. data/spec/{rails_app → dummy}/public/422.html +0 -0
  65. data/spec/{rails_app → dummy}/public/500.html +0 -0
  66. data/spec/{rails_app → dummy}/public/favicon.ico +0 -0
  67. data/spec/{rails_app → dummy}/script/rails +0 -0
  68. data/spec/{rails_app/spec/integration → integration}/oauth2_authorization_token_grant_type_strategy_spec.rb +7 -7
  69. data/spec/{rails_app/spec/integration → integration}/oauth2_password_grant_type_strategy_spec.rb +6 -6
  70. data/spec/{rails_app/spec/integration → integration}/oauth2_refresh_token_grant_type_strategy_spec.rb +6 -6
  71. data/spec/{devise_oauth2_providable_spec.rb → lib/devise_oauth2_providable_spec.rb} +0 -0
  72. data/spec/{rails_app/spec/models → models}/access_token_spec.rb +7 -5
  73. data/spec/{rails_app/spec/models → models}/authorization_code_spec.rb +3 -3
  74. data/spec/{rails_app/spec/models → models}/client_spec.rb +5 -2
  75. data/spec/{rails_app/spec/models → models}/refresh_token_spec.rb +5 -3
  76. data/spec/models/user_spec.rb +6 -0
  77. data/spec/{rails_app/spec/routing → routing}/authorizations_routing_spec.rb +1 -1
  78. data/spec/{rails_app/spec/routing → routing}/tokens_routing_spec.rb +1 -1
  79. data/spec/spec_helper.rb +14 -20
  80. data/spec/support/match_json.rb +6 -0
  81. metadata +204 -162
  82. data/app/controllers/oauth2/authorizations_controller.rb +0 -55
  83. data/app/views/oauth2/authorizations/new.html.erb +0 -5
  84. data/lib/devise_oauth2_providable/model.rb +0 -13
  85. data/lib/devise_oauth2_providable/schema.rb +0 -61
  86. data/spec/rails_app/.gitignore +0 -4
  87. data/spec/rails_app/.rspec +0 -2
  88. data/spec/rails_app/Gemfile +0 -36
  89. data/spec/rails_app/README +0 -256
  90. data/spec/rails_app/app/views/layouts/application.html.erb +0 -14
  91. data/spec/rails_app/config/boot.rb +0 -6
  92. data/spec/rails_app/config/routes.rb +0 -61
  93. data/spec/rails_app/db/migrate/20110511210818_create_oauth2_schema.rb +0 -8
  94. data/spec/rails_app/db/schema.rb +0 -79
  95. data/spec/rails_app/db/seeds.rb +0 -7
  96. data/spec/rails_app/doc/README_FOR_APP +0 -2
  97. data/spec/rails_app/public/images/rails.png +0 -0
  98. data/spec/rails_app/public/index.html +0 -239
  99. data/spec/rails_app/public/javascripts/application.js +0 -0
  100. data/spec/rails_app/public/robots.txt +0 -5
  101. data/spec/rails_app/spec/models/user_spec.rb +0 -8
  102. data/spec/rails_app/spec/spec_helper.rb +0 -36
@@ -1,8 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Client do
3
+ describe Devise::Oauth2Providable::Client do
4
+ it { Devise::Oauth2Providable::Client.table_name.should == 'oauth2_clients' }
5
+
4
6
  describe 'basic client instance' do
5
- subject { Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost' }
7
+ subject { Devise::Oauth2Providable::Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost' }
6
8
  it { should validate_presence_of :name }
7
9
  it { should validate_uniqueness_of :name }
8
10
  it { should allow_mass_assignment_of :name }
@@ -15,5 +17,6 @@ describe Client do
15
17
  it { should_not allow_mass_assignment_of :identifier }
16
18
  it { should_not allow_mass_assignment_of :secret }
17
19
  it { should have_many :refresh_tokens }
20
+ it { should have_many :authorization_codes }
18
21
  end
19
22
  end
@@ -1,10 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe RefreshToken do
3
+ describe Devise::Oauth2Providable::RefreshToken do
4
+ it { Devise::Oauth2Providable::RefreshToken.table_name.should == 'oauth2_refresh_tokens' }
5
+
4
6
  describe 'basic refresh token instance' do
5
7
  subject do
6
- client = Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost'
7
- RefreshToken.create! :client => client
8
+ client = Devise::Oauth2Providable::Client.create! :name => 'test', :redirect_uri => 'http://localhost:3000', :website => 'http://localhost'
9
+ Devise::Oauth2Providable::RefreshToken.create! :client => client
8
10
  end
9
11
  it { should validate_presence_of :token }
10
12
  it { should validate_uniqueness_of :token }
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe User do
4
+ it { should have_many :access_tokens }
5
+ it { should have_many :authorization_codes }
6
+ end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Oauth2::AuthorizationsController do
3
+ describe Devise::Oauth2Providable::AuthorizationsController do
4
4
  describe 'routing' do
5
5
  it 'routes POST /oauth2/authorizations' do
6
6
  {:post => '/oauth2/authorizations'}.should route_to(:controller => 'oauth2/authorizations', :action => 'create')
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Oauth2::TokensController do
3
+ describe Devise::Oauth2Providable::TokensController do
4
4
  describe 'routing' do
5
5
  it 'routes POST /oauth2/token' do
6
6
  {:post => '/oauth2/token'}.should route_to(:controller => 'oauth2/tokens', :action => 'create')
data/spec/spec_helper.rb CHANGED
@@ -1,29 +1,23 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
1
+ # Configure Rails Envinronment
2
+ ENV["RAILS_ENV"] = "test"
3
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
3
4
 
4
- require 'devise_oauth2_providable'
5
+ require 'rspec/rails'
6
+ require 'shoulda-matchers'
7
+ require 'pry'
8
+
9
+ ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
5
10
 
6
11
  # Requires supporting ruby files with custom matchers and macros, etc,
7
12
  # in spec/support/ and its subdirectories.
8
- # Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
9
-
10
- # include Devise::TestHelpers
13
+ Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
11
14
 
12
15
  RSpec.configure do |config|
13
- # == Mock Framework
14
- #
15
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
16
- #
17
- # config.mock_with :mocha
18
- # config.mock_with :flexmock
19
- # config.mock_with :rr
20
- config.mock_with :rspec
16
+ config.include Devise::TestHelpers, :type => :controller
21
17
 
22
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
23
- # config.fixture_path = "#{::Rails.root}/spec/fixtures"
18
+ config.use_transactional_fixtures = true
24
19
 
25
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
26
- # examples within a transaction, remove the following line or assign false
27
- # instead of true.
28
- # config.use_transactional_fixtures = true
20
+ # enable rendering of views for controller tests
21
+ # see http://stackoverflow.com/questions/4401539/rspec-2-how-to-render-views-by-default-for-all-controller-specs
22
+ config.render_views
29
23
  end
@@ -0,0 +1,6 @@
1
+ # "{'foo': 'bar'}".should match_json {:foo => :bar}
2
+ RSpec::Matchers.define :match_json do |expected|
3
+ match do |actual|
4
+ ActiveSupport::JSON.backend.decode(actual) == ActiveSupport::JSON.backend.decode(expected.to_json)
5
+ end
6
+ end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_oauth2_providable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
5
- prerelease:
4
+ hash: 62196353
5
+ prerelease: 6
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 3
9
- - 8
10
- version: 0.3.8
9
+ - 0
10
+ - beta
11
+ - 1
12
+ version: 1.0.0.beta1
11
13
  platform: ruby
12
14
  authors:
13
15
  - Ryan Sonnek
@@ -15,7 +17,7 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2011-10-13 00:00:00 Z
20
+ date: 2011-10-17 00:00:00 Z
19
21
  dependencies:
20
22
  - !ruby/object:Gem::Dependency
21
23
  name: rails
@@ -25,14 +27,14 @@ dependencies:
25
27
  requirements:
26
28
  - - ">="
27
29
  - !ruby/object:Gem::Version
28
- hash: 9
30
+ hash: 3
29
31
  segments:
30
32
  - 3
33
+ - 1
31
34
  - 0
32
- - 7
33
- version: 3.0.7
34
- type: :runtime
35
+ version: 3.1.0
35
36
  version_requirements: *id001
37
+ type: :runtime
36
38
  - !ruby/object:Gem::Dependency
37
39
  name: devise
38
40
  prerelease: false
@@ -41,14 +43,14 @@ dependencies:
41
43
  requirements:
42
44
  - - ">="
43
45
  - !ruby/object:Gem::Version
44
- hash: 29
46
+ hash: 1
45
47
  segments:
46
48
  - 1
49
+ - 4
47
50
  - 3
48
- - 3
49
- version: 1.3.3
50
- type: :runtime
51
+ version: 1.4.3
51
52
  version_requirements: *id002
53
+ type: :runtime
52
54
  - !ruby/object:Gem::Dependency
53
55
  name: rack-oauth2
54
56
  prerelease: false
@@ -63,24 +65,75 @@ dependencies:
63
65
  - 11
64
66
  - 0
65
67
  version: 0.11.0
66
- type: :runtime
67
68
  version_requirements: *id003
69
+ type: :runtime
68
70
  - !ruby/object:Gem::Dependency
69
- name: rspec
71
+ name: rspec-rails
70
72
  prerelease: false
71
73
  requirement: &id004 !ruby/object:Gem::Requirement
72
74
  none: false
73
75
  requirements:
74
- - - ">="
76
+ - - "="
75
77
  - !ruby/object:Gem::Version
76
- hash: 27
78
+ hash: 21
77
79
  segments:
78
80
  - 2
79
- - 5
81
+ - 6
82
+ - 1
83
+ version: 2.6.1
84
+ version_requirements: *id004
85
+ type: :development
86
+ - !ruby/object:Gem::Dependency
87
+ name: sqlite3
88
+ prerelease: false
89
+ requirement: &id005 !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - "="
93
+ - !ruby/object:Gem::Version
94
+ hash: 19
95
+ segments:
96
+ - 1
97
+ - 3
98
+ - 4
99
+ version: 1.3.4
100
+ version_requirements: *id005
101
+ type: :development
102
+ - !ruby/object:Gem::Dependency
103
+ name: shoulda-matchers
104
+ prerelease: false
105
+ requirement: &id006 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - "="
109
+ - !ruby/object:Gem::Version
110
+ hash: 62196357
111
+ segments:
112
+ - 1
80
113
  - 0
81
- version: 2.5.0
114
+ - 0
115
+ - beta
116
+ - 3
117
+ version: 1.0.0.beta3
118
+ version_requirements: *id006
119
+ type: :development
120
+ - !ruby/object:Gem::Dependency
121
+ name: pry
122
+ prerelease: false
123
+ requirement: &id007 !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - "="
127
+ - !ruby/object:Gem::Version
128
+ hash: 27
129
+ segments:
130
+ - 0
131
+ - 9
132
+ - 6
133
+ - 2
134
+ version: 0.9.6.2
135
+ version_requirements: *id007
82
136
  type: :development
83
- version_requirements: *id004
84
137
  description: Rails3 engine that adds OAuth2 Provider support to any application built with Devise authentication
85
138
  email:
86
139
  - ryan@socialcast.com
@@ -99,91 +152,85 @@ files:
99
152
  - LICENSE.txt
100
153
  - README.md
101
154
  - Rakefile
102
- - app/controllers/oauth2/authorizations_controller.rb
103
- - app/controllers/oauth2/tokens_controller.rb
104
- - app/models/access_token.rb
105
- - app/models/authorization_code.rb
106
- - app/models/client.rb
107
- - app/models/refresh_token.rb
108
- - app/views/oauth2/authorizations/_form.html.erb
109
- - app/views/oauth2/authorizations/error.html.erb
110
- - app/views/oauth2/authorizations/new.html.erb
155
+ - app/controllers/devise/oauth2_providable/authorizations_controller.rb
156
+ - app/controllers/devise/oauth2_providable/tokens_controller.rb
157
+ - app/models/devise/oauth2_providable/access_token.rb
158
+ - app/models/devise/oauth2_providable/authorization_code.rb
159
+ - app/models/devise/oauth2_providable/client.rb
160
+ - app/models/devise/oauth2_providable/refresh_token.rb
161
+ - app/views/devise/oauth2_providable/authorizations/_form.html.erb
162
+ - app/views/devise/oauth2_providable/authorizations/error.html.erb
163
+ - app/views/devise/oauth2_providable/authorizations/new.html.erb
111
164
  - config/routes.rb
165
+ - db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb
112
166
  - devise_oauth2_providable.gemspec
167
+ - lib/devise/oauth2_providable/engine.rb
168
+ - lib/devise/oauth2_providable/models/oauth2_authorization_code_grantable.rb
169
+ - lib/devise/oauth2_providable/models/oauth2_password_grantable.rb
170
+ - lib/devise/oauth2_providable/models/oauth2_providable.rb
171
+ - lib/devise/oauth2_providable/models/oauth2_refresh_token_grantable.rb
172
+ - lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
173
+ - lib/devise/oauth2_providable/strategies/oauth2_grant_type_strategy.rb
174
+ - lib/devise/oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb
175
+ - lib/devise/oauth2_providable/strategies/oauth2_providable_strategy.rb
176
+ - lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
177
+ - lib/devise/oauth2_providable/version.rb
113
178
  - lib/devise_oauth2_providable.rb
114
- - lib/devise_oauth2_providable/engine.rb
115
- - lib/devise_oauth2_providable/model.rb
116
- - lib/devise_oauth2_providable/models/oauth2_authorization_code_grantable.rb
117
- - lib/devise_oauth2_providable/models/oauth2_password_grantable.rb
118
- - lib/devise_oauth2_providable/models/oauth2_refresh_token_grantable.rb
119
- - lib/devise_oauth2_providable/schema.rb
120
- - lib/devise_oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
121
- - lib/devise_oauth2_providable/strategies/oauth2_grant_type_strategy.rb
122
- - lib/devise_oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb
123
- - lib/devise_oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
124
- - lib/devise_oauth2_providable/strategy.rb
125
- - lib/devise_oauth2_providable/version.rb
126
179
  - lib/expirable_token.rb
127
- - spec/devise_oauth2_providable_spec.rb
128
- - spec/rails_app/.gitignore
129
- - spec/rails_app/.rspec
130
- - spec/rails_app/Gemfile
131
- - spec/rails_app/README
132
- - spec/rails_app/Rakefile
133
- - spec/rails_app/app/controllers/application_controller.rb
134
- - spec/rails_app/app/controllers/protected_controller.rb
135
- - spec/rails_app/app/helpers/application_helper.rb
136
- - spec/rails_app/app/models/user.rb
137
- - spec/rails_app/app/views/layouts/application.html.erb
138
- - spec/rails_app/config.ru
139
- - spec/rails_app/config/application.rb
140
- - spec/rails_app/config/boot.rb
141
- - spec/rails_app/config/database.yml
142
- - spec/rails_app/config/environment.rb
143
- - spec/rails_app/config/environments/development.rb
144
- - spec/rails_app/config/environments/production.rb
145
- - spec/rails_app/config/environments/test.rb
146
- - spec/rails_app/config/initializers/backtrace_silencers.rb
147
- - spec/rails_app/config/initializers/devise.rb
148
- - spec/rails_app/config/initializers/inflections.rb
149
- - spec/rails_app/config/initializers/mime_types.rb
150
- - spec/rails_app/config/initializers/secret_token.rb
151
- - spec/rails_app/config/initializers/session_store.rb
152
- - spec/rails_app/config/locales/devise.en.yml
153
- - spec/rails_app/config/locales/en.yml
154
- - spec/rails_app/config/routes.rb
155
- - spec/rails_app/db/migrate/20110511210818_create_oauth2_schema.rb
156
- - spec/rails_app/db/migrate/20110511210926_create_users.rb
157
- - spec/rails_app/db/schema.rb
158
- - spec/rails_app/db/seeds.rb
159
- - spec/rails_app/doc/README_FOR_APP
160
- - spec/rails_app/lib/tasks/.gitkeep
161
- - spec/rails_app/public/404.html
162
- - spec/rails_app/public/422.html
163
- - spec/rails_app/public/500.html
164
- - spec/rails_app/public/favicon.ico
165
- - spec/rails_app/public/images/rails.png
166
- - spec/rails_app/public/index.html
167
- - spec/rails_app/public/javascripts/.gitkeep
168
- - spec/rails_app/public/javascripts/application.js
169
- - spec/rails_app/public/robots.txt
170
- - spec/rails_app/public/stylesheets/.gitkeep
171
- - spec/rails_app/script/rails
172
- - spec/rails_app/spec/controllers/protected_controller_spec.rb
173
- - spec/rails_app/spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb
174
- - spec/rails_app/spec/integration/oauth2_password_grant_type_strategy_spec.rb
175
- - spec/rails_app/spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb
176
- - spec/rails_app/spec/models/access_token_spec.rb
177
- - spec/rails_app/spec/models/authorization_code_spec.rb
178
- - spec/rails_app/spec/models/client_spec.rb
179
- - spec/rails_app/spec/models/refresh_token_spec.rb
180
- - spec/rails_app/spec/models/user_spec.rb
181
- - spec/rails_app/spec/routing/authorizations_routing_spec.rb
182
- - spec/rails_app/spec/routing/tokens_routing_spec.rb
183
- - spec/rails_app/spec/spec_helper.rb
184
- - spec/rails_app/vendor/plugins/.gitkeep
180
+ - script/rails
181
+ - spec/controllers/protected_controller_spec.rb
182
+ - spec/dummy/Rakefile
183
+ - spec/dummy/app/assets/javascripts/application.js
184
+ - spec/dummy/app/assets/stylesheets/application.css
185
+ - spec/dummy/app/controllers/application_controller.rb
186
+ - spec/dummy/app/controllers/protected_controller.rb
187
+ - spec/dummy/app/helpers/application_helper.rb
188
+ - spec/dummy/app/mailers/.gitkeep
189
+ - spec/dummy/app/models/.gitkeep
190
+ - spec/dummy/app/models/user.rb
191
+ - spec/dummy/app/views/layouts/application.html.erb
192
+ - spec/dummy/config.ru
193
+ - spec/dummy/config/application.rb
194
+ - spec/dummy/config/boot.rb
195
+ - spec/dummy/config/database.yml
196
+ - spec/dummy/config/environment.rb
197
+ - spec/dummy/config/environments/development.rb
198
+ - spec/dummy/config/environments/production.rb
199
+ - spec/dummy/config/environments/test.rb
200
+ - spec/dummy/config/initializers/backtrace_silencers.rb
201
+ - spec/dummy/config/initializers/devise.rb
202
+ - spec/dummy/config/initializers/inflections.rb
203
+ - spec/dummy/config/initializers/mime_types.rb
204
+ - spec/dummy/config/initializers/secret_token.rb
205
+ - spec/dummy/config/initializers/session_store.rb
206
+ - spec/dummy/config/initializers/wrap_parameters.rb
207
+ - spec/dummy/config/locales/devise.en.yml
208
+ - spec/dummy/config/locales/en.yml
209
+ - spec/dummy/config/routes.rb
210
+ - spec/dummy/db/migrate/20111014142838_create_users.rb
211
+ - spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb
212
+ - spec/dummy/db/schema.rb
213
+ - spec/dummy/lib/assets/.gitkeep
214
+ - spec/dummy/log/.gitkeep
215
+ - spec/dummy/public/404.html
216
+ - spec/dummy/public/422.html
217
+ - spec/dummy/public/500.html
218
+ - spec/dummy/public/favicon.ico
219
+ - spec/dummy/script/rails
220
+ - spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb
221
+ - spec/integration/oauth2_password_grant_type_strategy_spec.rb
222
+ - spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb
223
+ - spec/lib/devise_oauth2_providable_spec.rb
224
+ - spec/models/access_token_spec.rb
225
+ - spec/models/authorization_code_spec.rb
226
+ - spec/models/client_spec.rb
227
+ - spec/models/refresh_token_spec.rb
228
+ - spec/models/user_spec.rb
229
+ - spec/routing/authorizations_routing_spec.rb
230
+ - spec/routing/tokens_routing_spec.rb
185
231
  - spec/setup_database.rb
186
232
  - spec/spec_helper.rb
233
+ - spec/support/match_json.rb
187
234
  homepage: ""
188
235
  licenses: []
189
236
 
@@ -204,12 +251,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
251
  required_rubygems_version: !ruby/object:Gem::Requirement
205
252
  none: false
206
253
  requirements:
207
- - - ">="
254
+ - - ">"
208
255
  - !ruby/object:Gem::Version
209
- hash: 3
256
+ hash: 25
210
257
  segments:
211
- - 0
212
- version: "0"
258
+ - 1
259
+ - 3
260
+ - 1
261
+ version: 1.3.1
213
262
  requirements: []
214
263
 
215
264
  rubyforge_project: devise_oauth2_providable
@@ -218,63 +267,56 @@ signing_key:
218
267
  specification_version: 3
219
268
  summary: OAuth2 Provider for Rails3 applications
220
269
  test_files:
221
- - spec/devise_oauth2_providable_spec.rb
222
- - spec/rails_app/.gitignore
223
- - spec/rails_app/.rspec
224
- - spec/rails_app/Gemfile
225
- - spec/rails_app/README
226
- - spec/rails_app/Rakefile
227
- - spec/rails_app/app/controllers/application_controller.rb
228
- - spec/rails_app/app/controllers/protected_controller.rb
229
- - spec/rails_app/app/helpers/application_helper.rb
230
- - spec/rails_app/app/models/user.rb
231
- - spec/rails_app/app/views/layouts/application.html.erb
232
- - spec/rails_app/config.ru
233
- - spec/rails_app/config/application.rb
234
- - spec/rails_app/config/boot.rb
235
- - spec/rails_app/config/database.yml
236
- - spec/rails_app/config/environment.rb
237
- - spec/rails_app/config/environments/development.rb
238
- - spec/rails_app/config/environments/production.rb
239
- - spec/rails_app/config/environments/test.rb
240
- - spec/rails_app/config/initializers/backtrace_silencers.rb
241
- - spec/rails_app/config/initializers/devise.rb
242
- - spec/rails_app/config/initializers/inflections.rb
243
- - spec/rails_app/config/initializers/mime_types.rb
244
- - spec/rails_app/config/initializers/secret_token.rb
245
- - spec/rails_app/config/initializers/session_store.rb
246
- - spec/rails_app/config/locales/devise.en.yml
247
- - spec/rails_app/config/locales/en.yml
248
- - spec/rails_app/config/routes.rb
249
- - spec/rails_app/db/migrate/20110511210818_create_oauth2_schema.rb
250
- - spec/rails_app/db/migrate/20110511210926_create_users.rb
251
- - spec/rails_app/db/schema.rb
252
- - spec/rails_app/db/seeds.rb
253
- - spec/rails_app/doc/README_FOR_APP
254
- - spec/rails_app/lib/tasks/.gitkeep
255
- - spec/rails_app/public/404.html
256
- - spec/rails_app/public/422.html
257
- - spec/rails_app/public/500.html
258
- - spec/rails_app/public/favicon.ico
259
- - spec/rails_app/public/images/rails.png
260
- - spec/rails_app/public/index.html
261
- - spec/rails_app/public/javascripts/.gitkeep
262
- - spec/rails_app/public/javascripts/application.js
263
- - spec/rails_app/public/robots.txt
264
- - spec/rails_app/public/stylesheets/.gitkeep
265
- - spec/rails_app/script/rails
266
- - spec/rails_app/spec/controllers/protected_controller_spec.rb
267
- - spec/rails_app/spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb
268
- - spec/rails_app/spec/integration/oauth2_password_grant_type_strategy_spec.rb
269
- - spec/rails_app/spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb
270
- - spec/rails_app/spec/models/access_token_spec.rb
271
- - spec/rails_app/spec/models/authorization_code_spec.rb
272
- - spec/rails_app/spec/models/client_spec.rb
273
- - spec/rails_app/spec/models/refresh_token_spec.rb
274
- - spec/rails_app/spec/models/user_spec.rb
275
- - spec/rails_app/spec/routing/authorizations_routing_spec.rb
276
- - spec/rails_app/spec/routing/tokens_routing_spec.rb
277
- - spec/rails_app/spec/spec_helper.rb
278
- - spec/rails_app/vendor/plugins/.gitkeep
270
+ - spec/controllers/protected_controller_spec.rb
271
+ - spec/dummy/Rakefile
272
+ - spec/dummy/app/assets/javascripts/application.js
273
+ - spec/dummy/app/assets/stylesheets/application.css
274
+ - spec/dummy/app/controllers/application_controller.rb
275
+ - spec/dummy/app/controllers/protected_controller.rb
276
+ - spec/dummy/app/helpers/application_helper.rb
277
+ - spec/dummy/app/mailers/.gitkeep
278
+ - spec/dummy/app/models/.gitkeep
279
+ - spec/dummy/app/models/user.rb
280
+ - spec/dummy/app/views/layouts/application.html.erb
281
+ - spec/dummy/config.ru
282
+ - spec/dummy/config/application.rb
283
+ - spec/dummy/config/boot.rb
284
+ - spec/dummy/config/database.yml
285
+ - spec/dummy/config/environment.rb
286
+ - spec/dummy/config/environments/development.rb
287
+ - spec/dummy/config/environments/production.rb
288
+ - spec/dummy/config/environments/test.rb
289
+ - spec/dummy/config/initializers/backtrace_silencers.rb
290
+ - spec/dummy/config/initializers/devise.rb
291
+ - spec/dummy/config/initializers/inflections.rb
292
+ - spec/dummy/config/initializers/mime_types.rb
293
+ - spec/dummy/config/initializers/secret_token.rb
294
+ - spec/dummy/config/initializers/session_store.rb
295
+ - spec/dummy/config/initializers/wrap_parameters.rb
296
+ - spec/dummy/config/locales/devise.en.yml
297
+ - spec/dummy/config/locales/en.yml
298
+ - spec/dummy/config/routes.rb
299
+ - spec/dummy/db/migrate/20111014142838_create_users.rb
300
+ - spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb
301
+ - spec/dummy/db/schema.rb
302
+ - spec/dummy/lib/assets/.gitkeep
303
+ - spec/dummy/log/.gitkeep
304
+ - spec/dummy/public/404.html
305
+ - spec/dummy/public/422.html
306
+ - spec/dummy/public/500.html
307
+ - spec/dummy/public/favicon.ico
308
+ - spec/dummy/script/rails
309
+ - spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb
310
+ - spec/integration/oauth2_password_grant_type_strategy_spec.rb
311
+ - spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb
312
+ - spec/lib/devise_oauth2_providable_spec.rb
313
+ - spec/models/access_token_spec.rb
314
+ - spec/models/authorization_code_spec.rb
315
+ - spec/models/client_spec.rb
316
+ - spec/models/refresh_token_spec.rb
317
+ - spec/models/user_spec.rb
318
+ - spec/routing/authorizations_routing_spec.rb
319
+ - spec/routing/tokens_routing_spec.rb
279
320
  - spec/setup_database.rb
280
321
  - spec/spec_helper.rb
322
+ - spec/support/match_json.rb
@@ -1,55 +0,0 @@
1
- class Oauth2::AuthorizationsController < ApplicationController
2
- before_filter :authenticate_user!
3
-
4
- rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e|
5
- @error = e
6
- render :error, :status => e.status
7
- end
8
-
9
- def new
10
- respond *authorize_endpoint.call(request.env)
11
- end
12
-
13
- def create
14
- respond *authorize_endpoint(:allow_approval).call(request.env)
15
- end
16
-
17
- private
18
-
19
- def respond(status, header, response)
20
- ["WWW-Authenticate"].each do |key|
21
- headers[key] = header[key] if header[key].present?
22
- end
23
- if response.redirect?
24
- redirect_to header['Location']
25
- else
26
- render :new
27
- end
28
- end
29
-
30
- def authorize_endpoint(allow_approval = false)
31
- Rack::OAuth2::Server::Authorize.new do |req, res|
32
- @client = Client.find_by_identifier(req.client_id) || req.bad_request!
33
- res.redirect_uri = @redirect_uri = req.verify_redirect_uri!(@client.redirect_uri)
34
- if allow_approval
35
- if params[:approve].present?
36
- case req.response_type
37
- when :code
38
- authorization_code = current_user.authorization_codes.create(:client => @client, :redirect_uri => @redirect_uri)
39
- res.code = authorization_code.token
40
- when :token
41
- access_token = current_user.access_tokens.create(:client => @client).token
42
- bearer_token = Rack::OAuth2::AccessToken::Bearer.new(:access_token => access_token)
43
- res.access_token = bearer_token
44
- res.uid = current_user.id
45
- end
46
- res.approve!
47
- else
48
- req.access_denied!
49
- end
50
- else
51
- @response_type = req.response_type
52
- end
53
- end
54
- end
55
- end
@@ -1,5 +0,0 @@
1
- <h2><%= link_to @client.name, @client.website %> is requesting permission to access your resources.</h2>
2
-
3
- <%= render 'oauth2/authorizations/form', :client => @client, :response_type => @response_type, :redirect_uri => @redirect_uri, :action => :approve %>
4
- <%= render 'oauth2/authorizations/form', :client => @client, :response_type => @response_type, :redirect_uri => @redirect_uri, :action => :deny %>
5
-
@@ -1,13 +0,0 @@
1
- require 'devise/models'
2
-
3
- module Devise
4
- module Models
5
- module Oauth2Providable
6
- extend ActiveSupport::Concern
7
- included do
8
- has_many :access_tokens
9
- has_many :authorization_codes
10
- end
11
- end
12
- end
13
- end