Skip to content

Commit c9bd8f6

Browse files
committed
Merge pull request #2146 from WouterJ/fix_2108
Use routes for security paths, instead of raw paths
2 parents f07492e + 64a3b2e commit c9bd8f6

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

book/security.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ First, enable form login under your firewall:
296296
pattern: ^/
297297
anonymous: ~
298298
form_login:
299-
login_path: /login
300-
check_path: /login_check
299+
login_path: login
300+
check_path: login_check
301301
302302
.. code-block:: xml
303303
@@ -313,7 +313,7 @@ First, enable form login under your firewall:
313313
<config>
314314
<firewall name="secured_area" pattern="^/">
315315
<anonymous />
316-
<form-login login_path="/login" check_path="/login_check" />
316+
<form-login login_path="login" check_path="login_check" />
317317
</firewall>
318318
</config>
319319
</srv:container>
@@ -327,8 +327,8 @@ First, enable form login under your firewall:
327327
'pattern' => '^/',
328328
'anonymous' => array(),
329329
'form_login' => array(
330-
'login_path' => '/login',
331-
'check_path' => '/login_check',
330+
'login_path' => 'login',
331+
'check_path' => 'login_check',
332332
),
333333
),
334334
),
@@ -355,10 +355,11 @@ First, enable form login under your firewall:
355355
'form_login' => array(),
356356
357357
Now, when the security system initiates the authentication process, it will
358-
redirect the user to the login form (``/login`` by default). Implementing
359-
this login form visually is your job. First, create two routes: one that
360-
will display the login form (i.e. ``/login``) and one that will handle the
361-
login form submission (i.e. ``/login_check``):
358+
redirect the user to the login form (``/login`` by default). Implementing this
359+
login form visually is your job. First, the create two routes we used in the
360+
security configuration: the ``login`` route will display the login form (i.e.
361+
``/login``) and the ``login_check`` route will handle the login form
362+
submission (i.e. ``/login_check``):
362363

363364
.. configuration-block::
364365

@@ -557,7 +558,7 @@ see :doc:`/cookbook/security/form_login`.
557558

558559
**1. Create the correct routes**
559560

560-
First, be sure that you've defined the ``/login`` and ``/login_check``
561+
First, be sure that you've defined the ``login`` and ``login_check``
561562
routes correctly and that they correspond to the ``login_path`` and
562563
``check_path`` config values. A misconfiguration here can mean that you're
563564
redirected to a 404 page instead of the login page, or that submitting

reference/configuration/security.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,18 +218,18 @@ The Login Form and Process
218218
~~~~~~~~~~~~~~~~~~~~~~~~~~
219219

220220
* ``login_path`` (type: ``string``, default: ``/login``)
221-
This is the URL that the user will be redirected to (unless ``use_forward``
222-
is set to ``true``) when he/she tries to access a protected resource
223-
but isn't fully authenticated.
221+
This is the route or path that the user will be redirected to (unless
222+
``use_forward`` is set to ``true``) when he/she tries to access a
223+
protected resource but isn't fully authenticated.
224224

225-
This URL **must** be accessible by a normal, un-authenticated user, else
225+
This path **must** be accessible by a normal, un-authenticated user, else
226226
you may create a redirect loop. For details, see
227227
":ref:`Avoid Common Pitfalls<book-security-common-pitfalls>`".
228228

229229
* ``check_path`` (type: ``string``, default: ``/login_check``)
230-
This is the URL that your login form must submit to. The firewall will
231-
intercept any requests (``POST`` requests only, by default) to this URL
232-
and process the submitted login credentials.
230+
This is the route or path that your login form must submit to. The
231+
firewall will intercept any requests (``POST`` requests only, by default)
232+
to this URL and process the submitted login credentials.
233233

234234
Be sure that this URL is covered by your main firewall (i.e. don't create
235235
a separate firewall just for ``check_path`` URL).

0 commit comments

Comments
 (0)