简体   繁体   English

Symfony 2/3:检查用户是否在任何URL后面的防火墙中

[英]Symfony 2/3 : Check user against a firewall behind any url

I've been looking for a solution to this problem for weeks. 数周以来,我一直在寻找解决方案。

Let's say i have two firewalls : 假设我有两个防火墙:

  • The first is named "admin", match pattern "admin/*" 第一个命名为“ admin”,匹配模式为“ admin / *”
  • The other is named "customers", match pattern "*" 另一个名为“客户”,匹配模式为“ *”

The two firewalls are using different providers so an admin is not an instance of customer which means that an identified user can be an admin or a customer. 这两个防火墙使用的是不同的提供程序,因此管理员不是客户的实例,这意味着所标识的用户可以是管理员或客户。

I'd like, on the front office (not in /admin), to provide special functionality a logged in admin but the AuthorizationChecker and the RequestMatcher are not working since they want an url that match /admin. 我想在前端办公室(不在/ admin中)提供特殊功能(已登录的admin),但是AuthorizationChecker和RequestMatcher无法正常工作,因为它们想要与/ admin匹配的网址。

I need to have 2 different firewall and providers since i want my users to be able to log in as an admin or as a customer. 我需要2个不同的防火墙和提供程序,因为我希望我的用户能够以管理员或客户身份登录。

您应该使用角色,而不是2个不同的防火墙

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Symfony 2.8 - 如何为任何URL配置防火墙? - Symfony 2.8 - How to configure a firewall for any URL? 如何在symfony2安全配置中将“login_check”放在防火墙后面 - How to put “login_check” behind firewall in symfony2 security config Symfony登录尽管位于防火墙后仍无法找到路径login_check的控制器 - Symfony login unable to find controller for path login_check despite being behind firewall Symfony 3对防火墙下的页面进行身份验证 - Symfony 3 authenticating against pages under firewall symfony2调试:尽管上下文相同,但在访问其他防火墙后面的路由时,用户将断开连接 - symfony2 debugging: user gets disconnected when accessing routes behind other firewall despite same context Symfony Flex 位于严格的企业防火墙/代理之后 - Symfony Flex behind strict corporate firewall / proxy 在 Symfony2 中判断路由是否在防火墙后面 - Tell whether route is behind firewall in Symfony2 Symfony:SecurityContext中没有为防火墙后面的路由找到令牌 - Symfony: A Token was not found in the SecurityContext for route behind firewall Symfony模拟用户和多个防火墙 - Symfony impersonate a User and multiple firewall symfony 中防火墙外的登录用户 - Logged user outside firewall in symfony
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM