Module: Authlogic::Session::Cookies::Config
- Defined in:
- lib/authlogic/session/cookies.rb
Overview
Configuration for the cookie feature set.
Instance Method Summary (collapse)
-
- (Object) cookie_key(value = nil)
(also: #cookie_key=)
The name of the cookie or the key in the cookies hash.
-
- (Object) httponly(value = nil)
(also: #httponly=)
Should the cookie be set as httponly? If true, the cookie will not be accessable from javascript.
-
- (Object) remember_me(value = nil)
(also: #remember_me=)
If sessions should be remembered by default or not.
-
- (Object) remember_me_for(value = :_read)
(also: #remember_me_for=)
The length of time until the cookie expires.
-
- (Object) secure(value = nil)
(also: #secure=)
Should the cookie be set as secure? If true, the cookie will only be sent over SSL connections.
Instance Method Details
- (Object) cookie_key(value = nil) Also known as:
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 (value = nil) rw_config(:cookie_key, value, "#{klass_name.underscore}_credentials") end |
- (Object) httponly(value = nil) 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 |
- (Object) remember_me(value = nil) 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 |
- (Object) remember_me_for(value = :_read) 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 |
- (Object) secure(value = nil) 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 |