sorcery 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. data/README.rdoc +129 -61
  2. data/VERSION +1 -1
  3. data/lib/generators/sorcery_migration/sorcery_migration_generator.rb +24 -0
  4. data/lib/generators/sorcery_migration/templates/activity_logging.rb +17 -0
  5. data/lib/generators/sorcery_migration/templates/brute_force_protection.rb +11 -0
  6. data/lib/generators/sorcery_migration/templates/core.rb +16 -0
  7. data/lib/generators/sorcery_migration/templates/external.rb +14 -0
  8. data/lib/generators/sorcery_migration/templates/remember_me.rb +15 -0
  9. data/lib/generators/sorcery_migration/templates/reset_password.rb +13 -0
  10. data/lib/generators/sorcery_migration/templates/user_activation.rb +17 -0
  11. data/lib/sorcery/controller/adapters/sinatra.rb +97 -0
  12. data/lib/sorcery/controller/submodules/email.rb +44 -0
  13. data/lib/sorcery/controller/submodules/external/protocols/oauth1.rb +35 -0
  14. data/lib/sorcery/controller/submodules/external/protocols/oauth2.rb +26 -0
  15. data/lib/sorcery/controller/submodules/{oauth → external}/providers/facebook.rb +24 -6
  16. data/lib/sorcery/controller/submodules/{oauth → external}/providers/twitter.rb +31 -6
  17. data/lib/sorcery/controller/submodules/external.rb +83 -0
  18. data/lib/sorcery/controller/submodules/http_basic_auth.rb +10 -6
  19. data/lib/sorcery/controller/submodules/oauth.rb +6 -3
  20. data/lib/sorcery/controller.rb +5 -3
  21. data/lib/sorcery/model/submodules/activity_logging.rb +1 -1
  22. data/lib/sorcery/model/submodules/brute_force_protection.rb +0 -4
  23. data/lib/sorcery/model/submodules/{oauth.rb → external.rb} +3 -3
  24. data/lib/sorcery/model.rb +9 -6
  25. data/lib/sorcery/sinatra.rb +14 -0
  26. data/lib/sorcery/test_helpers/rails.rb +57 -0
  27. data/lib/sorcery/test_helpers/sinatra.rb +131 -0
  28. data/lib/sorcery/test_helpers.rb +8 -52
  29. data/lib/sorcery.rb +17 -7
  30. data/sorcery.gemspec +86 -10
  31. data/spec/Gemfile +1 -1
  32. data/spec/Gemfile.lock +2 -2
  33. data/spec/rails3/app_root/Gemfile +2 -4
  34. data/spec/rails3/app_root/Gemfile.lock +2 -5
  35. data/spec/rails3/app_root/app/controllers/application_controller.rb +11 -11
  36. data/spec/rails3/app_root/spec/controller_oauth2_spec.rb +15 -13
  37. data/spec/rails3/app_root/spec/controller_oauth_spec.rb +18 -13
  38. data/spec/rails3/app_root/spec/controller_session_timeout_spec.rb +2 -2
  39. data/spec/rails3/app_root/spec/spec_helper.rb +1 -0
  40. data/spec/rails3/app_root/spec/user_oauth_spec.rb +4 -4
  41. data/spec/rails3/app_root/spec/user_spec.rb +2 -2
  42. data/spec/sinatra/Gemfile +12 -0
  43. data/spec/sinatra/Gemfile.lock +134 -0
  44. data/spec/sinatra/Rakefile +10 -0
  45. data/spec/sinatra/authentication.rb +3 -0
  46. data/spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb +17 -0
  47. data/spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb +17 -0
  48. data/spec/sinatra/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb +11 -0
  49. data/spec/sinatra/db/migrate/core/20101224223620_create_users.rb +16 -0
  50. data/spec/sinatra/db/migrate/external/20101224223628_create_authentications.rb +14 -0
  51. data/spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb +15 -0
  52. data/spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb +13 -0
  53. data/spec/sinatra/filters.rb +21 -0
  54. data/spec/sinatra/myapp.rb +133 -0
  55. data/spec/sinatra/sorcery_mailer.rb +25 -0
  56. data/spec/sinatra/spec/controller_activity_logging_spec.rb +85 -0
  57. data/spec/sinatra/spec/controller_brute_force_protection_spec.rb +69 -0
  58. data/spec/sinatra/spec/controller_http_basic_auth_spec.rb +53 -0
  59. data/spec/sinatra/spec/controller_oauth2_spec.rb +119 -0
  60. data/spec/sinatra/spec/controller_oauth_spec.rb +121 -0
  61. data/spec/sinatra/spec/controller_remember_me_spec.rb +64 -0
  62. data/spec/sinatra/spec/controller_session_timeout_spec.rb +52 -0
  63. data/spec/sinatra/spec/controller_spec.rb +120 -0
  64. data/spec/sinatra/spec/spec.opts +4 -0
  65. data/spec/sinatra/spec/spec_helper.rb +44 -0
  66. data/spec/sinatra/spec/user_activation_spec.rb +188 -0
  67. data/spec/sinatra/spec/user_activity_logging_spec.rb +36 -0
  68. data/spec/sinatra/spec/user_brute_force_protection_spec.rb +76 -0
  69. data/spec/sinatra/spec/user_oauth_spec.rb +39 -0
  70. data/spec/sinatra/spec/user_remember_me_spec.rb +66 -0
  71. data/spec/sinatra/spec/user_reset_password_spec.rb +178 -0
  72. data/spec/sinatra/spec/user_spec.rb +317 -0
  73. data/spec/sinatra/user.rb +6 -0
  74. data/spec/sinatra/views/test_login.erb +4 -0
  75. data/spec/untitled folder +18 -0
  76. metadata +85 -9
  77. data/lib/sorcery/controller/submodules/oauth/oauth1.rb +0 -26
  78. data/lib/sorcery/controller/submodules/oauth/oauth2.rb +0 -24
  79. /data/spec/rails3/app_root/db/migrate/{oauth → external}/20101224223628_create_authentications.rb +0 -0
