Commit 773659e4 authored by wilhelmhb's avatar wilhelmhb
Browse files

entry point for authentication

parent 5566469b
namespace ApiBundle\Entity;
/* Imports */
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
* Class AuthenticationEntryPoint
* Returns a 401 if the user is not logged in instead of redirecting to the login page
class AuthenticationEntryPoint implements AuthenticationEntryPointInterface
* {@inheritdoc}
public function start(Request $request, AuthenticationException $authException = null)
$response = new Response('', 401);
$response->headers->set('Content-Type', 'application/json');
return $response;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment