Search code examples
symfonysilexsymfony-security

Symfony RememberMe token_provider


I'm building an app with silex and I'm using the built-in SecurityServiceProvider and I'm trying to use the rememberme service and I'm looking at the documentation and there a option called token_provider but symfony doesn't really state if that is a string or if its an instance of an object.

any help will be appreciated.


Solution

  • This parameter is a service id of a token provider to use. Services id are strings (then Symfony looks for the class in the DIC, Silex does the same) so you need to declare a FQDN of your token provider class. By default Symfony uses the Symfony\Component\Security\Core\Authentication\RememberMe\InMemoryTokenProvider class

    If you want to create your own (probably you won't), you can take a look at how Doctrine Project programed this service by implementing the TokenProviderInterface.