Skip to content

Commit 44c2f94

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: Minor reword in the testing article Clarify a sentence Update serializer.rst Fix typos and improve wording for the Lock component documentation More precision about the log directory permissions Added some missing steps in the main form login article
2 parents 819d4d6 + f92c205 commit 44c2f94

File tree

6 files changed

+76
-21
lines changed

6 files changed

+76
-21
lines changed

components/http_kernel.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ below for more details).
549549
There are two main listeners to ``kernel.exception`` when using the
550550
Symfony Framework.
551551

552-
**ExceptionListener in HttpKernel**
552+
**ExceptionListener in the HttpKernel Component**
553553

554554
The first comes core to the HttpKernel component
555555
and is called :class:`Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener`.
@@ -578,7 +578,7 @@ below for more details).
578578
controller to render is passed as a constructor argument to this listener.
579579
This controller will return the final ``Response`` for this error page.
580580

581-
**ExceptionListener in Security**
581+
**ExceptionListener in the Security Component**
582582

583583
The other important listener is the
584584
:class:`Symfony\\Component\\Security\\Http\\Firewall\\ExceptionListener`.

components/lock.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ with the ``release()`` method.
106106

107107
The trickiest part when working with expiring locks is choosing the right TTL.
108108
If it's too short, other processes could acquire the lock before finishing the
109-
job; it it's too long and the process crashes before calling the ``release()``
109+
job; if it's too long and the process crashes before calling the ``release()``
110110
method, the resource will stay locked until the timeout::
111111

112112
// ...
@@ -455,8 +455,8 @@ Some file systems (such as some types of NFS) do not support locking.
455455
always be locked on the same machine or to use a well configured shared file
456456
system.
457457

458-
Files on file system can be removed during a maintenance operation. For instance
459-
to cleanup the ``/tmp`` directory or after a reboot of the machine when directory
458+
Files on the file system can be removed during a maintenance operation. For instance,
459+
to clean up the ``/tmp`` directory or after a reboot of the machine when a directory
460460
uses tmpfs. It's not an issue if the lock is released when the process ended, but
461461
it is in case of ``Lock`` reused between requests.
462462

@@ -485,7 +485,7 @@ needs space to add new items.
485485

486486
.. caution::
487487

488-
Number of items stored in the Memcached must be under control. If it's not
488+
The number of items stored in Memcached must be under control. If it's not
489489
possible, LRU should be disabled and Lock should be stored in a dedicated
490490
Memcached service away from Cache.
491491

components/serializer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ when constructing the normalizer::
185185
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
186186
$normalizer = new ObjectNormalizer($classMetadataFactory);
187187
$serializer = new Serializer([$normalizer]);
188-
$person = $serializer->deserialize($data, 'Acme\Person', 'xml', [
188+
$person = $serializer->deserialize($data, 'App\Model\Person', 'xml', [
189189
'allow_extra_attributes' => false,
190190
]);
191191

security/form_login_setup.rst

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ and your generated code may be slightly different:
4040
.. versionadded:: 1.8
4141
Support for login form authentication was added to ``make:auth`` in MakerBundle 1.8.
4242

43-
This generates three things: (1) a login route & controller, (2) a template that
44-
renders the login form and (3) a :doc:`Guard authenticator </security/guard_authentication>`
45-
class that processes the login submit.
43+
This generates the following: 1) a login route & controller, 2) a template that
44+
renders the login form, 3) a :doc:`Guard authenticator </security/guard_authentication>`
45+
class that processes the login submit and 4) updates the main security config file.
4646

47-
The ``/login`` route & controller::
47+
**Step 1.** The ``/login`` route & controller::
4848

4949
// src/Controller/SecurityController.php
5050
namespace App\Controller;
@@ -73,8 +73,8 @@ The ``/login`` route & controller::
7373
}
7474
}
7575

76-
The template has very little to do with security: it just generates a traditional
77-
HTML form that submits to ``/login``:
76+
**Step 2.** The template has very little to do with security: it just generates
77+
a traditional HTML form that submits to ``/login``:
7878

7979
.. code-block:: twig
8080
@@ -115,7 +115,7 @@ HTML form that submits to ``/login``:
115115
</form>
116116
{% endblock %}
117117
118-
The Guard authenticator processes the form submit::
118+
**Step 3.** The Guard authenticator processes the form submit::
119119

120120
// src/Security/LoginFormAuthenticator.php
121121
namespace App\Security;
@@ -212,6 +212,63 @@ The Guard authenticator processes the form submit::
212212
}
213213
}
214214

215+
**Step 4.** Updates the main security config file to enable the Guard authenticator:
216+
217+
.. configuration-block::
218+
219+
.. code-block:: yaml
220+
221+
# config/packages/security.yaml
222+
security:
223+
# ...
224+
225+
firewalls:
226+
main:
227+
# ...
228+
guard:
229+
authenticators:
230+
- App\Security\LoginFormAuthenticator
231+
232+
.. code-block:: xml
233+
234+
<!-- config/packages/security.xml -->
235+
<?xml version="1.0" charset="UTF-8" ?>
236+
<srv:container xmlns="http://symfony.com/schema/dic/security"
237+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
238+
xmlns:srv="http://symfony.com/schema/dic/services"
239+
xsi:schemaLocation="http://symfony.com/schema/dic/services
240+
http://symfony.com/schema/dic/services/services-1.0.xsd">
241+
242+
<config>
243+
<!-- ... -->
244+
<firewall name="main">
245+
<!-- ... -->
246+
<guard>
247+
<authenticator class="App\Security\LoginFormAuthenticator" />
248+
</guard>
249+
</firewall>
250+
</config>
251+
</srv:container>
252+
253+
.. code-block:: php
254+
255+
// app/config/security.php
256+
use App\Security\LoginFormAuthenticator;
257+
258+
$container->loadFromExtension('security', [
259+
// ...
260+
'firewalls' => [
261+
'main' => [
262+
// ...,
263+
'guard' => [
264+
'authenticators' => [
265+
LoginFormAuthenticator::class,
266+
]
267+
],
268+
],
269+
],
270+
]);
271+
215272
Finishing the Login Form
216273
------------------------
217274

setup/file_permissions.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ was writable. But that is no longer true! In Symfony 4, everything works automat
1111
is ``0``), as long as you run ``php bin/console cache:warmup``, no cache files
1212
will need to be written to disk at runtime.
1313

14-
.. note::
15-
16-
If you decide to store log files on disk, you *will* need to make sure your
17-
logs directory (e.g. ``var/log/``) is writable by your web server user and
18-
terminal user. One way this can be done is by using ``chmod -R 777 var/log/``.
19-
Be aware that your logs are readable by any user on your production system.
14+
* In all environments, the log directory (``var/log/`` by default) must exist
15+
and be writable by your web server user and terminal user. One way this can
16+
be done is by using ``chmod -R 777 var/log/``. Be aware that your logs are
17+
readable by any user on your production system.

testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ want to test the overall behavior of your application, see the section about
5959

6060
Writing Symfony unit tests is no different from writing standard PHPUnit
6161
unit tests. Suppose, for example, that you have an *incredibly* simple class
62-
called ``Calculator`` in the ``Util/`` directory of the app bundle::
62+
called ``Calculator`` in the ``src/Util/`` directory of the app::
6363

6464
// src/Util/Calculator.php
6565
namespace App\Util;

0 commit comments

Comments
 (0)