I have an application where an user can belong to many companies. The user access the company portal via compnaysubdomain.example.com). When an user access a compnay portal I have to update the roles he have for that company (By checking the subdomain and the database). I created a request event listener for that, which parses the subdomain, queries the database and adds the new roles to the user. The problem is I need to be able to to access the security context so I can update the user roles, so my listener priority has to be less than Firewall priority. But, if firewall listener is executed first, It checks for the user Roles immediatly which are not updated yet based on the company.

Any suggestions?. May be I need to implement a Custom Firewall Listener or something like that. I dont want to overcomplicate.

Thank you.

有帮助吗?

解决方案

Ok. I have decided to create A Firewall listener to achieve this. I followed the tutorial http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html but only created the Firewall LIstener. The token and provider I am using the one that I was already using.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top