File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ This handler must implement
82
82
83
83
use App\Repository\AccessTokenRepository;
84
84
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
85
+ use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
85
86
86
87
class AccessTokenHandler implements AccessTokenHandlerInterface
87
88
{
@@ -90,16 +91,16 @@ This handler must implement
90
91
) {
91
92
}
92
93
93
- public function getUserIdentifierFrom (string $token ): string
94
+ public function getUserBadgeFrom (string $accessToken ): UserBadge
94
95
{
95
96
// e.g. query the "access token" database to search for this token
96
97
$accessToken = $this->repository->findOneByValue($token);
97
- if ($accessToken === null || !$accessToken->isValid()) {
98
+ if (null === $accessToken || !$accessToken->isValid()) {
98
99
throw new BadCredentialsException('Invalid credentials.');
99
100
}
100
101
101
- // and return the user identifier from the found token
102
- return $accessToken->getUserId();
102
+ // and return a UserBadge object containing the user identifier from the found token
103
+ return new UserBadge( $accessToken->getUserId() );
103
104
}
104
105
}
105
106
You can’t perform that action at this time.
0 commit comments