- Added support for authenticating via access tokens

- update symfony to 6.4.*
- some other minor stuff
This commit is contained in:
2024-02-12 23:37:24 -07:00
parent 4a1c6e1a72
commit 7c45f64a73
21 changed files with 5022 additions and 8217 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Security;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
use Symfony\Component\Security\Http\Authorization\AccessDeniedHandlerInterface;
class AccessTokenDeniedHandler implements AccessDeniedHandlerInterface, AuthenticationFailureHandlerInterface
{
public function handle(Request $request, AccessDeniedException $accessDeniedException): ?Response
{
return new Response('AccessTokenDeniedHandler', 403);
}
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response
{
return new JsonResponse([
'result' => 'error',
'error' => $exception->getMessage()
]);
}
}