我确实有以下security.yml:
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
Frontend\AccountBundle\Entity\User:
id: sha256salted_encoder
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
chain_provider:
chain:
providers: [in_memory, user_db]
in_memory:
memory:
users:
foo: { password: test, roles: ROLE_USER }
user_db:
entity: { class: Frontend\AccountBundle\Entity\User, property: email }
access_control:
- { path: ^/secarea/, roles: ROLE_USER }
如果我要以用户身份登录....
... FOO:
...作为db用户:
为什么会有不同?
评论:我是否必须从db为用户提供角色?我可以为db用户设置默认角色吗?