@@ -0,0 +1,317 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../sorcery_mailer')
3
+
4
+ describe "User with no submodules (core)" do
5
+ before(:all) do
6
+ sorcery_reload!
7
+ end
8
+
9
+ describe User, "when app has plugin loaded" do
10
+ it "should respond to the plugin activation class method" do
11
+ ActiveRecord::Base.should respond_to(:activate_sorcery!)
12
+ User.should respond_to(:activate_sorcery!)
13
+ end
14
+
15
+ it "plugin activation should yield config to block" do
16
+ User.activate_sorcery! do |config|
17
+ config.class.should == ::Sorcery::Model::Config
18
+ end
19
+ end
20
+ end
21
+
22
+ # ----------------- PLUGIN ACTIVATION -----------------------
23
+ describe TestUser, "Testing activated class self-registration" do
24
+ it "should register itself as user_class if activated" do
25
+ TestUser.class_eval do
26
+ activate_sorcery!
27
+ end
28
+ ::Sorcery::Controller::Config.user_class.should == TestUser
29
+ end
30
+ end
31
+
32
+ # ----------------- PLUGIN CONFIGURATION -----------------------
33
+ describe User, "loaded plugin configuration" do
34
+ after(:each) do
35
+ User.sorcery_config.reset!
36
+ end
37
+
38
+ it "should enable configuration option 'username_attribute_name'" do
39
+ sorcery_model_property_set(:username_attribute_name, :email)
40
+ User.sorcery_config.username_attribute_name.should equal(:email)
41
+ end
42
+
43
+ it "should enable configuration option 'password_attribute_name'" do
44
+ sorcery_model_property_set(:password_attribute_name, :mypassword)
45
+ User.sorcery_config.password_attribute_name.should equal(:mypassword)
46
+ end
47
+
48
+ it "should enable configuration option 'email_attribute_name'" do
49
+ sorcery_model_property_set(:email_attribute_name, :my_email)
50
+ User.sorcery_config.email_attribute_name.should equal(:my_email)
51
+ end
52
+
53
+ it "should enable configuration option 'crypted_password_attribute_name'" do
54
+ sorcery_model_property_set(:crypted_password_attribute_name, :password)
55
+ User.sorcery_config.crypted_password_attribute_name.should equal(:password)
56
+ end
57
+
58
+ it "should enable configuration option 'salt_attribute_name'" do
59
+ sorcery_model_property_set(:salt_attribute_name, :my_salt)
60
+ User.sorcery_config.salt_attribute_name.should equal(:my_salt)
61
+ end
62
+
63
+ it "should enable configuration option 'encryption_algorithm'" do
64
+ sorcery_model_property_set(:encryption_algorithm, :none)
65
+ User.sorcery_config.encryption_algorithm.should equal(:none)
66
+ end
67
+
68
+ it "should enable configuration option 'encryption_key'" do
69
+ sorcery_model_property_set(:encryption_key, 'asdadas424234242')
70
+ User.sorcery_config.encryption_key.should == 'asdadas424234242'
71
+ end
72
+
73
+ it "should enable configuration option 'custom_encryption_provider'" do
74
+ sorcery_model_property_set(:encryption_algorithm, :custom)
75
+ sorcery_model_property_set(:custom_encryption_provider, Array)
76
+ User.sorcery_config.custom_encryption_provider.should equal(Array)
77
+ end
78
+
79
+ it "should enable configuration option 'salt_join_token'" do
80
+ salt_join_token = "--%%*&-"
81
+ sorcery_model_property_set(:salt_join_token, salt_join_token)
82
+ User.sorcery_config.salt_join_token.should equal(salt_join_token)
83
+ end
84
+
85
+ it "should enable configuration option 'stretches'" do
86
+ stretches = 15
87
+ sorcery_model_property_set(:stretches, stretches)
88
+ User.sorcery_config.stretches.should equal(stretches)
89
+ end
90
+
91
+ end
92
+
93
+ # ----------------- PLUGIN ACTIVATED -----------------------
94
+ describe User, "when activated with sorcery" do
95
+ before(:all) do
96
+ sorcery_reload!()
97
+ end
98
+
99
+ before(:each) do
100
+ User.delete_all
101
+ end
102
+
103
+ it "should respond to class method authenticate" do
104
+ ActiveRecord::Base.should_not respond_to(:authenticate)
105
+ User.should respond_to(:authenticate)
106
+ end
107
+
108
+ it "authenticate should return true if credentials are good" do
109
+ create_new_user
110
+ User.authenticate(@user.send(User.sorcery_config.username_attribute_name), 'secret').should be_true
111
+ end
112
+
113
+ it "authenticate should return false if credentials are bad" do
114
+ create_new_user
115
+ User.authenticate(@user.send(User.sorcery_config.username_attribute_name), 'wrong!').should be_false
116
+ end
117
+
118
+ it "should respond to the class method encrypt" do
119
+ User.should respond_to(:encrypt)
120
+ end
121
+ end
122
+
123
+ # ----------------- REGISTRATION -----------------------
124
+ describe User, "registration" do
125
+
126
+ before(:all) do
127
+ sorcery_reload!()
128
+ end
129
+
130
+ before(:each) do
131
+ User.delete_all
132
+ end
133
+
134
+ it "by default, encryption_provider should not be nil" do
135
+ User.sorcery_config.encryption_provider.should_not be_nil
136
+ end
137
+
138
+ it "should encrypt password when a new user is saved" do
139
+ create_new_user
140
+ User.sorcery_config.encryption_provider.matches?(@user.send(User.sorcery_config.crypted_password_attribute_name),'secret',@user.salt).should be_true
141
+ end
142
+
143
+ it "should clear the virtual password field if the encryption process worked" do
144
+ create_new_user
145
+ @user.password.should be_nil
146
+ end
147
+
148
+ it "should not clear the virtual password field if save failed due to validity" do
149
+ create_new_user
150
+ User.class_eval do
151
+ validates_format_of :email, :with => /^(.)+@(.)+$/, :if => Proc.new {|r| r.email}, :message => "is invalid"
152
+ end
153
+ @user.password = 'blupush'
154
+ @user.email = 'asd'
155
+ @user.save
156
+ @user.password.should_not be_nil
157
+ end
158
+
159
+ it "should not clear the virtual password field if save failed due to exception" do
160
+ create_new_user
161
+ @user.password = 'blupush'
162
+ @user.username = nil
163
+ begin
164
+ @user.save # triggers SQL exception since username field is defined not null.
165
+ rescue
166
+ end
167
+ @user.password.should_not be_nil
168
+ end
169
+
170
+ it "should not encrypt the password twice when a user is updated" do
171
+ create_new_user
172
+ @user.email = "blup@bla.com"
173
+ @user.save!
174
+ User.sorcery_config.encryption_provider.matches?(@user.send(User.sorcery_config.crypted_password_attribute_name),'secret',@user.salt).should be_true
175
+ end
176
+
177
+ it "should replace the crypted_password in case a new password is set" do
178
+ create_new_user
179
+ @user.password = 'new_secret'
180
+ @user.save!
181
+ User.sorcery_config.encryption_provider.matches?(@user.send(User.sorcery_config.crypted_password_attribute_name),'secret',@user.salt).should be_false
182
+ end
183
+
184
+ end
185
+
186
+ # ----------------- PASSWORD ENCRYPTION -----------------------
187
+ describe User, "special encryption cases" do
188
+ before(:all) do
189
+ sorcery_reload!()
190
+ @text = "Some Text!"
191
+ end
192
+
193
+ before(:each) do
194
+ User.delete_all
195
+ end
196
+
197
+ after(:each) do
198
+ User.sorcery_config.reset!
199
+ end
200
+
201
+ it "should work with no password encryption" do
202
+ sorcery_model_property_set(:encryption_algorithm, :none)
203
+ create_new_user
204
+ User.authenticate(@user.send(User.sorcery_config.username_attribute_name), 'secret').should be_true
205
+ end
206
+
207
+ it "should work with custom password encryption" do
208
+ class MyCrypto
209
+ def self.encrypt(*tokens)
210
+ tokens.flatten.join('').gsub(/e/,'A')
211
+ end
212
+
213
+ def self.matches?(crypted,*tokens)
214
+ crypted = encrypt(*tokens)
215
+ end
216
+ end
217
+ sorcery_model_property_set(:encryption_algorithm, :custom)
218
+ sorcery_model_property_set(:custom_encryption_provider, MyCrypto)
219
+ create_new_user
220
+ User.authenticate(@user.send(User.sorcery_config.username_attribute_name), 'secret').should be_true
221
+ end
222
+
223
+ it "if encryption algo is aes256, it should set key to crypto provider" do
224
+ sorcery_model_property_set(:encryption_algorithm, :aes256)
225
+ sorcery_model_property_set(:encryption_key, nil)
226
+ expect{User.encrypt(@text)}.to raise_error(ArgumentError)
227
+ sorcery_model_property_set(:encryption_key, "asd234dfs423fddsmndsflktsdf32343")
228
+ expect{User.encrypt(@text)}.to_not raise_error(ArgumentError)
229
+ end
230
+
231
+ it "if encryption algo is aes256, it should set key to crypto provider, even if attributes are set in reverse" do
232
+ sorcery_model_property_set(:encryption_key, nil)
233
+ sorcery_model_property_set(:encryption_algorithm, :none)
234
+ sorcery_model_property_set(:encryption_key, "asd234dfs423fddsmndsflktsdf32343")
235
+ sorcery_model_property_set(:encryption_algorithm, :aes256)
236
+ expect{User.encrypt(@text)}.to_not raise_error(ArgumentError)
237
+ end
238
+
239
+ it "if encryption algo is md5 it should work" do
240
+ sorcery_model_property_set(:encryption_algorithm, :md5)
241
+ User.encrypt(@text).should == Sorcery::CryptoProviders::MD5.encrypt(@text)
242
+ end
243
+
244
+ it "if encryption algo is sha1 it should work" do
245
+ sorcery_model_property_set(:encryption_algorithm, :sha1)
246
+ User.encrypt(@text).should == Sorcery::CryptoProviders::SHA1.encrypt(@text)
247
+ end
248
+
249
+ it "if encryption algo is sha256 it should work" do
250
+ sorcery_model_property_set(:encryption_algorithm, :sha256)
251
+ User.encrypt(@text).should == Sorcery::CryptoProviders::SHA256.encrypt(@text)
252
+ end
253
+
254
+ it "if encryption algo is sha512 it should work" do
255
+ sorcery_model_property_set(:encryption_algorithm, :sha512)
256
+ User.encrypt(@text).should == Sorcery::CryptoProviders::SHA512.encrypt(@text)
257
+ end
258
+
259
+ it "salt should be random for each user and saved in db" do
260
+ sorcery_model_property_set(:salt_attribute_name, :salt)
261
+ create_new_user
262
+ @user.salt.should_not be_nil
263
+ end
264
+
265
+ it "if salt is set should use it to encrypt" do
266
+ sorcery_model_property_set(:salt_attribute_name, :salt)
267
+ sorcery_model_property_set(:encryption_algorithm, :sha512)
268
+ create_new_user
269
+ @user.crypted_password.should_not == Sorcery::CryptoProviders::SHA512.encrypt('secret')
270
+ @user.crypted_password.should == Sorcery::CryptoProviders::SHA512.encrypt('secret',@user.salt)
271
+ end
272
+
273
+ it "if salt_join_token is set should use it to encrypt" do
274
+ sorcery_model_property_set(:salt_attribute_name, :salt)
275
+ sorcery_model_property_set(:salt_join_token, "-@=>")
276
+ sorcery_model_property_set(:encryption_algorithm, :sha512)
277
+ create_new_user
278
+ @user.crypted_password.should_not == Sorcery::CryptoProviders::SHA512.encrypt('secret')
279
+ Sorcery::CryptoProviders::SHA512.join_token = ""
280
+ @user.crypted_password.should_not == Sorcery::CryptoProviders::SHA512.encrypt('secret',@user.salt)
281
+ Sorcery::CryptoProviders::SHA512.join_token = User.sorcery_config.salt_join_token
282
+ @user.crypted_password.should == Sorcery::CryptoProviders::SHA512.encrypt('secret',@user.salt)
283
+ end
284
+
285
+ end
286
+
287
+ describe User, "external users" do
288
+ before(:all) do
289
+ ActiveRecord::Migrator.migrate("#{APP_ROOT}/db/migrate/external")
290
+ sorcery_reload!()
291
+ end
292
+
293
+ after(:all) do
294
+ ActiveRecord::Migrator.rollback("#{APP_ROOT}/db/migrate/external")
295
+ end
296
+
297
+ before(:each) do
298
+ User.delete_all
299
+ end
300
+
301
+ it "should respond to 'external?'" do
302
+ create_new_user
303
+ @user.should respond_to(:external?)
304
+ end
305
+
306
+ it "external? should be false for regular users" do
307
+ create_new_user
308
+ @user.external?.should be_false
309
+ end
310
+
311
+ it "external? should be true for external users" do
312
+ create_new_external_user(:twitter)
313
+ @user.external?.should be_true
314
+ end
315
+ end
316
+
317
+ end
@@ -0,0 +1,6 @@
1
+ class User < ActiveRecord::Base
2
+ attr_accessible :email, :password, :password_confirmation, :authentications_attributes
3
+
4
+ has_many :authentications, :dependent => :destroy
5
+ accepts_nested_attributes_for :authentications
6
+ end
@@ -0,0 +1,4 @@
1
+ <%= @user %> bla bla
2
+
3
+ hourdyasd
4
+ <bla>
@@ -0,0 +1,18 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+
4
+ require 'simplecov'
5
+ SimpleCov.root File.join(File.dirname(__FILE__), '..', 'lib')
6
+ SimpleCov.start
7
+
8
+
9
+ require 'rspec'
10
+ require 'sorcery'
11
+
12
+ # Requires supporting files with custom matchers and macros, etc,
13
+ # in ./support/ and its subdirectories.
14
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
15
+
16
+ RSpec.configure do |config|
17
+
18
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sorcery
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Noam Ben Ari
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-15 00:00:00 +02:00
13
+ date: 2011-04-17 00:00:00 +03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -196,16 +196,27 @@ files:
196
196
  - README.rdoc
