I installed latest version of API platform which came with
- symfony/security-bundle:v6.3.8
- api-platform/core:v3.2.7
I am trying to build custom token handler according this this documentation
But I am getting following error: Service "security.access_token_handler.api": Parent definition "Api\Security\AccessTokenHandler" does not exist.
my token handler:
<?php
namespace App\Security;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
class AccessTokenHandler implements AccessTokenHandlerInterface
{
public function getUserBadgeFrom(string $accessToken): UserBadge
{
throw new BadCredentialsException('Invalid credentials.');
}
}
packages/security.yaml
security:
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
providers:
users_in_memory: { memory: null }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
api:
pattern: ^/api
stateless: true
access_token:
token_handler: Api\Security\AccessTokenHandler