我在 Symfony2 中的安全配置有问题。我有两个实体:Admins
和Users
.
我正在关注这个问题,但总是有"admin/login_check" unable to find
例外。
谢谢!
安全.yml
security:
encoders:
entity_admin:
class: MyBundle\Entity\AdminUser
algorithm: sha512
iterations: 5000
encode_as_base64: false
entity_members:
class: MyBundle\Entity\User
algorithm: sha512
iterations: 1000
encode_as_base64: false
providers:
entity_admin:
entity:
class: Mdv\CommonBundle\Entity\Administrator
property: username
entity_members:
entity:
class: Mdv\CommonBundle\Entity\User
property: username
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
admin_secured_area:
pattern: ^/admin
provider: entity_admin
anonymous: ~
form_login:
login_path: /admin/login
check_path: /admin/login_check
logout:
path: /admin/logout
target: /admin/
members_secured_area:
pattern: ^/user
provider: entity_members
anonymous: ~
form_login:
check_path: /user/login_check
login_path: /user/login
logout:
path: /user/logout
target: /user/
access_control:
admin_login:
path: /admin/login
roles: IS_AUTHENTICATED_ANONYMOUSLY
admin_area:
path: ^/admin
roles: ROLE_ADMIN
members_login:
path: /user/login
roles: IS_AUTHENTICATED_ANONYMOUSLY
members_register:
path: /user/register
roles: IS_AUTHENTICATED_ANONYMOUSLY
members_area:
path: ^/user
roles: ROLE_USER
路由.yml
admin_administrator:
resource: @MdvAdminBundle/Resources/config/routing/administrator.yml
prefix: /admin
管理员.yml
admin_login:
pattern: /login
defaults: { _controller: MdvAdminBundle:Administrator:login }
admin_login_check:
pattern: /login_check
admin_logout:
pattern: /logout