这是我的security.yml文件
security:
access_denied_url: home
encoders:
Coupon\MainBundle\Entity\User:
algorithm: sha512
iterations: 1
encode_as_base64: true
role_hierarchy:
ROLE_ADMIN: [ROLE_USER]
ROLE_SUPER_ADMIN: [ROLE_ADMIN]
providers:
main:
entity: { class: CouponMainBundle:User }
firewalls:
secured_area:
pattern: ^/
form_login:
check_path: _auth_check
always_use_default_target_path: true
default_target_path: /dut
login_path: /
logout:
path: action_logout
target: action_login
anonymous: ~
access_control:
- { path: ^/admin.*, role: ROLE_ADMIN }
但是当尝试使用/admin
(getRoles的var_dump返回ROLE_ADMIN
)的用户转到array(2) { [0]=> string(10) "ROLE_ADMIN" [1]=> string(9) "ROLE_USER" }
时,它会将我重定向到主页,你能帮助我吗?我的错在哪里?