Module: Authlogic::Session::Cookies

Included in:
Base
Defined in:
lib/authlogic/session/cookies.rb

Overview

Cookies

Handles all authentication that deals with cookies, such as persisting a session and saving / destroying a session.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


7
8
9
10
# File 'lib/authlogic/session/cookies.rb', line 7

def self.included(klass)
  klass.after_save :save_cookie, :if => :persisting?
  klass.after_destroy :destroy_cookie, :if => :persisting?
end

Instance Method Details

#valid_cookie?Boolean

Tries to validate the session from information in the cookie

Returns:

  • (Boolean)

13
14
15
16
17
18
19
20
# File 'lib/authlogic/session/cookies.rb', line 13

def valid_cookie?
  if cookie_credentials
    self.unauthorized_record = search_for_record("find_by_#{persistence_token_field}", cookie_credentials)
    valid?
  else
    false
  end
end