Skip to content

Commit 08ab41a

Browse files
committed
Merge branch '5.0'
* 5.0: [#12835] add use statement Update custom-transport.rst Update injection_types.rst Document PasswordAuthenticatedInterface Update Valid.rst remove old versionadded directive Update guard_authentication.rst Update password_migration.rst
2 parents d838ba6 + 2c4b917 commit 08ab41a

File tree

6 files changed

+39
-16
lines changed

6 files changed

+39
-16
lines changed

messenger/custom-transport.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ DSN. You will need a transport factory::
1212

1313
use Symfony\Component\Messenger\Transport\Receiver\ReceiverInterface;
1414
use Symfony\Component\Messenger\Transport\Sender\SenderInterface;
15+
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
1516
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
1617
use Symfony\Component\Messenger\Transport\TransportInterface;
1718

1819
class YourTransportFactory implements TransportFactoryInterface
1920
{
20-
public function createTransport(string $dsn, array $options): TransportInterface
21+
public function createTransport(string $dsn, array $options, SerializerInterface $serializer): TransportInterface
2122
{
2223
return new YourTransport(/* ... */);
2324
}

performance.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ features, such as the APCu Cache adapter.
3939
Dump the Service Container into a Single File
4040
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4141

42-
.. versionadded:: 4.4
43-
44-
The ``container.dumper.inline_factories`` parameter was introduced in
45-
Symfony 4.4.
46-
4742
Symfony compiles the :doc:`service container </service_container>` into multiple
4843
small files by default. Set this parameter to ``true`` to compile the entire
4944
container into a single file, which could improve performance when using

reference/constraints/Valid.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ stores an ``Address`` instance in the ``$address`` property::
155155
{
156156
$metadata->addPropertyConstraint('street', new Assert\NotBlank());
157157
$metadata->addPropertyConstraint('zipCode', new Assert\NotBlank());
158-
$metadata->addPropertyConstraint('zipCode', new Assert\Length(["max" => 5]));
158+
$metadata->addPropertyConstraint('zipCode', new Assert\Length(['max' => 5]));
159159
}
160160
}
161161
@@ -170,7 +170,7 @@ stores an ``Address`` instance in the ``$address`` property::
170170
public static function loadValidatorMetadata(ClassMetadata $metadata)
171171
{
172172
$metadata->addPropertyConstraint('firstName', new Assert\NotBlank());
173-
$metadata->addPropertyConstraint('firstName', new Assert\Length(["min" => 4]));
173+
$metadata->addPropertyConstraint('firstName', new Assert\Length(['min' => 4]));
174174
$metadata->addPropertyConstraint('lastName', new Assert\NotBlank());
175175
}
176176
}

security/guard_authentication.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Finally, configure your ``firewalls`` key in ``security.yaml`` to use this authe
241241
'logout' => true,
242242
'guard' => [
243243
'authenticators' => [
244-
TokenAuthenticator::class
244+
TokenAuthenticator::class,
245245
],
246246
],
247247
// ...
@@ -300,7 +300,7 @@ Each authenticator needs the following methods:
300300
(or throw an :ref:`AuthenticationException <guard-customize-error>`),
301301
authentication will fail.
302302

303-
**onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)**
303+
**onAuthenticationSuccess(Request $request, TokenInterface $token, string $providerKey)**
304304
This is called after successful authentication and your job is to either
305305
return a :class:`Symfony\\Component\\HttpFoundation\\Response` object
306306
that will be sent to the client or ``null`` to continue the request
@@ -321,7 +321,7 @@ Each authenticator needs the following methods:
321321
the user authenticate (e.g. a 401 response that says "token is missing!").
322322

323323
**supportsRememberMe()**
324-
If you want to support "remember me" functionality, return true from this method.
324+
If you want to support "remember me" functionality, return ``true`` from this method.
325325
You will still need to activate ``remember_me`` under your firewall for it to work.
326326
Since this is a stateless API, you do not want to support "remember me"
327327
functionality in this example.
@@ -330,7 +330,7 @@ Each authenticator needs the following methods:
330330
If you are implementing the :class:`Symfony\\Component\\Security\\Guard\\AuthenticatorInterface`
331331
instead of extending the :class:`Symfony\\Component\\Security\\Guard\\AbstractGuardAuthenticator`
332332
class, you have to implement this method. It will be called
333-
after a successful authentication to create and return the token
333+
after a successful authentication to create and return the token (a class implementing :class:`Symfony\\Component\\Security\\Guard\\Token\\GuardTokenInterface`)
334334
for the user, who was supplied as the first argument.
335335

336336
The picture below shows how Symfony calls Guard Authenticator methods:

security/password_migration.rst

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,41 @@ Upgrade the Password
115115

116116
Upon successful login, the Security system checks whether a better algorithm
117117
is available to hash the user's password. If it is, it'll hash the correct
118-
password using the new hash. You can enable this behavior by implementing how
119-
this newly hashed password should be stored:
118+
password using the new hash. If you use a Guard authenticator, you first need to
119+
`provide the original password to the Security system <Provide the Password when using Guards>`_.
120+
121+
You can enable the upgrade behavior by implementing how this newly hashed
122+
password should be stored:
120123

121124
* `When using Doctrine's entity user provider <Upgrade the Password when using Doctrine>`_
122125
* `When using a custom user provider <Upgrade the Password when using a custom User Provider>`_
123126

124127
After this, you're done and passwords are always hashed as secure as possible!
125128

129+
Provide the Password when using Guard
130+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131+
132+
When you're using a custom :doc:`guard authenticator </security/guard_authentication>`,
133+
you need to implement :class:`Symfony\\Component\\Security\\Guard\\PasswordAuthenticatedInterface`.
134+
This interface defines a ``getPassword()`` method that returns the password
135+
for this login request. This password is used in the migration process::
136+
137+
// src/Security/CustomAuthenticator.php
138+
namespace App\Security;
139+
140+
use Symfony\Component\Security\Guard\PasswordAuthenticatedInterface;
141+
// ...
142+
143+
class CustomAuthenticator extends AbstractGuardAuthenticator implements PasswordAuthenticatedInterface
144+
{
145+
// ...
146+
147+
public function getPassword($credentials): ?string
148+
{
149+
return $credentials['password'];
150+
}
151+
}
152+
126153
Upgrade the Password when using Doctrine
127154
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128155

@@ -184,7 +211,7 @@ Trigger Password Migration From a Custom Encoder
184211
If you're using a custom password encoder, you can trigger the password
185212
migration by returning ``true`` in the ``needsRehash()`` method::
186213

187-
// src/Security/UserProvider.php
214+
// src/Security/CustomPasswordEncoder.php
188215
namespace App\Security;
189216

190217
// ...

service_container/injection_types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ Another possibility is setting public fields of the class directly::
349349
return function(ContainerConfigurator $configurator) {
350350
$services = $configurator->services();
351351
352-
$services->set('app.newsletter_manager, NewsletterManager::class)
352+
$services->set('app.newsletter_manager', NewsletterManager::class)
353353
->property('mailer', ref('mailer'));
354354
};
355355

0 commit comments

Comments
 (0)