Skip to content

Commit 138cfe2

Browse files
committed
pass the current token to the checkPostAuth() method of user checkers
1 parent 40cbdca commit 138cfe2

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ CHANGELOG
44
7.2
55
---
66

7+
* Add `$token` argument to `UserCheckerInterface::checkPostAuth()`
78
* Deprecate argument `$secret` of `RememberMeToken`
89

910
7.0

User/ChainUserChecker.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Security\Core\User;
1313

14+
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
15+
1416
final class ChainUserChecker implements UserCheckerInterface
1517
{
1618
/**
@@ -27,10 +29,16 @@ public function checkPreAuth(UserInterface $user): void
2729
}
2830
}
2931

30-
public function checkPostAuth(UserInterface $user): void
32+
public function checkPostAuth(UserInterface $user /*, TokenInterface $token*/): void
3133
{
34+
$token = 1 < \func_num_args() ? func_get_arg(1) : null;
35+
3236
foreach ($this->checkers as $checker) {
33-
$checker->checkPostAuth($user);
37+
if ($token instanceof TokenInterface) {
38+
$checker->checkPostAuth($user, $token);
39+
} else {
40+
$checker->checkPostAuth($user);
41+
}
3442
}
3543
}
3644
}

User/UserCheckerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ public function checkPreAuth(UserInterface $user): void;
3535
*
3636
* @throws AccountStatusException
3737
*/
38-
public function checkPostAuth(UserInterface $user): void;
38+
public function checkPostAuth(UserInterface $user /*, TokenInterface $token*/): void;
3939
}

0 commit comments

Comments
 (0)