Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

New in Symfony 3.2: Firewall config class and profiler

Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.

Contributed by
Robin Chalas
in #19398 and #19490.

Introduced a new FirewallConfig class

A long-standing demand of Symfony developers was to have a class representing the current firewall configuration. In Symfony 3.2, we introduced a new Symfony\Bundle\SecurityBundle\Security\FirewallConfig class which provides information such as its name, provider, context, entry point, access denied URL, etc.

The firewall configuration can also be accessed through the getFirewallConfig(Request $request) method of the FirewallMap and through the getConfig() method of the FirewallContext.

This new class is useful to get the firewall configuration inside an authentication listener and even from the Symfony profiler, as explained below.

Integrated the firewall in the profiler

In Symfony 3.2, thanks to this new firewall config class, the debug toolbar displays the name of the current firewall. This is useful to quickly spot config errors in your security.yml file:

Moreover, the Symfony Profiler now displays the full firewall configuration in the security panel:

Help the Symfony project!

As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.

New in Symfony 3.2: Firewall config class and profiler

Tweet this


thank you (y)
This is fantastic!
I love it! Thank you!
Excellent !
I will finally be able to remove this custom code for some projects!
Thanks a lot for this!
Buena idea, muy util. Gracias!!

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.