gpt4 book ai didi

security - symfony2 的多个防火墙

转载 作者:行者123 更新时间:2023-12-02 19:03:47 25 4
gpt4 key购买 nike

如何使用 symfony2 拥有多个防火墙?

文档中提到了这一点,但从未解释过。

最佳答案

我终于找到答案了。这是最终的工作 security.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: MyBundle\Entity\AdminUser
property: username
entity_members:
entity:
class: MyBundle\Entity\User
property: username

firewalls:
admin_secured_area:
pattern: /admin/.*
provider: entity_admin
anonymous: ~
form_login:
check_path: /admin/login_check
login_path: /admin/login
logout:
path: /admin/logout
target: /admin/
members_secured_area:
pattern: /members/.*
provider: entity_members
anonymous: ~
form_login:
check_path: /members/login_check
login_path: /members/login
logout:
path: /members/logout
target: /members/

access_control:
admin_login:
path: /admin/login
roles: IS_AUTHENTICATED_ANONYMOUSLY
admin_area:
path: /admin/.*
roles: ROLE_ADMIN
members_login:
path: /members/login
roles: IS_AUTHENTICATED_ANONYMOUSLY
members_register:
path: /members/register
roles: IS_AUTHENTICATED_ANONYMOUSLY
members_area:
path: /members/.*
roles: ROLE_USER

还有一个pastebin

关于security - symfony2 的多个防火墙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6910731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com