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
8282
8383 use App\Repository\AccessTokenRepository;
8484 use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
85+ use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
8586
8687 class AccessTokenHandler implements AccessTokenHandlerInterface
8788 {
@@ -90,16 +91,16 @@ This handler must implement
9091 ) {
9192 }
9293
93- public function getUserIdentifierFrom (string $token ): string
94+ public function getUserBadgeFrom (string $accessToken ): UserBadge
9495 {
9596 // e.g. query the "access token" database to search for this token
9697 $accessToken = $this->repository->findOneByValue($token);
97- if ($accessToken === null || !$accessToken->isValid()) {
98+ if (null === $accessToken || !$accessToken->isValid()) {
9899 throw new BadCredentialsException('Invalid credentials.');
99100 }
100101
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() );
103104 }
104105 }
105106
You can’t perform that action at this time.
0 commit comments