这是我的安全防火墙配置:
firewalls:
# Disabling the security for the web debug toolbar, the profiler and Assetic.
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# -> custom firewall for the admin area of the URL
qis:
pattern: /qis(.*)
context: user
form_login:
provider: fos_userbundle
login_path: /login
check_path: /qis/login_check
logout:
path: /qis/logout
anonymous: false
# This firewall is used to handle the public login area
# This part is handled by the FOS User Bundle
main:
pattern: .*
context: user
form_login:
provider: fos_userbundle
login_path: /login
use_forward: true
default_target_path: /qis
#always_use_default_target_path: false
check_path: /login_check
failure_path: null
logout:
path: /logout
anonymous: true
# Session liftime
remember_me:
key: '%secret%'
lifetime: 28800
# Sonata User Impersonating
switch_user: true
完整配置:security.yml
这些是按预期工作的用例:
- 当直接访问登录页面 /login 时,用户被正确地重定向到 default_target_path qis/。
- 当访问一个页面时,例如 /contract 用户被正确地重定向回这个请求的页面。
我想使用qis防火墙实现2中提到的相同行为。
但:
当通过 qis 路由访问时,例如http://localhost:8000/qis/contract/list,它不会重定向到相同的链接,而是再次重定向到 default_target_path qis/。
qis防火墙需要哪些设置?