197
197
  - Rakefile
198
198
  - VERSION
199
+ - lib/generators/sorcery_migration/sorcery_migration_generator.rb
200
+ - lib/generators/sorcery_migration/templates/activity_logging.rb
201
+ - lib/generators/sorcery_migration/templates/brute_force_protection.rb
202
+ - lib/generators/sorcery_migration/templates/core.rb
203
+ - lib/generators/sorcery_migration/templates/external.rb
204
+ - lib/generators/sorcery_migration/templates/remember_me.rb
205
+ - lib/generators/sorcery_migration/templates/reset_password.rb
206
+ - lib/generators/sorcery_migration/templates/user_activation.rb
199
207
  - lib/sorcery.rb
200
208
  - lib/sorcery/controller.rb
209
+ - lib/sorcery/controller/adapters/sinatra.rb
201
210
  - lib/sorcery/controller/submodules/activity_logging.rb
202
211
  - lib/sorcery/controller/submodules/brute_force_protection.rb
212
+ - lib/sorcery/controller/submodules/email.rb
213
+ - lib/sorcery/controller/submodules/external.rb
214
+ - lib/sorcery/controller/submodules/external/protocols/oauth1.rb
215
+ - lib/sorcery/controller/submodules/external/protocols/oauth2.rb
216
+ - lib/sorcery/controller/submodules/external/providers/facebook.rb
217
+ - lib/sorcery/controller/submodules/external/providers/twitter.rb
203
218
  - lib/sorcery/controller/submodules/http_basic_auth.rb
204
219
  - lib/sorcery/controller/submodules/oauth.rb
205
- - lib/sorcery/controller/submodules/oauth/oauth1.rb
206
- - lib/sorcery/controller/submodules/oauth/oauth2.rb
207
- - lib/sorcery/controller/submodules/oauth/providers/facebook.rb
208
- - lib/sorcery/controller/submodules/oauth/providers/twitter.rb
209
220
  - lib/sorcery/controller/submodules/remember_me.rb
210
221
  - lib/sorcery/controller/submodules/session_timeout.rb
211
222
  - lib/sorcery/crypto_providers/aes256.rb
@@ -218,12 +229,15 @@ files:
218
229
  - lib/sorcery/model.rb
219
230
  - lib/sorcery/model/submodules/activity_logging.rb
220
231
  - lib/sorcery/model/submodules/brute_force_protection.rb
221
- - lib/sorcery/model/submodules/oauth.rb
232
+ - lib/sorcery/model/submodules/external.rb
222
233
  - lib/sorcery/model/submodules/remember_me.rb
223
234
  - lib/sorcery/model/submodules/reset_password.rb
224
235
  - lib/sorcery/model/submodules/user_activation.rb
225
236
  - lib/sorcery/model/temporary_token.rb
237
+ - lib/sorcery/sinatra.rb
226
238
  - lib/sorcery/test_helpers.rb
