security_rememberme.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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\DependencyInjection\Loader\Configurator;
  11. use Symfony\Component\Security\Core\Authentication\Provider\RememberMeAuthenticationProvider;
  12. use Symfony\Component\Security\Core\Authentication\RememberMe\InMemoryTokenProvider;
  13. use Symfony\Component\Security\Http\Firewall\RememberMeListener;
  14. use Symfony\Component\Security\Http\RememberMe\PersistentTokenBasedRememberMeServices;
  15. use Symfony\Component\Security\Http\RememberMe\ResponseListener;
  16. use Symfony\Component\Security\Http\RememberMe\TokenBasedRememberMeServices;
  17. return static function (ContainerConfigurator $container) {
  18. $container->services()
  19. ->set('security.authentication.listener.rememberme', RememberMeListener::class)
  20. ->abstract()
  21. ->args([
  22. service('security.untracked_token_storage'),
  23. service('security.authentication.rememberme'),
  24. service('security.authentication.manager'),
  25. service('logger')->nullOnInvalid(),
  26. service('event_dispatcher')->nullOnInvalid(),
  27. abstract_arg('Catch exception flag set in RememberMeFactory'),
  28. service('security.authentication.session_strategy'),
  29. ])
  30. ->tag('monolog.logger', ['channel' => 'security'])
  31. ->set('security.authentication.provider.rememberme', RememberMeAuthenticationProvider::class)
  32. ->abstract()
  33. ->args([abstract_arg('User Checker')])
  34. ->set('security.rememberme.token.provider.in_memory', InMemoryTokenProvider::class)
  35. ->set('security.authentication.rememberme.services.abstract')
  36. ->abstract()
  37. ->args([
  38. [], // User Providers
  39. abstract_arg('Shared Token Key'),
  40. abstract_arg('Shared Provider Key'),
  41. [], // Options
  42. service('logger')->nullOnInvalid(),
  43. ])
  44. ->tag('monolog.logger', ['channel' => 'security'])
  45. ->set('security.authentication.rememberme.services.persistent', PersistentTokenBasedRememberMeServices::class)
  46. ->parent('security.authentication.rememberme.services.abstract')
  47. ->abstract()
  48. ->set('security.authentication.rememberme.services.simplehash', TokenBasedRememberMeServices::class)
  49. ->parent('security.authentication.rememberme.services.abstract')
  50. ->abstract()
  51. ->set('security.rememberme.response_listener', ResponseListener::class)
  52. ->tag('kernel.event_subscriber')
  53. ;
  54. };