完成安装FosUserBundle但我不能在我的网站babkend上包含Logout标记。
这是我的安全配置
安全性: 供应商: fos_userbundle: id:fos_user.user_manager
encoders:
"Symfony\Component\Security\Core\User\User": plaintext
"FOS\UserBundle\Model\UserInterface": sha512
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
#default_target_path: default_security_target
#always_use_default_target_path: true
logout:
path: /admin/logout
target: /
#success_handler: persona_entity_user.component.authentication.handler.logout_success_handler
anonymous: true
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
- { path: ^/_profiler, role: IS_AUTHENTICATED_ANONYMOUSLY }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
答案 0 :(得分:0)
您只需要一个按钮或指向fos_user_security_logout的链接。
类似的东西:
<a href="{{ path(' fos_user_security_logout') }}" class="btn">logout</a>