239
+ - lib/sorcery/test_helpers/rails.rb
240
+ - lib/sorcery/test_helpers/sinatra.rb
227
241
  - sorcery.gemspec
228
242
  - spec/Gemfile
229
243
  - spec/Gemfile.lock
@@ -268,7 +282,7 @@ files:
268
282
  - spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
269
283
  - spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
270
284
  - spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb
271
- - spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb
285
+ - spec/rails3/app_root/db/migrate/external/20101224223628_create_authentications.rb
272
286
  - spec/rails3/app_root/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
273
287
  - spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
274
288
  - spec/rails3/app_root/db/schema.rb
@@ -307,8 +321,42 @@ files:
307
321
  - spec/rails3/app_root/spec/user_reset_password_spec.rb
308
322
  - spec/rails3/app_root/spec/user_spec.rb
309
323
  - spec/rails3/app_root/vendor/plugins/.gitkeep
324
+ - spec/sinatra/Gemfile
325
+ - spec/sinatra/Gemfile.lock
326
+ - spec/sinatra/Rakefile
327
+ - spec/sinatra/authentication.rb
328
+ - spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb
329
+ - spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
330
+ - spec/sinatra/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
331
+ - spec/sinatra/db/migrate/core/20101224223620_create_users.rb
332
+ - spec/sinatra/db/migrate/external/20101224223628_create_authentications.rb
333
+ - spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
334
+ - spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
335
+ - spec/sinatra/filters.rb
336
+ - spec/sinatra/myapp.rb
337
+ - spec/sinatra/sorcery_mailer.rb
338
+ - spec/sinatra/spec/controller_activity_logging_spec.rb
339
+ - spec/sinatra/spec/controller_brute_force_protection_spec.rb
340
+ - spec/sinatra/spec/controller_http_basic_auth_spec.rb
341
+ - spec/sinatra/spec/controller_oauth2_spec.rb
342
+ - spec/sinatra/spec/controller_oauth_spec.rb
343
+ - spec/sinatra/spec/controller_remember_me_spec.rb
344
+ - spec/sinatra/spec/controller_session_timeout_spec.rb
345
+ - spec/sinatra/spec/controller_spec.rb
346
+ - spec/sinatra/spec/spec.opts
347
+ - spec/sinatra/spec/spec_helper.rb
348
+ - spec/sinatra/spec/user_activation_spec.rb
349
+ - spec/sinatra/spec/user_activity_logging_spec.rb
350
+ - spec/sinatra/spec/user_brute_force_protection_spec.rb
351
+ - spec/sinatra/spec/user_oauth_spec.rb
352
+ - spec/sinatra/spec/user_remember_me_spec.rb
353
+ - spec/sinatra/spec/user_reset_password_spec.rb
354
+ - spec/sinatra/spec/user_spec.rb
355
+ - spec/sinatra/user.rb
356
+ - spec/sinatra/views/test_login.erb
310
357
  - spec/sorcery_crypto_providers_spec.rb
