【发布时间】:2014-07-16 10:24:57
【问题描述】:
在我的应用程序中,我在 security.yml 中有两个防火墙(示例如下)。如您所见,“admin_secured_area”和“account_secured_area”防火墙具有非常相似的属性,只是偶尔会有所不同。我想知道有没有办法避免输入 2 次常用属性。例如,我可以从基础(父)防火墙继承属性吗?或者我可以从一个位置导入所需的属性吗?还是有其他选择?
security:
firewalls:
admin_secured_area:
stateless: true
lexik_jwt:
authorization_header:
enabled: false
query_parameter:
enabled: true
name: lexiktoken
throw_exceptions: true
create_entry_point: true
entry_point: foobar.authentication_handler
provider: in_memory
pattern: ^/admin
form_login:
username_parameter: username
password_parameter: password
require_previous_session: false
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
check_path: /admin/login
logout:
path: /admin/logout
success_handler: foobar.authentication_handler
account_secured_area:
stateless: true
lexik_jwt:
authorization_header:
enabled: false
query_parameter:
enabled: true
name: lexiktoken
throw_exceptions: true
create_entry_point: true
entry_point: foobar.authentication_handler
provider: user_db
pattern: ^(/account)|(/reset-password)
form_login:
username_parameter: username
password_parameter: password
require_previous_session: false
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
check_path: /account/login
logout:
path: /account/logout
success_handler: foobar.authentication_handler
【问题讨论】: