Module: Authlogic::Session::Cookies::Config

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

Overview

Configuration for the cookie feature set.

Instance Method Summary collapse

Instance Method Details

The name of the cookie or the key in the cookies hash. Be sure and use a unique name. If you have multiple sessions and they use the same cookie it will cause problems. Also, if a id is set it will be inserted into the beginning of the string. Exmaple:

session = UserSession.new
session.cookie_key => "user_credentials"

session = UserSession.new(:super_high_secret)
session.cookie_key => "super_high_secret_user_credentials"
  • Default: “#Authlogic::Session::Cookies::Config.klass_nameklass_name.underscore_credentials”

  • Accepts: String



28
29
30
# File 'lib/authlogic/session/cookies.rb', line 28

def cookie_key(value = nil)
  rw_config(:cookie_key, value, "#{klass_name.underscore}_credentials")
end

#httponly(value = nil) ⇒ Object Also known as: httponly=

Should the cookie be set as httponly? If true, the cookie will not be accessable from javascript

  • Default: false

  • Accepts: Boolean



64
65
66
# File 'lib/authlogic/session/cookies.rb', line 64

def httponly(value = nil)
  rw_config(:httponly, value, false)
end

#remember_me(value = nil) ⇒ Object Also known as: remember_me=

If sessions should be remembered by default or not.

  • Default: false

  • Accepts: Boolean



37
38
39
# File 'lib/authlogic/session/cookies.rb', line 37

def remember_me(value = nil)
  rw_config(:remember_me, value, false)
end

#remember_me_for(value = :_read) ⇒ Object Also known as: remember_me_for=

The length of time until the cookie expires.

  • Default: 3.months

  • Accepts: Integer, length of time in seconds, such as 60 or 3.months



46
47
48
# File 'lib/authlogic/session/cookies.rb', line 46

def remember_me_for(value = :_read)
  rw_config(:remember_me_for, value, 3.months, :_read)
end

#secure(value = nil) ⇒ Object Also known as: secure=

Should the cookie be set as secure? If true, the cookie will only be sent over SSL connections

  • Default: false

  • Accepts: Boolean



55
56
57
# File 'lib/authlogic/session/cookies.rb', line 55

def secure(value = nil)
  rw_config(:secure, value, false)
end