
Security & Authentication
Firewalls, providers, encoders, voters, authenticators, JWT, OAuth2, access control
1What is the main role of a firewall in Symfony's Security component?
What is the main role of a firewall in Symfony's Security component?
Answer
A firewall in Symfony defines a security zone for a part of the application. It determines how users are authenticated (form, token, API key) and which URLs are protected. Each firewall can have its own authentication configuration and user provider.
2What is a User Provider in Symfony Security?
What is a User Provider in Symfony Security?
Answer
A User Provider is responsible for loading user information from a data source (database, LDAP, external API). It implements the UserProviderInterface and provides methods to load a user by identifier or refresh user data from the session.
3Which interface must a User class implement to be used with Symfony Security?
Which interface must a User class implement to be used with Symfony Security?
Answer
The User class must implement UserInterface which defines essential methods: getUserIdentifier() for the unique identifier, getRoles() for roles, and eraseCredentials() to erase sensitive data. PasswordAuthenticatedUserInterface is also required for password authentication.
How to define role-based access control in security.yaml?
What is the difference between authentication and authorization in Symfony Security?
+23 interview questions
Other Symfony interview topics
Modern PHP (8.1+)
Symfony Basics
Routing & Controllers
Twig & Templates
Doctrine ORM Basics
Symfony Forms
Data Validation
Dependency Injection & Services
Doctrine Advanced
API Platform
Serializer Component
Events & Event Subscribers
Console & Commands
Messenger Component
HTTP Client
Cache & Performance
Workflow Component
Testing Symfony
Mailer Component
Translations & i18n
EasyAdmin Bundle
Symfony Architecture
Performance & Optimization
Security Advanced
Custom Bundles
Microservices with Symfony
Real-time & WebSockets
Deployment & DevOps
Master Symfony for your next interview
Access all questions, flashcards, technical tests, code review exercises and interview simulators.
Start for free