authgasm 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.10.1 released 2008-10-24
2
+
3
+ * Sessions now store the "remember token" instead of the id. This is much safer and guarantees all "sessions" that are logged in are logged in with a valid password. This way stale sessions can't be persisted.
4
+ * Bumped security to Sha512 from Sha256.
5
+ * Remove attr_protected call in acts_as_authentic
6
+ * protected_password should use pasword_field configuration value
7
+ * changed magic state "inactive" to "active"
8
+
1
9
  == 0.10.0 released 2008-10-24
2
10
 
3
11
  * Do not allow instantiation if the session has not been activated with a controller object. Just like ActiveRecord won't let you do anything without a DB connection.
data/Manifest CHANGED
@@ -8,7 +8,7 @@ lib/authgasm/session/base.rb
8
8
  lib/authgasm/session/callbacks.rb
9
9
  lib/authgasm/session/config.rb
10
10
  lib/authgasm/session/errors.rb
11
- lib/authgasm/sha256_crypto_provider.rb
11
+ lib/authgasm/sha512_crypto_provider.rb
12
12
  lib/authgasm/version.rb
13
13
  lib/authgasm.rb
14
14
  Manifest
data/README.rdoc CHANGED
@@ -2,10 +2,12 @@
2
2
 
3
3
  Authgasm is "rails authentication done right"
4
4
 
5
- The last thing we need is another authentication solution for rails, right? That's what I thought. It was disappointing to find that all of the current solutions were overly complicated, bloated, poorly written, littered my application with code, and were just plain confusing. They felt very Microsoftish. This is not the simple / elegant rails we all fell in love with. It's like some Microsoft .NET engineers decided to dabble in ruby / rails for a day and their project was to write an authentication solution. That's what went through my head when I was trying out all of the current solutions. It's time someone makes a "rails like" authentication solution. So I give you Authgasm...
5
+ The last thing we need is another authentication solution for rails, right? That's what I thought. It was disappointing to find that all of the current solutions were overly complicated, bloated, poorly written, littered my application with code, or were just plain confusing. They felt very Microsoftish. It's like some Microsoft .NET engineers decided to dabble in ruby / rails for a day and their project was to write an authentication solution. This is not the simple / elegant rails we all fell in love with. It's time someone makes a "rails like" authentication solution. So I give you Authgasm...
6
6
 
7
7
  What if you could have authentication up and running in minutes without having to run a generator? All because it's simple, like everything else in rails.
8
8
 
9
+ Wouldn't it be nice to keep your app up to date with the latest and greatest security techniques with a simple update of a plugin?
10
+
9
11
  What if creating a user session could be as simple as...
10
12
 
11
13
  UserSession.create(params[:user])
@@ -128,9 +130,9 @@ Just like ActiveRecord has "magic" columns, such as: created_at and updated_at.
128
130
  Authgasm tries to check the state of the record before creating the session. If your record responds to the following methods and any of them return false, validation will fail:
129
131
 
130
132
  Method name Description
133
+ active? Is the record marked as active?
131
134
  approved? Has the record been approved?
132
135
  confirmed? Has the record been conirmed?
133
- inactive? Is the record marked as inactive?
134
136
 
135
137
  What's neat about this is that these are checked upon any type of login. When logging in explicitly, by cookie, session, or basic http auth. So if you mark a user inactive in the middle of their session they wont be logged back in next time they refresh the page. Giving you complete control.
136
138
 
@@ -169,7 +171,9 @@ The errors in Authgasm work JUST LIKE ActiveRecord. In fact, it uses the exact s
169
171
 
170
172
  This is one of my favorite features that I think its pretty cool. It's things like this that make a library great and let you know you are on the right track.
171
173
 
