Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc1d40d3

Browse files
committed
[PasswordHasher] Fix missing PasswordHasherAwareInterface allowed type in signatures
1 parente086194 commitc1d40d3

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

‎src/Symfony/Component/PasswordHasher/Hasher/PasswordHasherFactoryInterface.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
useSymfony\Component\PasswordHasher\PasswordHasherInterface;
1515
useSymfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
16-
useSymfony\Component\Security\Core\User\UserInterface;
1716

1817
/**
1918
* PasswordHasherFactoryInterface to support different password hashers for different user accounts.
@@ -26,7 +25,7 @@ interface PasswordHasherFactoryInterface
2625
/**
2726
* Returns the password hasher to use for the given user.
2827
*
29-
* @param PasswordAuthenticatedUserInterface|UserInterface|string $user A PasswordAuthenticatedUserInterface/UserInterface instance or a class name
28+
* @paramPasswordHasherAwareInterface|PasswordAuthenticatedUserInterface|string $user A PasswordAuthenticatedUserInterface/PasswordHasherAwareInterface instance or a class name
3029
*
3130
* @throws \RuntimeException When no password hasher could be found for the user
3231
*/

‎src/Symfony/Component/PasswordHasher/Hasher/UserPasswordHasher.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(PasswordHasherFactoryInterface $hasherFactory)
3232
}
3333

3434
/**
35-
* @param PasswordAuthenticatedUserInterface $user
35+
* @param PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user
3636
*/
3737
publicfunctionhashPassword($user,string$plainPassword):string
3838
{
@@ -54,7 +54,7 @@ public function hashPassword($user, string $plainPassword): string
5454
}
5555

5656
/**
57-
* @param PasswordAuthenticatedUserInterface $user
57+
* @param PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user
5858
*/
5959
publicfunctionisPasswordValid($user,string$plainPassword):bool
6060
{
@@ -80,7 +80,7 @@ public function isPasswordValid($user, string $plainPassword): bool
8080
}
8181

8282
/**
83-
* @param PasswordAuthenticatedUserInterface $user
83+
* @param PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user
8484
*/
8585
publicfunctionneedsRehash($user):bool
8686
{

‎src/Symfony/Component/PasswordHasher/Hasher/UserPasswordHasherInterface.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
*
1919
* @author Ariel Ferrandini <arielferrandini@gmail.com>
2020
*
21-
* @method string hashPassword(PasswordAuthenticatedUserInterface $user, string $plainPassword) Hashes the plain password for the given user.
22-
* @method bool isPasswordValid(PasswordAuthenticatedUserInterface $user, string $plainPassword) Checks if the plaintext password matches the user's password.
23-
* @method bool needsRehash(PasswordAuthenticatedUserInterface $user) Checks if an encoded password would benefit from rehashing.
21+
* @method string hashPassword(PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user, string $plainPassword) Hashes the plain password for the given user.
22+
* @method bool isPasswordValid(PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user, string $plainPassword) Checks if the plaintext password matches the user's password.
23+
* @method bool needsRehash(PasswordAuthenticatedUserInterface|PasswordHasherAwareInterface $user) Checks if an encoded password would benefit from rehashing.
2424
*/
2525
interface UserPasswordHasherInterface
2626
{

‎src/Symfony/Component/PasswordHasher/Tests/Hasher/PasswordHasherFactoryTest.php‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
useSymfony\Component\PasswordHasher\PasswordHasherInterface;
2222
useSymfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder;
2323
useSymfony\Component\Security\Core\User\InMemoryUser;
24-
useSymfony\Component\Security\Core\User\UserInterface;
24+
useSymfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
2525

2626
class PasswordHasherFactoryTestextends TestCase
2727
{
2828
publicfunctiontestGetHasherWithMessageDigestHasher()
2929
{
30-
$factory =newPasswordHasherFactory([UserInterface::class => [
30+
$factory =newPasswordHasherFactory([PasswordAuthenticatedUserInterface::class => [
3131
'class' => MessageDigestPasswordHasher::class,
3232
'arguments' => ['sha512',true,5],
3333
]]);
3434

35-
$hasher =$factory->getPasswordHasher($this->createMock(UserInterface::class));
35+
$hasher =$factory->getPasswordHasher($this->createMock(PasswordAuthenticatedUserInterface::class));
3636
$expectedHasher =newMessageDigestPasswordHasher('sha512',true,5);
3737

3838
$this->assertEquals($expectedHasher->hash('foo','moo'),$hasher->hash('foo','moo'));
@@ -41,22 +41,18 @@ public function testGetHasherWithMessageDigestHasher()
4141
publicfunctiontestGetHasherWithService()
4242
{
4343
$factory =newPasswordHasherFactory([
44-
UserInterface::class =>newMessageDigestPasswordHasher('sha1'),
44+
PasswordAuthenticatedUserInterface::class =>newMessageDigestPasswordHasher('sha1'),
4545
]);
4646

47-
$hasher =$factory->getPasswordHasher($this->createMock(UserInterface::class));
48-
$expectedHasher =newMessageDigestPasswordHasher('sha1');
49-
$this->assertEquals($expectedHasher->hash('foo',''),$hasher->hash('foo',''));
50-
51-
$hasher =$factory->getPasswordHasher(newInMemoryUser('user','pass'));
47+
$hasher =$factory->getPasswordHasher($this->createMock(PasswordAuthenticatedUserInterface::class));
5248
$expectedHasher =newMessageDigestPasswordHasher('sha1');
5349
$this->assertEquals($expectedHasher->hash('foo',''),$hasher->hash('foo',''));
5450
}
5551

5652
publicfunctiontestGetHasherWithClassName()
5753
{
5854
$factory =newPasswordHasherFactory([
59-
UserInterface::class =>newMessageDigestPasswordHasher('sha1'),
55+
PasswordAuthenticatedUserInterface::class =>newMessageDigestPasswordHasher('sha1'),
6056
]);
6157

6258
$hasher =$factory->getPasswordHasher(SomeChildUser::class);
@@ -208,7 +204,7 @@ public function testLegacyEncoderClass()
208204
}
209205
}
210206

211-
class SomeUserimplementsUserInterface
207+
class SomeUserimplementsPasswordAuthenticatedUserInterface
212208
{
213209
publicfunctiongetRoles():array
214210
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp