You are browsing the documentation for Symfony 2.7 which is not maintained anymore.
Consider upgrading your projects to Symfony 5.3.
The Security Component
The Security Component¶
The Security component provides a complete security system for your web application. It ships with facilities for authenticating using HTTP basic or digest authentication, interactive form login or X.509 certificate login, but also allows you to implement your own authentication strategies. Furthermore, the component provides ways to authorize authenticated users based on their roles, and it contains an advanced ACL system.
$ composer require symfony/security
Alternatively, you can clone the https://github.com/symfony/security repository.
If you install this component outside of a Symfony application, you must
vendor/autoload.php file in your code to enable the class
autoloading mechanism provided by Composer. Read
this article for more details.
The Security component is divided into four smaller sub-components which can be used separately:
- It provides all the common security features, from authentication to authorization and from encoding passwords to loading users.
- It integrates the core sub-component with the HTTP protocol to handle HTTP requests and responses.
- It provides protection against CSRF attacks.
- It provides a fine grained permissions mechanism based on Access Control Lists.
- The Firewall and Authorization
- Securely Comparing Strings and Generating Random Values
- How Does the Security access_control Work?
- How to Create a Custom Access Denied Handler
- How to Use Access Control Lists (ACLs)
- How to Use advanced ACL Concepts
- How to Authenticate Users with API Keys
- Using CSRF Protection in the Login Form
- How to Create a custom Authentication Provider
- How to Create a Custom Form Password Authenticator
- How to Create a custom User Provider
- How to Load Security Users from the Database (the Entity Provider)
- Security: Complex Access Controls with Expressions
- How to Restrict Firewalls to a Specific Request
- How to Force HTTPS or HTTP for different URLs
- How to Customize Redirect After Form Login
- How to Build a Traditional Login Form
- How to Restrict Firewalls to a Specific Host
- How to Impersonate a User
- How to Use multiple User Providers
- How to Choose the Password Encoder Algorithm Dynamically
- How to Manually Encode a Password
- Using pre Authenticated Security Firewalls
- How to Add “Remember Me” Login Functionality
- How to Secure any Service or Method in your Application
- How to Check for Known Security Vulnerabilities in Your Dependencies
- How to Change the default Target Path Behavior
- How to Use Voters to Check User Permissions
- SecurityBundle Configuration (“security”)
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.