Skip to content

Commit 2c4b917

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: [#12835] add use statement Update custom-transport.rst Update injection_types.rst Document PasswordAuthenticatedInterface Update Valid.rst Update password_migration.rst
2 parents 8b3528f + f0dc474 commit 2c4b917

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
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
}

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/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)