172
- What if a user changes their password? You have to re-log them in with the new password, recreate the session, etc, pain in the ass. Or what if a user creates a new user account? You have to do the same thing. Here's an even better one: what if a user is in the admin area and changes his own password? There might even be another place passwords can change. It shouldn't matter, your code should be written in a way where you don't have to remember to do this.
174
+ Just to clear up any confusion, Authgasm does not store the plain id in the session. It stores a token. This token changes with the password, this way stale sessions can not be persisted.
175
+
176
+ That being said...What if a user changes their password? You have to re-log them in with the new password, recreate the session, etc, pain in the ass. Or what if a user creates a new user account? You have to do the same thing. Here's an even better one: what if a user is in the admin area and changes his own password? There might even be another place passwords can change. It shouldn't matter, your code should be written in a way where you don't have to remember to do this.
173
177
 
174
178
  Instead of updating sessions all over the place, doesn't it make sense to do this at a lower level? Like the User model? You're saying "but Ben, models can't mess around with sessions and cookies". True...but Authgasm can, and you can access Authgasm just like a model. I know in most situations it's not good practice to do this but I view this in the same class as sweepers, and feel like it actually is good practice here. User sessions are directly tied to users, they should be connected on the model level.
175
179
 
@@ -230,5 +234,23 @@ Interested in how all of this all works? Basically a before_filter is automatica
230
234
 
231
235
  From there it is pretty simple. When you try to create a new session the record is authenticated and then all of the session / cookie magic is done for you. The sky is the limit.
232
236
 
237
+ == What's wrong with the current solutions?
238
+
239
+ You probably don't care, but I think releasing the millionth authentication solution for a framework that has been around for over 4 years requires a little explanation.
240
+
241
+ I don't necessarily think the current solutions are "wrong", nor am I saying Authgasm is the answer to our prayers. But the current solutions were pretty disappointing. Especially when the rails community is full of brilliant programmers, and the best we could come up with was the "restful-authentication" plugin. This was just sad, and frankly kind of irritated me. Here's why...
242
+
243
+ === Generators are not the answer
244
+
245
+ Generators have their place, and it certainly is not to add authentication to a rails app. It doesn't make sense. Generators are meant to be a starting point for repetitive tasks that have no sustainable pattern. Take controllers, the set up is the same thing over and over, but they eventually evolve to a point where there is no clear cut pattern. Trying to extract a pattern out into a library would be extremely hard, messy, and overly complicated. As a result, generators make sense here.
246
+
247
+ Authentication is a one time set up process for your app. It's the same thing over and over and the pattern never really changes. The only time it changes is to conform with newer / stricter security techniques. This is exactly why generators should not be an authentication solution. Generators litter your application with code that you get to maintain. You get to make sure it stays up with the latest and greatest security techniques. How fun! Oh, and when the plugin you used releases some major update, you can't just re-run the generator, you get to sift through the code to see what changed! Awesome! The cherry on top is the fact that you get to go through every app you've made and apply this update. You don't really have a choice either, because you can't ignore security updates. When ActiveRecord releases an update do you go through it line by line and manually apply it in each one of your apps? No.
248
+
249
+ Security moves fast, and hackers make sure of this. As a result, it should be easy to update. Doesn't it make sense to leverage a library to handle this functionality for you? This way, when some new security technique is released, or a bug with your authentication system is found, you can fix it with a simple update. Just like everything else in ruby / rails.
250
+
251
+ === Limited to a single authentication
252
+
253
+ I recently had an app where you could log in as a user and also log in as an employee. I won't go into the specifics of the app, but it make the most sense to do it this way. So I had two sessions in one app. None of the current solutions I found easily supported this. They all assumed a single session. One session was messy enough, adding another just put me over the edge and eventually forced me to write Authgasm. Authgasm can support 100 different sessions easily and in a clean format. Just like an app can support 100 different models and 100 different records of each model.
254
+
233
255
 
