@@ -8,10 +8,7 @@ Once a user is authenticated, their credentials are typically stored in the
8
8
session. This means that when the session ends they will be logged out and
9
9
have to provide their login details again next time they wish to access the
10
10
application. You can allow users to choose to stay logged in for longer than
11
- the session lasts using a cookie with the ``remember_me `` firewall option.
12
- The firewall needs to have a secret key configured, which is used to encrypt
13
- the cookie's content. It also has several options with default values which
14
- are shown here:
11
+ the session lasts using a cookie with the ``remember_me `` firewall option:
15
12
16
13
.. configuration-block ::
17
14
@@ -22,9 +19,8 @@ are shown here:
22
19
main :
23
20
remember_me :
24
21
key : " %secret%"
25
- lifetime : 31536000 # 365 days in seconds
22
+ lifetime : 604800 # 1 week in seconds
26
23
path : /
27
- domain : ~ # Defaults to the current domain from $_SERVER
28
24
29
25
.. code-block :: xml
30
26
@@ -33,9 +29,8 @@ are shown here:
33
29
<firewall >
34
30
<remember-me
35
31
key = " %secret%"
36
- lifetime = " 31536000 " <!-- 365 days in seconds -->
32
+ lifetime = " 604800 " <!-- 1 week in seconds -->
37
33
path = "/"
38
- domain = "" <!-- Defaults to the current domain from $_SERVER -->
39
34
/>
40
35
</firewall >
41
36
</config >
@@ -48,14 +43,56 @@ are shown here:
48
43
'main' => array(
49
44
'remember_me' => array(
50
45
'key' => '%secret%',
51
- 'lifetime' => 31536000 , // 365 days in seconds
46
+ 'lifetime' => 604800 , // 1 week in seconds
52
47
'path' => '/',
53
- 'domain' => '', // Defaults to the current domain from $_SERVER
54
48
),
55
49
),
56
50
),
57
51
));
58
52
53
+ The ``remember_me `` firewall defines the following configuration options:
54
+
55
+ ``name ``
56
+ (default value: ``REMEMBERME ``) The name of the cookie used to maintain the
57
+ user logged in. If you enable the "Remember Me" feature in several firewalls
58
+ of the same application, make sure to choose a different name for the cookie
59
+ of each firewall. Otherwise, you'll face lots of security related problems.
60
+
61
+ ``lifetime ``
62
+ (default value: ``31536000 ``) The number of seconds during which the user
63
+ will remain logged in. By default users are logged in for one year.
64
+
65
+ ``path ``
66
+ (default value: ``/ ``) The path where the cookie associated with this
67
+ feature is used. By default the cookie will be applied to the entire website
68
+ but you can restrict to a specific section (e.g. ``/forum ``, ``/admin ``).
69
+
70
+ ``domain ``
71
+ (default value: ``null ``) The domain where the cookie associated with this
72
+ feature is used. By default cookies use the current domain obtained from
73
+ ``$_SERVER ``.
74
+
75
+ ``secure ``
76
+ (default value: ``false ``) If ``true ``, the cookie associated with this
77
+ feature is sent to the user through an HTTPS secure connection.
78
+
79
+ ``httponly ``
80
+ (default value: ``true ``) If ``true ``, the cookie associated with this
81
+ feature is sent to the user exclusively through an HTTP non-secure connection.
82
+
83
+ ``remember_me_parameter ``
84
+ (default value: ``_remember_me ``) The name of the form field checked to
85
+ decide if the "Remember Me" feature should be enabled or not. Keep reading
86
+ this article to know how to enable this feature conditionally.
87
+
88
+ ``always_remember_me ``
89
+ (default value: ``false ``) If ``true ``, the value of the ``remember_me_parameter ``
90
+ is ignored and the "Remember Me" feature is always enabled, regardless of the
91
+ desire of the end user.
92
+
93
+ Forcing the User to Opt-Out of the Remember Me Feature
94
+ ------------------------------------------------------
95
+
59
96
It's a good idea to provide the user with the option to use or not use the
60
97
remember me functionality, as it will not always be appropriate. The usual
61
98
way of doing this is to add a checkbox to the login form. By giving the checkbox
0 commit comments