10000 minor #14349 Fix missing namespace and other wrong wording from Secur… · symfony/symfony-docs@a20f40a · GitHub
[go: up one dir, main page]

Skip to content

Commit a20f40a

Browse files
committed
minor #14349 Fix missing namespace and other wrong wording from Security and Serializer context (TheGarious)
This PR was submitted for the master branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- Fix missing namespace and other wrong wording from Security and Serializer context <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- 22345e0 Fix missing namespace and other wrong wording from Security and Serializer context
2 parents 7ade60d + 22345e0 commit a20f40a

11 files changed

+29
-3
lines changed

security/access_denied_handler.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This interface defines one method called ``handle()`` where you can implement wh
1313
logic that should run when access is denied for the current user (e.g. send a
1414
mail, log a message, or generally return a custom response)::
1515

16+
// src/Security/AccessDeniedHandler.php
1617
namespace App\Security;
1718

1819
use Symfony\Component\HttpFoundation\Request;

security/csrf.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ protected against CSRF attacks.
8383
By default Symfony adds the CSRF token in a hidden field called ``_token``, but
8484
this can be customized on a form-by-form basis::
8585

86+
// src/Form/TaskType.php
87+
namespace App\Form;
88+
8689
// ...
8790
use App\Entity\Task;
8891
use Symfony\Component\OptionsResolver\OptionsResolver;

security/custom_authentication_provider.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@ can have different timeout lengths.
538538
You will first need to edit ``WsseFactory`` and define the new option in
539539
the ``addConfiguration()`` method::
540540

541+
// src/DependencyInjection/Security/Factory/WsseFactory.php
542+
namespace App\DependencyInjection\Security\Factory;
543+
544+
// ...
545+
541546
class WsseFactory implements SecurityFactoryInterface
542547
{
543548
// ...
@@ -556,6 +561,9 @@ contain a ``lifetime`` key, set to 5 minutes (300 seconds) unless otherwise
556561
set in the configuration. Pass this argument to your authentication provider
557562
in order to put it to use::
558563

564+
// src/DependencyInjection/Security/Factory/WsseFactory.php
565+
namespace App\DependencyInjection\Security\Factory;
566+
559567
use App\Security\Authentication\Provider\WsseProvider;
560568

561569
class WsseFactory implements SecurityFactoryInterface

security/form_login.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ configuration (``login``):
9393
.. code-block:: php-annotations
9494
9595
// src/Controller/SecurityController.php
96+
namespace App\Controller;
9697
9798
// ...
9899
use Symfony\Component\Routing\Annotation\Route;

security/form_login_setup.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ If you also want to apply this behavior to public pages, you can create an
477477
:doc:`event subscriber </event_dispatcher>` to set the target path manually
478478
whenever the user browses a page::
479479

480+
// src/EventSubscriber/RequestSubscriber.php
480481
namespace App\EventSubscriber;
481482

482483
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

security/guard_authentication.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ your ``User`` class (the ``make:entity`` command is a good way to do this):
2828
.. code-block:: diff
2929
3030
// src/Entity/User.php
31+
namespace App\Entity;
32+
3133
// ...
3234
3335
class User implements UserInterface
@@ -411,6 +413,8 @@ You can throw this from ``getCredentials()``, ``getUser()`` or ``checkCredential
411413
to cause a failure::
412414

413415
// src/Security/TokenAuthenticator.php
416+
namespace App\Security;
417+
414418
// ...
415419

416420
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
@@ -453,8 +457,9 @@ completes registration. To do that, use your authenticator and a service called
453457
``GuardAuthenticatorHandler``::
454458

455459
// src/Controller/RegistrationController.php
460+
namespace App\Controller;
461+
456462
// ...
457-
458463
use App\Security\LoginFormAuthenticator;
459464
use Symfony\Component\HttpFoundation\Request;
460465
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;

security/impersonating_user.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ stored in the token storage will be a ``SwitchUserToken`` instance. Use the
113113
following snippet to obtain the original token which gives you access to
114114
the impersonator user::
115115

116+
// src/Service/SomeService.php
117+
namespace App\Service;
118+
116119
use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
117120
use Symfony\Component\Security\Core\Security;
118121
// ...
@@ -256,6 +259,7 @@ be called):
256259
Then, create a voter class that responds to this role and includes whatever custom
257260
logic you want::
258261

262+
// src/Service/Voter/SwitchToCustomerVoter.php
259263
namespace App\Security\Voter;
260264

261265
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

security/json_login_setup.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ The next step is to configure a route in your app matching this path:
6565
.. code-block:: php-annotations
6666
6767
// src/Controller/SecurityController.php
68+
namespace App\Controller;
6869
6970
// ...
7071
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

security/named_encoders.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ to use it, the class must implement
117117
The interface requires one method - ``getEncoderName()`` - which should return
118118
the name of the encoder to use::
119119

120-
// src/Acme/UserBundle/Entity/User.php
121-
namespace Acme\UserBundle\Entity;
120+
// src/Entity/User.php
121+
namespace App\Entity;
122122

123123
use Symfony\Component\Security\Core\Encoder\EncoderAwareInterface;
124124
use Symfony\Component\Security\Core\User\UserInterface;

serializer/custom_encoders.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Imagine you want to serialize and deserialize YAML. For that you'll have to
1919
create your own encoder that uses the
2020
:doc:`Yaml Component </components/yaml>`::
2121

22+
// src/Serializer/YamlEncoder.php
2223
namespace App\Serializer;
2324

2425
use Symfony\Component\Serializer\Encoder\DecoderInterface;

serializer/custom_normalizer.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ process. For that you'll have to create your own normalizer. But it's usually
1717
preferable to let Symfony normalize the object, then hook into the normalization
1818
to customize the normalized data. To do that, leverage the ``ObjectNormalizer``::
1919

20+
// src/Serializer/TopicNormalizer.php
2021
namespace App\Serializer;
2122

2223
use App\Entity\Topic;

0 commit comments

Comments
 (0)
0