brycesch-devise_oauth2_providable 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +35 -0
  3. data/.ruby_gemset +1 -0
  4. data/.ruby_version +1 -0
  5. data/CONTRIBUTORS.txt +6 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +160 -0
  9. data/Rakefile +8 -0
  10. data/app/controllers/devise/oauth2_providable/authorizations_controller.rb +59 -0
  11. data/app/controllers/devise/oauth2_providable/tokens_controller.rb +35 -0
  12. data/app/models/devise/oauth2_providable/access_token.rb +25 -0
  13. data/app/models/devise/oauth2_providable/authorization_code.rb +3 -0
  14. data/app/models/devise/oauth2_providable/client.rb +26 -0
  15. data/app/models/devise/oauth2_providable/refresh_token.rb +6 -0
  16. data/app/views/devise/oauth2_providable/authorizations/_form.html.erb +7 -0
  17. data/app/views/devise/oauth2_providable/authorizations/error.html.erb +4 -0
  18. data/app/views/devise/oauth2_providable/authorizations/new.html.erb +4 -0
  19. data/config/routes.rb +6 -0
  20. data/db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb +58 -0
  21. data/devise_oauth2_providable.gemspec +33 -0
  22. data/lib/devise/oauth2_providable/engine.rb +16 -0
  23. data/lib/devise/oauth2_providable/expirable_token.rb +56 -0
  24. data/lib/devise/oauth2_providable/models/oauth2_authorization_code_grantable.rb +6 -0
  25. data/lib/devise/oauth2_providable/models/oauth2_password_grantable.rb +6 -0
  26. data/lib/devise/oauth2_providable/models/oauth2_providable.rb +13 -0
  27. data/lib/devise/oauth2_providable/models/oauth2_refresh_token_grantable.rb +6 -0
  28. data/lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb +21 -0
  29. data/lib/devise/oauth2_providable/strategies/oauth2_grant_type_strategy.rb +44 -0
  30. data/lib/devise/oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb +22 -0
  31. data/lib/devise/oauth2_providable/strategies/oauth2_providable_strategy.rb +31 -0
  32. data/lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb +22 -0
  33. data/lib/devise/oauth2_providable/version.rb +5 -0
  34. data/lib/devise_oauth2_providable.rb +41 -0
  35. data/script/rails +6 -0
  36. data/spec/controllers/authorizations_controller_spec.rb +32 -0
  37. data/spec/controllers/protected_controller_spec.rb +43 -0
  38. data/spec/controllers/tokens_controller_spec.rb +50 -0
  39. data/spec/dummy/Rakefile +7 -0
  40. data/spec/dummy/app/assets/javascripts/application.js +7 -0
  41. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  42. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  43. data/spec/dummy/app/controllers/protected_controller.rb +7 -0
  44. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  45. data/spec/dummy/app/mailers/.gitkeep +0 -0
  46. data/spec/dummy/app/models/.gitkeep +0 -0
  47. data/spec/dummy/app/models/user.rb +3 -0
  48. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  49. data/spec/dummy/config.ru +4 -0
  50. data/spec/dummy/config/application.rb +51 -0
  51. data/spec/dummy/config/boot.rb +10 -0
  52. data/spec/dummy/config/database.yml +25 -0
  53. data/spec/dummy/config/environment.rb +5 -0
  54. data/spec/dummy/config/environments/development.rb +32 -0
  55. data/spec/dummy/config/environments/production.rb +62 -0
  56. data/spec/dummy/config/environments/test.rb +42 -0
  57. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  58. data/spec/dummy/config/initializers/devise.rb +259 -0
  59. data/spec/dummy/config/initializers/inflections.rb +10 -0
  60. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  61. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  62. data/spec/dummy/config/initializers/session_store.rb +8 -0
  63. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  64. data/spec/dummy/config/locales/devise.en.yml +58 -0
  65. data/spec/dummy/config/locales/en.yml +5 -0
  66. data/spec/dummy/config/routes.rb +7 -0
  67. data/spec/dummy/db/migrate/20111014142838_create_users.rb +9 -0
  68. data/spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb +55 -0
  69. data/spec/dummy/db/schema.rb +78 -0
  70. data/spec/dummy/lib/assets/.gitkeep +0 -0
  71. data/spec/dummy/public/404.html +26 -0
  72. data/spec/dummy/public/422.html +26 -0
  73. data/spec/dummy/public/500.html +26 -0
  74. data/spec/dummy/public/favicon.ico +0 -0
  75. data/spec/dummy/script/rails +6 -0
  76. data/spec/factories/client_factory.rb +7 -0
  77. data/spec/factories/user_factory.rb +6 -0
  78. data/spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb +137 -0
  79. data/spec/integration/oauth2_password_grant_type_strategy_spec.rb +174 -0
  80. data/spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb +138 -0
  81. data/spec/lib/devise_oauth2_providable_spec.rb +7 -0
  82. data/spec/models/access_token_spec.rb +50 -0
  83. data/spec/models/authorization_code_spec.rb +21 -0
  84. data/spec/models/client_spec.rb +17 -0
  85. data/spec/models/refresh_token_spec.rb +23 -0
  86. data/spec/models/user_spec.rb +6 -0
  87. data/spec/routing/authorizations_routing_spec.rb +16 -0
  88. data/spec/routing/tokens_routing_spec.rb +9 -0
  89. data/spec/spec_helper.rb +33 -0
  90. data/spec/support/match_json.rb +6 -0
  91. metadata +330 -0
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Devise::Oauth2Providable::AuthorizationsController do
4
+ describe 'routing' do
5
+ pending 'routes POST /oauth2/authorizations' do
6
+ post('/oauth2/authorizations').should route_to('devise/oauth2_providable/authorizations#create')
7
+ end
8
+ pending 'routes GET /oauth2/authorize' do
9
+ get('/oauth2/authorize').should route_to('devise/oauth2_providable/authorizations#new')
10
+ end
11
+ pending 'routes POST /oauth2/authorize' do
12
+ #FIXME: this is valid, but the route is not being loaded into the test
13
+ post('/oauth2/authorize').should route_to('devise/oauth2_providable/authorizations#new')
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Devise::Oauth2Providable::TokensController do
4
+ describe 'routing' do
5
+ pending 'routes POST /oauth2/token' do
6
+ post('/oauth2/token').should route_to('devise/oauth2_providable/tokens#create')
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,33 @@
1
+ # Configure Rails Envinronment
2
+ ENV["RAILS_ENV"] = "test"
3
+ spec_root = File.expand_path('..', __FILE__)
4
+ require File.expand_path("dummy/config/environment.rb", spec_root)
5
+
6
+ require 'pry'
7
+ require 'rspec/rails'
8
+ require 'shoulda/matchers'
9
+ require 'factory_girl_rails'
10
+ require 'shoulda-kept-assign-to'
11
+ require 'database_cleaner'
12
+
13
+ ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
14
+
15
+ RSpec.configure do |config|
16
+ # config.include FactoryGirl::Syntax::Methods
17
+ config.include Devise::TestHelpers, type: :controller
18
+ config.before :suite do
19
+ DatabaseCleaner[:active_record].strategy = :transaction
20
+ DatabaseCleaner[:active_record].clean_with :truncation
21
+ end
22
+
23
+ config.before :each do
24
+ DatabaseCleaner[:active_record].start
25
+ end
26
+
27
+ config.after :each do
28
+ DatabaseCleaner[:active_record].clean
29
+ end
30
+ end
31
+
32
+ Dir[File.join(ENGINE_RAILS_ROOT, "spec/support/**/*.rb")].each {|f| require f }
33
+ ActiveRecord::Migrator.migrate(File.expand_path("dummy/db/migrate/", spec_root))
@@ -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.decode(actual) == expected.with_indifferent_access
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,330 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brycesch-devise_oauth2_providable
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.7
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Sonnek
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>'
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>'
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: devise
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack-oauth2
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.14.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 2.14.2
69
+ - !ruby/object:Gem::Dependency
70
+ name: shoulda-matchers
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: shoulda-kept-assign-to
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: database_cleaner
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.3.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: sqlite3
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: factory_girl_rails
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Rails3 engine that adds OAuth2 Provider support to any application built
154
+ with Devise authentication
155
+ email:
156
+ - ryan@socialcast.com
157
+ executables: []
158
+ extensions: []
159
+ extra_rdoc_files: []
160
+ files:
161
+ - .gitignore
162
+ - .ruby_gemset
163
+ - .ruby_version
164
+ - CONTRIBUTORS.txt
165
+ - Gemfile
166
+ - LICENSE.txt
167
+ - README.md
168
+ - Rakefile
169
+ - app/controllers/devise/oauth2_providable/authorizations_controller.rb
170
+ - app/controllers/devise/oauth2_providable/tokens_controller.rb
171
+ - app/models/devise/oauth2_providable/access_token.rb
172
+ - app/models/devise/oauth2_providable/authorization_code.rb
173
+ - app/models/devise/oauth2_providable/client.rb
174
+ - app/models/devise/oauth2_providable/refresh_token.rb
175
+ - app/views/devise/oauth2_providable/authorizations/_form.html.erb
176
+ - app/views/devise/oauth2_providable/authorizations/error.html.erb
177
+ - app/views/devise/oauth2_providable/authorizations/new.html.erb
178
+ - config/routes.rb
179
+ - db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb
180
+ - devise_oauth2_providable.gemspec
181
+ - lib/devise/oauth2_providable/engine.rb
182
+ - lib/devise/oauth2_providable/expirable_token.rb
183
+ - lib/devise/oauth2_providable/models/oauth2_authorization_code_grantable.rb
184
+ - lib/devise/oauth2_providable/models/oauth2_password_grantable.rb
185
+ - lib/devise/oauth2_providable/models/oauth2_providable.rb
186
+ - lib/devise/oauth2_providable/models/oauth2_refresh_token_grantable.rb
187
+ - lib/devise/oauth2_providable/strategies/oauth2_authorization_code_grant_type_strategy.rb
188
+ - lib/devise/oauth2_providable/strategies/oauth2_grant_type_strategy.rb
189
+ - lib/devise/oauth2_providable/strategies/oauth2_password_grant_type_strategy.rb
190
+ - lib/devise/oauth2_providable/strategies/oauth2_providable_strategy.rb
191
+ - lib/devise/oauth2_providable/strategies/oauth2_refresh_token_grant_type_strategy.rb
192
+ - lib/devise/oauth2_providable/version.rb
193
+ - lib/devise_oauth2_providable.rb
194
+ - script/rails
195
+ - spec/controllers/authorizations_controller_spec.rb
196
+ - spec/controllers/protected_controller_spec.rb
197
+ - spec/controllers/tokens_controller_spec.rb
198
+ - spec/dummy/Rakefile
199
+ - spec/dummy/app/assets/javascripts/application.js
200
+ - spec/dummy/app/assets/stylesheets/application.css
201
+ - spec/dummy/app/controllers/application_controller.rb
202
+ - spec/dummy/app/controllers/protected_controller.rb
203
+ - spec/dummy/app/helpers/application_helper.rb
204
+ - spec/dummy/app/mailers/.gitkeep
205
+ - spec/dummy/app/models/.gitkeep
206
+ - spec/dummy/app/models/user.rb
207
+ - spec/dummy/app/views/layouts/application.html.erb
208
+ - spec/dummy/config.ru
209
+ - spec/dummy/config/application.rb
210
+ - spec/dummy/config/boot.rb
211
+ - spec/dummy/config/database.yml
212
+ - spec/dummy/config/environment.rb
213
+ - spec/dummy/config/environments/development.rb
214
+ - spec/dummy/config/environments/production.rb
215
+ - spec/dummy/config/environments/test.rb
216
+ - spec/dummy/config/initializers/backtrace_silencers.rb
217
+ - spec/dummy/config/initializers/devise.rb
218
+ - spec/dummy/config/initializers/inflections.rb
219
+ - spec/dummy/config/initializers/mime_types.rb
220
+ - spec/dummy/config/initializers/secret_token.rb
221
+ - spec/dummy/config/initializers/session_store.rb
222
+ - spec/dummy/config/initializers/wrap_parameters.rb
223
+ - spec/dummy/config/locales/devise.en.yml
224
+ - spec/dummy/config/locales/en.yml
225
+ - spec/dummy/config/routes.rb
226
+ - spec/dummy/db/migrate/20111014142838_create_users.rb
227
+ - spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb
228
+ - spec/dummy/db/schema.rb
229
+ - spec/dummy/lib/assets/.gitkeep
230
+ - spec/dummy/log/.gitkeep
231
+ - spec/dummy/public/404.html
232
+ - spec/dummy/public/422.html
233
+ - spec/dummy/public/500.html
234
+ - spec/dummy/public/favicon.ico
235
+ - spec/dummy/script/rails
236
+ - spec/factories/client_factory.rb
237
+ - spec/factories/user_factory.rb
238
+ - spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb
239
+ - spec/integration/oauth2_password_grant_type_strategy_spec.rb
240
+ - spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb
241
+ - spec/lib/devise_oauth2_providable_spec.rb
242
+ - spec/models/access_token_spec.rb
243
+ - spec/models/authorization_code_spec.rb
244
+ - spec/models/client_spec.rb
245
+ - spec/models/refresh_token_spec.rb
246
+ - spec/models/user_spec.rb
247
+ - spec/routing/authorizations_routing_spec.rb
248
+ - spec/routing/tokens_routing_spec.rb
249
+ - spec/spec_helper.rb
250
+ - spec/support/match_json.rb
251
+ homepage: ''
252
+ licenses: []
253
+ metadata: {}
254
+ post_install_message:
255
+ rdoc_options: []
256
+ require_paths:
257
+ - lib
258
+ required_ruby_version: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - '>='
261
+ - !ruby/object:Gem::Version
262
+ version: '0'
263
+ required_rubygems_version: !ruby/object:Gem::Requirement
264
+ requirements:
265
+ - - '>='
266
+ - !ruby/object:Gem::Version
267
+ version: '0'
268
+ requirements: []
269
+ rubyforge_project:
270
+ rubygems_version: 2.4.6
271
+ signing_key:
272
+ specification_version: 4
273
+ summary: OAuth2 Provider for Rails applications
274
+ test_files:
275
+ - spec/controllers/authorizations_controller_spec.rb
276
+ - spec/controllers/protected_controller_spec.rb
277
+ - spec/controllers/tokens_controller_spec.rb
278
+ - spec/dummy/Rakefile
279
+ - spec/dummy/app/assets/javascripts/application.js
280
+ - spec/dummy/app/assets/stylesheets/application.css
281
+ - spec/dummy/app/controllers/application_controller.rb
282
+ - spec/dummy/app/controllers/protected_controller.rb
283
+ - spec/dummy/app/helpers/application_helper.rb
284
+ - spec/dummy/app/mailers/.gitkeep
285
+ - spec/dummy/app/models/.gitkeep
286
+ - spec/dummy/app/models/user.rb
287
+ - spec/dummy/app/views/layouts/application.html.erb
288
+ - spec/dummy/config.ru
289
+ - spec/dummy/config/application.rb
290
+ - spec/dummy/config/boot.rb
291
+ - spec/dummy/config/database.yml
292
+ - spec/dummy/config/environment.rb
293
+ - spec/dummy/config/environments/development.rb
294
+ - spec/dummy/config/environments/production.rb
295
+ - spec/dummy/config/environments/test.rb
296
+ - spec/dummy/config/initializers/backtrace_silencers.rb
297
+ - spec/dummy/config/initializers/devise.rb
298
+ - spec/dummy/config/initializers/inflections.rb
299
+ - spec/dummy/config/initializers/mime_types.rb
300
+ - spec/dummy/config/initializers/secret_token.rb
301
+ - spec/dummy/config/initializers/session_store.rb
302
+ - spec/dummy/config/initializers/wrap_parameters.rb
303
+ - spec/dummy/config/locales/devise.en.yml
304
+ - spec/dummy/config/locales/en.yml
305
+ - spec/dummy/config/routes.rb
306
+ - spec/dummy/db/migrate/20111014142838_create_users.rb
307
+ - spec/dummy/db/migrate/20111014161437_create_devise_oauth2_providable_schema.rb
308
+ - spec/dummy/db/schema.rb
309
+ - spec/dummy/lib/assets/.gitkeep
310
+ - spec/dummy/log/.gitkeep
311
+ - spec/dummy/public/404.html
312
+ - spec/dummy/public/422.html
313
+ - spec/dummy/public/500.html
314
+ - spec/dummy/public/favicon.ico
315
+ - spec/dummy/script/rails
316
+ - spec/factories/client_factory.rb
317
+ - spec/factories/user_factory.rb
318
+ - spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb
319
+ - spec/integration/oauth2_password_grant_type_strategy_spec.rb
320
+ - spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb
321
+ - spec/lib/devise_oauth2_providable_spec.rb
322
+ - spec/models/access_token_spec.rb
323
+ - spec/models/authorization_code_spec.rb
324
+ - spec/models/client_spec.rb
325
+ - spec/models/refresh_token_spec.rb
326
+ - spec/models/user_spec.rb
327
+ - spec/routing/authorizations_routing_spec.rb
328
+ - spec/routing/tokens_routing_spec.rb
329
+ - spec/spec_helper.rb
330
+ - spec/support/match_json.rb