234
256
  Copyright (c) 2008 Ben Johnson of [Binary Logic](http://www.binarylogic.com), released under the MIT license
data/authgasm.gemspec CHANGED
@@ -1,18 +1,18 @@
1
1
 
2
- # Gem::Specification for Authgasm-0.10.0
2
+ # Gem::Specification for Authgasm-0.10.1
3
3
  # Originally generated by Echoe
4
4
 
5
5
  --- !ruby/object:Gem::Specification
6
6
  name: authgasm
7
7
  version: !ruby/object:Gem::Version
8
- version: 0.10.0
8
+ version: 0.10.1
9
9
  platform: ruby
10
10
  authors:
11
11
  - Ben Johnson of Binary Logic
12
12
  autorequire:
13
13
  bindir: bin
14
14
 
15
- date: 2008-10-27 00:00:00 -04:00
15
+ date: 2008-10-28 00:00:00 -04:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -61,7 +61,7 @@ extra_rdoc_files:
61
61
  - lib/authgasm/session/callbacks.rb
62
62
  - lib/authgasm/session/config.rb
63
63
  - lib/authgasm/session/errors.rb
64
- - lib/authgasm/sha256_crypto_provider.rb
64
+ - lib/authgasm/sha512_crypto_provider.rb
65
65
  - lib/authgasm/version.rb
66
66
  - lib/authgasm.rb
67
67
  - README.rdoc
@@ -76,7 +76,7 @@ files:
76
76
  - lib/authgasm/session/callbacks.rb
77
77
  - lib/authgasm/session/config.rb
78
78
  - lib/authgasm/session/errors.rb
79
- - lib/authgasm/sha256_crypto_provider.rb
79
+ - lib/authgasm/sha512_crypto_provider.rb
80
80
  - lib/authgasm/version.rb
81
81
  - lib/authgasm.rb
82
82
  - Manifest
data/lib/authgasm.rb CHANGED
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + "/authgasm/version"
3
3
 
4
4
  require File.dirname(__FILE__) + "/authgasm/controller_adapters/rails_adapter" if defined?(Rails)
5
5
 
6
- require File.dirname(__FILE__) + "/authgasm/sha256_crypto_provider"
6
+ require File.dirname(__FILE__) + "/authgasm/sha512_crypto_provider"
7
7
  require File.dirname(__FILE__) + "/authgasm/acts_as_authentic"
8
8
  require File.dirname(__FILE__) + "/authgasm/session/active_record_trickery"
9
9
  require File.dirname(__FILE__) + "/authgasm/session/callbacks"
@@ -49,7 +49,7 @@ module Authgasm
49
49
  def acts_as_authentic(options = {})
50
50
  # Setup default options
51
51
  options[:session_class] ||= "#{name}Session".constantize
52
- options[:crypto_provider] ||= Sha256CryptoProvider
52
+ options[:crypto_provider] ||= Sha512CryptoProvider
53
53
  options[:crypto_provider_type] ||= options[:crypto_provider].respond_to?(:decrypt) ? :encryption : :hash
54
54
  options[:login_field] ||= options[:session_class].login_field
55
55
  options[:login_field_type] ||= options[:login_field] == :email ? :email : :login
@@ -84,6 +84,7 @@ module Authgasm
84
84
  end
85
85
 
86
86
  validates_uniqueness_of options[:login_field]
87
+ validates_uniqueness_of options[:remember_token_field]
87
88
  validate :validate_password
88
89
  validates_numericality_of :login_count, :only_integer => :true, :greater_than_or_equal_to => 0, :allow_nil => true if column_names.include?("login_count")
89
90
 
@@ -93,12 +94,12 @@ module Authgasm
93
94
  end
94
95
 
95
96
  after_create :create_sessions!
97
+ before_update :find_my_sessions
96
98
  after_update :update_sessions!
97
99
 
98
100
  # Attributes
99
101
  attr_writer "confirm_#{options[:password_field]}"
100
102
  attr_accessor "tried_to_set_#{options[:password_field]}"
101
- attr_protected "tried_to_set_#{options[:password_field]}"
102
103
 
103
104
  # Class methods
104
105
  class_eval <<-"end_eval", __FILE__, __LINE__
@@ -208,18 +209,28 @@ module Authgasm
208
209
  #{options[:session_class]}.create(*args)
209
210
  end
210
211
 
211
- def update_sessions!
212
+ def find_my_sessions
212
213
  return if @saving_from_session || !#{options[:session_class]}.activated?
213
214
 
215
+ @my_sessions = []
214
216
  #{options[:session_ids].inspect}.each do |session_id|
215
217
  session = #{options[:session_class]}.find(*[session_id].compact)
216
218
 
217
219
  # Ignore if we can't find the session or the session isn't this record
218
220
  next if !session || session.record != self
219
221
 
220
- # We know we are logged in and this is our record, update the session
221
- session.save
222
+ @my_sessions << session
223
+ end
224
+ end
225
+
226
+ def update_sessions!
227
+ return if @saving_from_session || !#{options[:session_class]}.activated?
228
+
229
+ @my_sessions.each do |stale_session|
230
+ stale_session.unauthorized_record = self
231
+ stale_session.save
222
232
  end
233
+ @my_sessions = nil
223
234
  end
224
235
 
225
236
  def tried_to_set_password?
@@ -261,8 +261,8 @@ module Authgasm
261
261
 
262
262
  case login_with
263
263
  when :credentials
264
- errors.add(login_field, "can not be blank") if login.blank?
265
- errors.add(password_field, "can not be blank") if protected_password.blank?
264
+ errors.add(login_field, "can not be blank") if send(login_field).blank?
265
+ errors.add(password_field, "can not be blank") if send("protected_#{password_field}").blank?
266
266
  return false if errors.count > 0
267
267
 
268
268
  temp_record = klass.send(find_by_login_method, send(login_field))
@@ -272,7 +272,7 @@ module Authgasm
272
272
  return false
273
273
  end
274
274
 
275
- unless temp_record.send(verify_password_method, protected_password)
275
+ unless temp_record.send(verify_password_method, send("protected_#{password_field}"))
276
276
  errors.add(password_field, "is invalid")
277
277
  return false
278
278
  end
@@ -291,9 +291,9 @@ module Authgasm
291
291
  return false
292
292
  end
293
293
 
294
- [:approved, :confirmed, :inactive].each do |required_status|
294
+ [:active, :approved, :confirmed].each do |required_status|
295
295
  if temp_record.respond_to?("#{required_status}?") && !temp_record.send("#{required_status}?")
296
- errors.add_to_base("Your account has not been #{required_status}")
296
+ errors.add_to_base("Your account has not been marked as #{required_status}")
297
297
  return false
298
298
  end
299
299
  end
@@ -336,7 +336,7 @@ module Authgasm
336
336
 
337
337
  def valid_session?
338
338
  if session_credentials
339
- self.unauthorized_record = klass.find_by_id(session_credentials)
339
+ self.unauthorized_record = klass.send("find_by_#{remember_token_field}", cookie_credentials)
340
340
  result = valid?
341
341
  if result
342
342
  self.new_session = false
@@ -373,6 +373,12 @@ module Authgasm
373
373
  end
374
374
 
375
375
  def #{password_field}; end
376
+
377
+ private
378
+ # The password should not be accessible publicly. This way forms using form_for don't fill the password with the attempted password. The prevent this we just create this method that is private.
379
+ def protected_#{password_field}
380
+ @#{password_field}
381
+ end
376
382
  end_eval
377
383
  end
378
384
 
@@ -384,17 +390,12 @@ module Authgasm
384
390
  self.class.klass_name
385
391
  end
386
392
 
387
- # The password should not be accessible publicly. This way forms using form_for don't fill the password with the attempted password. The prevent this we just create this method that is private.
388
- def protected_password
389
- @password
390
- end
391
-
392
393
  def session_credentials
393
394
  controller.session[session_key]
394
395
  end
395
396
 
396
397
  def update_session!
397
- controller.session[session_key] = record && record.id
398
+ controller.session[session_key] = record && record.send(remember_token_field)
398
399
  end
399
400
  end
400
401
  end
@@ -136,10 +136,10 @@ module Authgasm
136
136
 
137
137
  # Works exactly like cookie_key, but for sessions. See cookie_key for more info.
138
138
  #
139
- # * <tt>Default:</tt> :#{klass_name.underscore}_id
139
+ # * <tt>Default:</tt> cookie_key
140
140
  # * <tt>Accepts:</tt> Symbol or String
141
141
  def session_key
142
- @session_key ||= "#{klass_name.underscore}_id".to_sym
142
+ @session_key ||= cookie_key
143
143
  end
144
144
  attr_writer :session_key
145
145
 
@@ -1,13 +1,13 @@
1
1
  module Authgasm
2
- # = Sha256 Crypto Provider
2
+ # = Sha512 Crypto Provider
3
3
  #
4
4
  # The acts_as_authentic method allows you to pass a :crypto_provider option. This allows you to use any type of encryption you like. Just create a class with a class level encrypt and decrypt method.
5
5
  # The password will be passed as the single parameter to each of these methods so you can do your magic.
6
6
  #
7
7
  # If you are encrypting via a hash just don't include a decrypt method, since hashes can't be decrypted. Authgasm will notice this adjust accordingly.
8
- class Sha256CryptoProvider
8
+ class Sha512CryptoProvider
9
9
  def self.encrypt(pass)
10
- Digest::SHA256.hexdigest(pass)
10
+ Digest::SHA512.hexdigest(pass)
11
11
  end
12
12
  end
13
13
  end
@@ -44,7 +44,7 @@ module Authgasm # :nodoc:
44
44
 
45
45
  MAJOR = 0
46
46
  MINOR = 10
47
- TINY = 0
47
+ TINY = 1
48
48
 
49
49
  # The current version as a Version instance
50
50
  CURRENT = new(MAJOR, MINOR, TINY)
@@ -10,11 +10,11 @@
10
10
  <body>
11
11
 
12
12
  <% if !@current_user %>
13
- <%= link_to "Register", new_user_path %> |
13
+ <%= link_to "Register", new_account_path %> |
14
14
  <%= link_to "Log In", new_user_session_path %>
15
15
  <% else %>
16
16
  <%= link_to "My Account", account_path %> |
17
- <%= link_to "Logout", logout_path, :confirm => "Are you sure you want to logout?" %>
17
+ <%= link_to "Logout", user_session_path, :method => :delete, :confirm => "Are you sure you want to logout?" %>
18
18
  <% end %>
19
19
 
20
20
  <p style="color: green"><%= flash[:notice] %></p>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <%= error_messages_for "user_session", :header_message => nil %>
4
4
 
5
- <% form_for @user_session do |f| %>
5
+ <% form_for @user_session, :url => user_session_path do |f| %>
6
6
  <%= f.label :login %><br />
7
7
  <%= f.text_field :login %><br />
8
8
  <br />
@@ -2,7 +2,7 @@
2
2
 
3
3
  <%= error_messages_for "user" %>
4
4
 
5
- <% form_for @user do |f| %>
5
+ <% form_for @user, :url => account_path do |f| %>
6
6
  <%= render :partial => "form", :object => f %>
7
7
  <%= f.submit "Update" %>
8
8
  <% end %>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <%= error_messages_for "user" %>
4
4
 
5
- <% form_for @user do |f| %>
5
+ <% form_for @user, :url => account_path do |f| %>
6
6
  <%= render :partial => "form", :object => f %>
7
7
  <%= f.submit "Register" %>
8
8
  <% end %>
@@ -1,7 +1,5 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
- map.resources :users
3
- map.resources :user_sessions
2
+ map.resource :user_session
4
3
  map.resource :account, :controller => "users"
5
- map.logout "/logout", :controller => "user_sessions", :action => "destroy"
6
4
  map.default "/", :controller => "user_sessions", :action => "new"
7
5
  end
Binary file
Binary file
@@ -2,7 +2,7 @@ ben:
2
2
  id: 1
3
3
  login: bjohnson
4
4
  password_salt: <%= salt = User.unique_token %>
5
- crypted_password: <%= Authgasm::Sha256CryptoProvider.encrypt("benrocks" + salt) %>
6
- remember_token: 23a1d7c66f456b14b45211aa656ce8ba7052fd220cd2d07a5c323792938f2a14
5
+ crypted_password: <%= Authgasm::Sha512CryptoProvider.encrypt("benrocks" + salt) %>
6
+ remember_token: 6cde0674657a8a313ce952df979de2830309aa4c11ca65805dd00bfdc65dbcc2f5e36718660a1d2e68c1a08c276d996763985d2f06fd3d076eb7bc4d97b1e317
7
7
  first_name: Ben
8
8
  last_name: Johnson
@@ -14,21 +14,21 @@ class UserSessionsControllerTest < ActionController::TestCase
14
14
 
15
15
  def test_successful_create
16
16
  get :create, {:user_session => {:login => "bjohnson", :password => "benrocks"}}
17
- assert_equal 1, session[:user_id]
18
- assert_equal ["23a1d7c66f456b14b45211aa656ce8ba7052fd220cd2d07a5c323792938f2a14"], cookies["user_credentials"]
17
+ assert_equal "6cde0674657a8a313ce952df979de2830309aa4c11ca65805dd00bfdc65dbcc2f5e36718660a1d2e68c1a08c276d996763985d2f06fd3d076eb7bc4d97b1e317", session[:user_credentials]
18
+ assert_equal ["6cde0674657a8a313ce952df979de2830309aa4c11ca65805dd00bfdc65dbcc2f5e36718660a1d2e68c1a08c276d996763985d2f06fd3d076eb7bc4d97b1e317"], cookies["user_credentials"]
19
19
  assert_redirected_to account_url
20
20
  end
21
21
 
22
22
  def test_unsuccessful_create
23
23
  get :create, {:user_session => {:login => "bjohnson", :password => "badpassword"}}
24
- assert_equal nil, session[:user_id]
24
+ assert_equal nil, session[:user_credentials]
25
25
  assert_equal nil, cookies["user_credentials"]
26
26
  assert_template "new"
27
27
  end
28
28
 
29
29
  def test_destroy
30
30
  get :destroy
31
- assert_equal nil, session[:user_id]
31
+ assert_equal nil, session[:user_credentials]
32
32
  assert_equal nil, cookies["user_credentials"]
33
33
  assert_redirected_to new_user_session_url
34
34
  assert flash.key?(:notice)
@@ -10,11 +10,11 @@ class UserSessionStoriesTest < ActionController::IntegrationTest
10
10
  assert_template "user_sessions/new"
11
11
 
12
12
  # Try to register with no info
13
- post users_url
13
+ post account_url
14
14
  assert_template "users/new"
15
15
 
16
16
  # Register successfully
17
- post users_url, {:user => {:login => "binarylogic", :password => "pass", :confirm_password => "pass", :first_name => "Ben", :last_name => "Johnson"}}
17
+ post account_url, {:user => {:login => "binarylogic", :password => "pass", :confirm_password => "pass", :first_name => "Ben", :last_name => "Johnson"}}
18
18
  assert_redirected_to account_url
19
19
  assert flash.key?(:notice)
20
20
 
@@ -41,14 +41,14 @@ class UserSessionStoriesTest < ActionController::IntegrationTest
41
41
  assert_template "users/show"
42
42
 
43
43
  # Try to register after a successful login
44
- get new_user_url
44
+ get new_account_url
45
45
  assert_redirected_to account_url
46
46
  follow_redirect!
47
47
  assert flash.key?(:notice)
48
48
  assert_template "users/show"
49
49
 
50
50
  access_account
51
- logout(new_user_url) # before I tried to register, it stored my location
51
+ logout(new_account_url) # before I tried to register, it stored my location
52
52
 
53
53
  # Try to access my account again
54
54
  get account_url
@@ -26,7 +26,7 @@ class UserSessionTest < ActionController::IntegrationTest
26
26
 
27
27
  def test_find
28
28
  assert_equal nil, UserSession.find
29
- post user_sessions_url, {:user_session => {:login => "bjohnson", :password => "benrocks"}}
29
+ login_successfully("bjohnson", "benrocks")
30
30
  assert UserSession.find
31
31
  end
32
32
 
@@ -46,7 +46,7 @@ class ActionController::IntegrationTest
46
46
 
47
47
  private
48
48
  def login_successfully(login, password)
49
- post user_sessions_url, :user_session => {:login => login, :password => password}
49
+ post user_session_url, :user_session => {:login => login, :password => password}
50
50
  assert_redirected_to account_url
51
51
  follow_redirect!
52
52
  assert_template "users/show"
@@ -54,7 +54,7 @@ class ActionController::IntegrationTest
54
54
 
55
55
  def login_unsuccessfully(login = nil, password = nil)
56
56
  params = (login || password) ? {:user_session => {:login => login, :password => password}} : nil
57
- post user_sessions_url, params
57
+ post user_session_url, params
58
58
  assert_template "user_sessions/new"
59
59
  end
60
60
 
@@ -63,7 +63,7 @@ class ActionController::IntegrationTest
63
63
  # Perform multiple requests to make sure the session is persisting properly, just being anal here
64
64
  3.times do
65
65
  get account_url
66
- assert_equal user.id, session["user_id"]
66
+ assert_equal user.remember_token, session["user_credentials"]
67
67
  assert_equal user.remember_token, cookies["user_credentials"]
68
68
  assert_response :success
69
69
  assert_template "users/show"
@@ -72,12 +72,12 @@ class ActionController::IntegrationTest
72
72
 
73
73
  def logout(alt_redirect = nil)
74
74
  redirecting_to = alt_redirect || new_user_session_url
75
- get logout_url
75
+ delete user_session_url
76
76
  assert_redirected_to redirecting_to # because I tried to access registration above, and it stored it
77
77
  follow_redirect!
78
78
  assert flash.key?(:notice)
79
- assert_equal nil, session["user_id"]
79
+ assert_equal nil, session["user_credentials"]
80
80
  assert_equal "", cookies["user_credentials"]
81
- assert_template redirecting_to.gsub("http://www.example.com/", "")
81
+ assert_template redirecting_to.gsub("http://www.example.com/", "").gsub("user_session", "user_sessions").gsub("account", "users")
82
82
  end
83
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authgasm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson of Binary Logic
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-27 00:00:00 -04:00
12
+ date: 2008-10-28 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -58,7 +58,7 @@ extra_rdoc_files:
58
58
  - lib/authgasm/session/callbacks.rb
59
59
  - lib/authgasm/session/config.rb
60
60
  - lib/authgasm/session/errors.rb
61
- - lib/authgasm/sha256_crypto_provider.rb
61
+ - lib/authgasm/sha512_crypto_provider.rb
62
62
  - lib/authgasm/version.rb
63
63
  - lib/authgasm.rb
64
64
  - README.rdoc
@@ -73,7 +73,7 @@ files:
73
73
  - lib/authgasm/session/callbacks.rb
74
74
  - lib/authgasm/session/config.rb
75
75
  - lib/authgasm/session/errors.rb
76
- - lib/authgasm/sha256_crypto_provider.rb
76
+ - lib/authgasm/sha512_crypto_provider.rb
77
77
  - lib/authgasm/version.rb
78
78
  - lib/authgasm.rb
79
79
  - Manifest