vendor/symfony/security-http/RememberMe/RememberMeServicesInterface.php line 18

Open in your IDE?
  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\RememberMe;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  14. trigger_deprecation('symfony/security-http', '5.4', 'The "%s" interface is deprecated, use "%s" instead.', RememberMeServicesInterface::class, RememberMeHandlerInterface::class);
  15. /**
  16. * Interface that needs to be implemented by classes which provide remember-me
  17. * capabilities.
  18. *
  19. * We provide two implementations out-of-the-box:
  20. * - TokenBasedRememberMeServices (does not require a TokenProvider)
  21. * - PersistentTokenBasedRememberMeServices (requires a TokenProvider)
  22. *
  23. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  24. *
  25. * @method logout(Request $request, Response $response, TokenInterface $token)
  26. *
  27. * @deprecated since Symfony 5.4, use {@see RememberMeHandlerInterface} instead
  28. */
  29. interface RememberMeServicesInterface
  30. {
  31. /**
  32. * This attribute name can be used by the implementation if it needs to set
  33. * a cookie on the Request when there is no actual Response, yet.
  34. */
  35. public const COOKIE_ATTR_NAME = '_security_remember_me_cookie';
  36. /**
  37. * This method will be called whenever the TokenStorage does not contain
  38. * a TokenInterface object and the framework wishes to provide an implementation
  39. * with an opportunity to authenticate the request using remember-me capabilities.
  40. *
  41. * No attempt whatsoever is made to determine whether the browser has requested
  42. * remember-me services or presented a valid cookie. Any and all such determinations
  43. * are left to the implementation of this method.
  44. *
  45. * If a browser has presented an unauthorised cookie for whatever reason,
  46. * make sure to throw an AuthenticationException as this will consequentially
  47. * result in a call to loginFail() and therefore an invalidation of the cookie.
  48. *
  49. * @return TokenInterface|null
  50. */
  51. public function autoLogin(Request $request);
  52. /**
  53. * Called whenever an interactive authentication attempt was made, but the
  54. * credentials supplied by the user were missing or otherwise invalid.
  55. *
  56. * This method needs to take care of invalidating the cookie.
  57. */
  58. public function loginFail(Request $request, ?\Exception $exception = null);
  59. /**
  60. * Called whenever an interactive authentication attempt is successful
  61. * (e.g. a form login).
  62. *
  63. * An implementation may always set a remember-me cookie in the Response,
  64. * although this is not recommended.
  65. *
  66. * Instead, implementations should typically look for a request parameter
  67. * (such as an HTTP POST parameter) that indicates the browser has explicitly
  68. * requested for the authentication to be remembered.
  69. */
  70. public function loginSuccess(Request $request, Response $response, TokenInterface $token);
  71. }