8000 Fix missing namespace and other wrong wording from Security and Serializer context by TheGarious · Pull Request #14349 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Fix missing namespace and other wrong wording from Security and Serializer context #14349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix missing namespace and other wrong wording from Security and Seria…
…lizer context
  • Loading branch information
gary houbre authored and javiereguiluz committed Oct 22, 2020
commit 22345e0b151835cbd86c4de6bc8be7fccdd1fe22
1 change: 1 addition & 0 deletions security/access_denied_handler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This interface defines one method called ``handle()`` where you can implement wh
logic that should run when access is denied for the current user (e.g. send a
mail, log a message, or generally return a custom response)::

// src/Security/AccessDeniedHandler.php
namespace App\Security;

use Symfony\Component\HttpFoundation\Request;
Expand Down
3 changes: 3 additions & 0 deletions security/csrf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ protected against CSRF attacks.
By default Symfony adds the CSRF token in a hidden field called ``_token``, but
this can be customized on a form-by-form basis::

// src/Form/TaskType.php
namespace App\Form;

// ...
use App\Entity\Task;
use Symfony\Component\OptionsResolver\OptionsResolver;
Expand Down
8 changes: 8 additions & 0 deletions security/custom_authentication_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,11 @@ can have different timeout lengths.
You will first need to edit ``WsseFactory`` and define the new option in
the ``addConfiguration()`` method::

// src/DependencyInjection/Security/Factory/WsseFactory.php
namespace App\DependencyInjection\Security\Factory;

// ...

class WsseFactory implements SecurityFactoryInterface
{
// ...
Expand All @@ -556,6 +561,9 @@ contain a ``lifetime`` key, set to 5 minutes (300 seconds) unless otherwise
set in the configuration. Pass this argument to your authentication provider
in order to put it to use::

// src/DependencyInjection/Security/Factory/WsseFactory.php
namespace App\DependencyInjection\Security\Factory;

use App\Security\Authentication\Provider\WsseProvider;

class WsseFactory implements SecurityFactoryInterface
Expand Down
1 change: 1 addition & 0 deletions security/form_login.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ configuration (``login``):
.. code-block:: php-annotations

// src/Controller/SecurityController.php
namespace App\Controller;

// ...
use Symfony\Component\Routing\Annotation\Route;
Expand Down
1 change: 1 addition & 0 deletions security/form_login_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ If you also want to apply this behavior to public pages, you can create an
:doc:`event subscriber </event_dispatcher>` to set the target path manually
whenever the user browses a page::

// src/EventSubscriber/RequestSubscriber.php
namespace App\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
Expand Down
7 changes: 6 additions & 1 deletion security/guard_authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ your ``User`` class (the ``make:entity`` command is a good way to do this):
.. code-block:: diff

// src/Entity/User.php
namespace App\Entity;

// ...

class User implements UserInterface
Expand Down Expand Up @@ -411,6 +413,8 @@ You can throw this from ``getCredentials()``, ``getUser()`` or ``checkCredential
to cause a failure::

// src/Security/TokenAuthenticator.php
namespace App\Security;

// ...

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

// src/Controller/RegistrationController.php
namespace App\Controller;

// ...

use App\Security\LoginFormAuthenticator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Guard\GuardAuthenticatorHandler;
Expand Down
4 changes: 4 additions & 0 deletions security/impersonating_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ stored in the token storage will be a ``SwitchUserToken`` instance. Use the
following snippet to obtain the original token which gives you access to
the impersonator user::

// src/Service/SomeService.php
namespace App\Service;

use Symfony\Component\Security\Core\Authentication\Token\SwitchUserToken;
use Symfony\Component\Security\Core\Security;
// ...
Expand Down Expand Up @@ -256,6 +259,7 @@ be called):
Then, create a voter class that responds to this role and includes whatever custom
logic you want::

// src/Service/Voter/SwitchToCustomerVoter.php
namespace App\Security\Voter;

use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
Expand Down
1 change: 1 addition & 0 deletions security/json_login_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ The next step is to configure a route in your app matching this path:
.. code-block:: php-annotations

// src/Controller/SecurityController.php
namespace App\Controller;

// ...
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
Expand Down
4 changes: 2 additions & 2 deletions security/named_encoders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ to use it, the class must implement
The interface requires one method - ``getEncoderName()`` - which should return
the name of the encoder to use::

// src/Acme/UserBundle/Entity/User.php
namespace Acme\UserBundle\Entity;
// src/Entity/User.php
namespace App\Entity;

use Symfony\Component\Security\Core\Encoder\EncoderAwareInterface;
use Symfony\Component\Security\Core\User\UserInterface;
Expand Down
1 change: 1 addition & 0 deletions serializer/custom_encoders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Imagine you want to serialize and deserialize YAML. For that you'll have to
create your own encoder that uses the
:doc:`Yaml Component </components/yaml>`::

// src/Serializer/YamlEncoder.php
namespace App\Serializer;

use Symfony\Component\Serializer\Encoder\DecoderInterface;
Expand Down
1 change: 1 addition & 0 deletions serializer/custom_normalizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ process. For that you'll have to create your own normalizer. But it's usually
preferable to let Symfony normalize the object, then hook into the normalization
to customize the normalized data. To do that, leverage the ``ObjectNormalizer``::

// src/Serializer/TopicNormalizer.php
namespace App\Serializer;

use App\Entity\Topic;
Expand Down
0