Symfony2:"security.providers.in_memory.memory" 下无法识别的选项 "admin"
Symfony2 : Unrecognized option "admin" under "security.providers.in_memory.memory"
我在尝试
时遇到了这个问题
php app/console server:run
它告诉我这个错误:
无法识别 "security.providers.in_memory.memory" 下的选项 "admin"
这是我的 security.yml
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
Custom\CMSBundle\Entity\User: bcrypt
role_hierarchy:
ROLE_ADMIN: [ROLE_USER]
providers:
chain_providers:
chain:
providers: [in_memory, user_db]
in_memory:
memory:
users:
admin: { password: adminpass, roles: ROLE_ADMIN }
user_db:
entity: { class: CustomCMSBundle:User, property: username }
firewalls:
main:
pattern: /.*
form_login:
login_path: /login
check_path: /login_check
default_target_path: /
logout:
path: /logout
target: /
security: true
anonymous: true
access_control:
- { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /cms/user, roles: ROLE_ADMIN }
- { path: /.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
定义的用户(在本例中为 admin
)应在 users
映射内定义,因此缩进必须大于 users
:
in_memory:
memory:
users:
admin: { password: adminpass, roles: ROLE_ADMIN }
我在尝试
时遇到了这个问题php app/console server:run
它告诉我这个错误:
无法识别 "security.providers.in_memory.memory" 下的选项 "admin"
这是我的 security.yml
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
Custom\CMSBundle\Entity\User: bcrypt
role_hierarchy:
ROLE_ADMIN: [ROLE_USER]
providers:
chain_providers:
chain:
providers: [in_memory, user_db]
in_memory:
memory:
users:
admin: { password: adminpass, roles: ROLE_ADMIN }
user_db:
entity: { class: CustomCMSBundle:User, property: username }
firewalls:
main:
pattern: /.*
form_login:
login_path: /login
check_path: /login_check
default_target_path: /
logout:
path: /logout
target: /
security: true
anonymous: true
access_control:
- { path: /login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /cms/user, roles: ROLE_ADMIN }
- { path: /.*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
定义的用户(在本例中为 admin
)应在 users
映射内定义,因此缩进必须大于 users
:
in_memory:
memory:
users:
admin: { password: adminpass, roles: ROLE_ADMIN }