使用Symfony 2,我正在寻找有关您可以在安全配置文件app/config/security.yml(官方文档)中定义的处理程序的更多信息.该文档未提供有关处理程序的任何信息.以下是安全文件的摘录:
# app/config/security.yml
security:
...
firewalls:
somename:
form_login:
...
# login failure redirecting options (read further below)
failure_path: /foo
failure_forward: false
failure_path_parameter: _failure_path
failure_handler: some.service.id
success_handler: some.service.id
logout:
path: /logout
target: /
invalidate_session: false
delete_cookies:
a: { path: null, domain: null }
b: { path: null, domain: null }
handlers: [some.service.id, another.service.id]
success_handler: some.service.id
anonymous: ~
Run Code Online (Sandbox Code Playgroud)
在form_login ang logout部分中都有一个success_handler字段.此外,对于注销部分,您可以使用handlers字段定义多个处理程序.
我有两个问题:
如果我定义一个succes_handler服务(使用例如AuthenticationSuccessHandlerInterface或LogoutHandlerInterface),它是否会覆盖框架中提供的默认成功处理程序?
对于注销部分的配置,该如何工作handlers?
有关信息,请在注销部分app/config/security.yml:
handlers: [some.service.id, another.service.id]=>这里你必须定义服务实现Symfony\Component\Security\Http\Logout\LogoutHandlerInterface.这些句柄不需要返回响应.在我的例子中,我创建了一个简单的处理程序,在注销时创建一个flash消息.
success_handler: some.service.id=>这里你必须定义一个实现=>的服务Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface.此处理程序必须返回响应.此处理程序由Symfony\Component\Security\Http\Firewall\LogoutListener(防火墙侦听器)的构造函数调用.
| 归档时间: |
|
| 查看次数: |
4267 次 |
| 最近记录: |