sajad torkamani

What is a user provider?

A user provider is responsible for loading users from a storage source (e.g., MySQL database) based on a “user identifier (e.g., email address).

The user is loaded in the following places during the security lifecycle:

  • Login: During login, the provider loads the user based on an identifier like an email address.
  • Reload user from session: For stateful firewalls, the user provider loads the user from the session.

Built-in providers

Symfony provides several built-in user providers:

  • Entity user provider: loads users from a database using Doctrine.
  • Memory user provider: loads users from a configuration file
  • More…
Tagged: Symfony