AuthenticationEntryPointInterface.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Security\Http\EntryPoint;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\Security\Core\Exception\AuthenticationException;
  14. /**
  15. * Implement this interface for any classes that will be called to "start"
  16. * the authentication process (see method for more details).
  17. *
  18. * @author Fabien Potencier <fabien@symfony.com>
  19. */
  20. interface AuthenticationEntryPointInterface
  21. {
  22. /**
  23. * Returns a response that directs the user to authenticate.
  24. *
  25. * This is called when an anonymous request accesses a resource that
  26. * requires authentication. The job of this method is to return some
  27. * response that "helps" the user start into the authentication process.
  28. *
  29. * Examples:
  30. *
  31. * - For a form login, you might redirect to the login page
  32. *
  33. * return new RedirectResponse('/login');
  34. *
  35. * - For an API token authentication system, you return a 401 response
  36. *
  37. * return new Response('Auth header required', 401);
  38. *
  39. * @return Response
  40. */
  41. public function start(Request $request, AuthenticationException $authException = null);
  42. }