Configuring the security access

Now that you have an admin panel, you want to make sure admin users are the only ones allowed to access its URL. To secure your back-office interface, you can simply resort to Symfony's Security configuration with 4 basic steps :
Create a user entity
You can use the Symfony maker to create a new user.
Configure the user provider
Here is an example of a user provider configuration:
Configure the firewall
Here is an example of how to configure a firewall for your admin routes:
It's important to move the main block under the admin configuration. Otherwise the admin login functionality won't work properly.
Configure Access Control Authorization
Only admin users will have access to "/admin" routes.
Last updated