311
358
  - spec/spec_helper.rb
359
+ - spec/untitled folder
312
360
  has_rdoc: true
313
361
  homepage: http://github.com/NoamB/sorcery
314
362
  licenses:
@@ -360,7 +408,7 @@ test_files:
360
408
  - spec/rails3/app_root/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
361
409
  - spec/rails3/app_root/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
362
410
  - spec/rails3/app_root/db/migrate/core/20101224223620_create_users.rb
363
- - spec/rails3/app_root/db/migrate/oauth/20101224223628_create_authentications.rb
411
+ - spec/rails3/app_root/db/migrate/external/20101224223628_create_authentications.rb
364
412
  - spec/rails3/app_root/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
365
413
  - spec/rails3/app_root/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
366
414
  - spec/rails3/app_root/db/schema.rb
@@ -382,5 +430,33 @@ test_files:
382
430
  - spec/rails3/app_root/spec/user_remember_me_spec.rb
383
431
  - spec/rails3/app_root/spec/user_reset_password_spec.rb
384
432
  - spec/rails3/app_root/spec/user_spec.rb
433
+ - spec/sinatra/authentication.rb
434
+ - spec/sinatra/db/migrate/activation/20101224223622_add_activation_to_users.rb
435
+ - spec/sinatra/db/migrate/activity_logging/20101224223624_add_activity_logging_to_users.rb
436
+ - spec/sinatra/db/migrate/brute_force_protection/20101224223626_add_brute_force_protection_to_users.rb
437
+ - spec/sinatra/db/migrate/core/20101224223620_create_users.rb
438
+ - spec/sinatra/db/migrate/external/20101224223628_create_authentications.rb
439
+ - spec/sinatra/db/migrate/remember_me/20101224223623_add_remember_me_token_to_users.rb
440
+ - spec/sinatra/db/migrate/reset_password/20101224223622_add_reset_password_to_users.rb
441
+ - spec/sinatra/filters.rb
442
+ - spec/sinatra/myapp.rb
443
+ - spec/sinatra/sorcery_mailer.rb
444
+ - spec/sinatra/spec/controller_activity_logging_spec.rb
445
+ - spec/sinatra/spec/controller_brute_force_protection_spec.rb
446
+ - spec/sinatra/spec/controller_http_basic_auth_spec.rb
447
+ - spec/sinatra/spec/controller_oauth2_spec.rb
448
+ - spec/sinatra/spec/controller_oauth_spec.rb
449
+ - spec/sinatra/spec/controller_remember_me_spec.rb
450
+ - spec/sinatra/spec/controller_session_timeout_spec.rb
451
+ - spec/sinatra/spec/controller_spec.rb
452
+ - spec/sinatra/spec/spec_helper.rb
453
+ - spec/sinatra/spec/user_activation_spec.rb
454
+ - spec/sinatra/spec/user_activity_logging_spec.rb
455
+ - spec/sinatra/spec/user_brute_force_protection_spec.rb
456
+ - spec/sinatra/spec/user_oauth_spec.rb
457
+ - spec/sinatra/spec/user_remember_me_spec.rb
458
+ - spec/sinatra/spec/user_reset_password_spec.rb
459
+ - spec/sinatra/spec/user_spec.rb
460
+ - spec/sinatra/user.rb
385
461
  - spec/sorcery_crypto_providers_spec.rb
