请求“app_dev.php / login_check”我收到此错误:
“您必须使用防火墙配置检查路径 安全防火墙配置中的form_login。“
这些是我的文件:
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:
chain_provider:
providers: [in_memory, fos_userbundle]
in_memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: adminpass, roles:
[ 'ROLE_ADMIN' ] }
fos_userbundle:
id: fos_user.user_manager
firewalls:
main:
pattern: ^/
form_login:
provider: chain_provider
check_path: /login_check
default_target_path: /chat
logout:
path: /logout
target: /
anonymous: true
switch_user: true
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
access_control:
- { path: ^/_wdt/, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/chat, role: ROLE_USER }
- { path: ^/admin/, role: ROLE_ADMIN }
的routing.yml
AibFrontendBundle:
resource: "@AibFrontendBundle/Controller/"
type: annotation
prefix: /
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/
registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/
change_password.xml"
prefix: /change-password
任何帮助?
symfony2.0.5
答案 0 :(得分:0)
当我尝试通过将“security.authentication.listener.form.class”更改为parameters.yml中的另一个类来覆盖symfony2安全组件登录侦听器(UsernamePasswordFormAuthenticationListener)时出现此错误。更改参数是正确的事情,但是,您必须在执行顺序中更早地执行此操作...我将其移至app / config / config.yml的顶部,现在它可以正常工作。
#app/config/config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
parameters:
security.authentication.listener.form.class: MDPATRICK\MdpatrickBundle\LoginListenerClass