Do you use ControllerListener.php to monitor/
1. I want to know how to restrict the access rights of several bundles through the same controller. For example, if the user is not logged in, jump directly to the homepage or login page.
2. How to set access permissions for a bundle. is user-based
It’s too flexible and has too many methods. Let’s write down one aspect for now:
There is a third-party user function package: FOSUserBundle
If you write it yourself, before using the login form, you need to tell the framework how user information is saved. If you use Doctrine and a database, you have to write a User Entity and implement the SymfonyComponentSecurityCoreUserUserInterface interface.
(1) Create user class
(2) Use this user class
(3) Add permission control
Security verification can be controlled at the URL level. If you let your bundle share a certain URL rule, you can use a rule to control it:
You can also use the JMSSecurityExtraBundle that comes with Symfony 2, which can be configured with annotations:
Symfony 2 has many security component configuration items, you can refer to: http://symfony.com/doc/current/refere...
Form verification (form_login), which is the most common login box form, is one of the verification methods supported by Symfony 2 security components by default. Others include X.509, HTTP Basic, HTTP Digest, etc., and can also be verified through third parties The code package adds other verification methods. The configuration items of form validation are as follows, I have commented some commonly used items:
There are also built-in ACLs that provide more fine-grained control. But that’s another big chapter.
Thank you very much for your answer. The built-in ACL is indeed very powerful. Thank you