所有!
我想将安全系统的应用程序整合在一起.
在security.yml文件下面
我想将安全系统的应用程序整合在一起.
在security.yml文件下面
security: encoders: Symfony\Component\Security\Core\User\User: plaintext role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER,ROLE_ADMIN,ROLE_ALLOWED_TO_SWITCH] providers: in_memory: users: user: { password: userpass,roles: [ 'ROLE_USER' ] } admin: { password: adminpass,roles: [ 'ROLE_ADMIN' ] } firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false login: pattern: ^/{_locale}/demo/secured/login$ security: false secured_area: pattern: ^/{_locale}/demo/secured/ form_login: check_path: /{_locale}/demo/secured/login_check login_path: /{_locale}/demo/secured/login logout: path: /{_locale}/demo/secured/logout target: /{_locale}/demo/
问题:
logout->目标返回不工作.
有人可以帮我吗
PS:任何例子都不会赞赏!
谢谢
只需确保为他们定义所有使用区域设置变量的路由,并且安全性似乎自动接收它.无需在安全配置中占用该区域.
原文链接:https://www.f2er.com/php/130706.html这是我的项目的一个例子.
摘自security.yml:
login: pattern: /(game|admin)/login$ security: false admin: pattern: /admin/ form_login: check_path: /admin/login_check login_path: _admin_login logout: path: _admin_logout target: _home game: pattern: /game/ form_login: check_path: /game/login_check login_path: _game_login logout: path: _game_logout target: _home
摘录from routing.yml:
BrowserMMOSecurityBundle: resource: "@BrowserMMOSecurityBundle/Controller/" type: annotation prefix: /{_locale}/ defaults: { _locale: en } requirements: _locale: en|fr _game_login_check: pattern: /game/login_check _admin_login_check: pattern: /admin/login_check _admin_logout: pattern: /{_locale}/admin/logout requirements: _locale: en|fr _game_logout: pattern: /{_locale}/game/logout requirements: _locale: en|fr
以上配置适用于我.还值得注意的是,在我的SecurityController类的注释中定义了_admin_login和_game_login路由.