386
462
  - spec/spec_helper.rb
@@ -1,26 +0,0 @@
1
- require 'oauth'
2
- module Sorcery
3
- module Controller
4
- module Submodules
5
- module Oauth
6
- module Oauth1
7
- def oauth_version
8
- "1.0"
9
- end
10
-
11
- def get_request_token
12
- ::OAuth::Consumer.new(@key, @secret, :site => @site).get_request_token(:oauth_callback => @callback_url)
13
- end
14
-
15
- def authorize_url(args)
16
- args[:request_token].authorize_url(:oauth_callback => @callback_url)
17
- end
18
-
19
- def get_access_token(args)
20
- args[:request_token].get_access_token(:oauth_verifier => args[:oauth_verifier])
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,24 +0,0 @@
1
- require 'oauth2'
2
- module Sorcery
3
- module Controller
4
- module Submodules
5
- module Oauth
6
- module Oauth2
7
- def oauth_version
8
- "2.0"
9
- end
10
-
11
- def authorize_url(args)
12
- client = ::OAuth2::Client.new(@key, @secret, :site => @site)
13
- client.web_server.authorize_url(:redirect_uri => @callback_url, :scope => @scope)
14
- end
15
-
16
- def get_access_token(args)
17
- client = ::OAuth2::Client.new(@key, @secret, :site => @site)
18
- client.web_server.get_access_token(args[:code], :redirect_uri => @callback_url)
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end