Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
symfony 5配置路径“;安全。访问控制;无法覆盖。错误?_Symfony_Facebook Login_Symfony5 - Fatal编程技术网

symfony 5配置路径“;安全。访问控制;无法覆盖。错误?

symfony 5配置路径“;安全。访问控制;无法覆盖。错误?,symfony,facebook-login,symfony5,Symfony,Facebook Login,Symfony5,我试图在symfony 5中使用集成社交登录,我已经按照链接中提供的步骤进行了操作,但我认为从我开始就出现了一些错误,它不断地给我这个错误 无法覆盖配置路径“security.access\u control”。必须在一个配置节中定义此路径及其任何子路径的所有选项 我正在开发模式下工作,上面显示了上述错误 即使当我尝试php bin/console缓存:clear时,它也会给我这个 // Clearing the cache for the prod environment with debu

我试图在symfony 5中使用集成社交登录,我已经按照链接中提供的步骤进行了操作,但我认为从我开始就出现了一些错误,它不断地给我这个错误

无法覆盖配置路径“security.access\u control”。必须在一个配置节中定义此路径及其任何子路径的所有选项

我正在开发模式下工作,上面显示了上述错误

即使当我尝试
php bin/console缓存:clear
时,它也会给我这个

 // Clearing the cache for the prod environment with debug false


In BaseNode.php line 294:

  Configuration path "security.access_control" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.
这是my security.yaml文件

安全性:
# https://symfony.com/doc/current/security.html#where-用户是否来自用户提供商
编码器:
应用程序\实体\成员:
算法:bcrypt
应用程序\实体\用户:
算法:bcrypt
供应商:
成员:
实体:
类别:应用程序\实体\成员
属性:用户名\电子邮件
#用于从会话和其他功能重新加载用户(例如切换用户)
应用程序\用户\提供商:
实体:
类别:应用程序\实体\用户
物业:电邮
防火墙:
开发人员:
模式:^/((探查器wdt)| css |图像| js)/
安全性:错误
管理员:
模式管理
上下文:用户
表格(u)登入:
提供者:应用程序\用户\提供者
登录路径:/management/login
使用前向:false
检查路径:/management/login\u检查
失败路径:null
csrf_令牌_生成器:security.csrf.token_管理器
警卫:
认证者:
-App\Security\LoginFormBackAuthenticator
提供者:应用程序\用户\提供者
注销:
路径:/management/logout
目标:/management/login
匿名:是的
主要内容:
模式:^/
背景:成员
表格(u)登入:
提供者:成员
登录路径:前台安全登录
使用前向:false
检查路径:/login\u检查
失败路径:null
csrf_令牌_生成器:security.csrf.token_管理器
警卫:
认证者:
-App\Security\LoginFormAuthenticator
提供者:成员
注销:
路径:前\安全\注销
目标:前沿指数
匿名:是的
#激活不同的身份验证方法
# https://symfony.com/doc/current/security.html#firewalls-认证
# https://symfony.com/doc/current/security/impersonating_user.html
#开关用户:true
#控制站点大部分访问的简单方法
#注意:仅使用匹配的*第一*访问控制
角色层次结构:
角色超级管理员:[角色超级用户,角色超级管理员,角色超级管理员]
角色\管理员:[角色\用户,角色\管理员]
角色用户:[角色用户]
访问控制:
-{path:^/(%locales%)/$,角色:已\u匿名验证\u}
#-{path:^/(%locales%)/my profile/*,如果“是否已完全验证”()则允许\u}
-{path:^/(%locales%)/mon\u profil/*,如果:“是完全认证的吗()”}
#-{path:^/(%locales%)/uفحتي/*,如果“是完全认证的()”,则允许
#-{path:^/(%locales%)/addnew advert/*,如果“是完全认证的吗()”}
-{path:^/(%locales%)/ajourner-nouvelle-annonce,如果:“是否已完全验证()”,则允许
#-{路径:^/(%地区%)/如果:“完全认证了吗?”,则允许
-{path:^/management/password recover,如果:“!是完全认证的吗()”}
-{path:^/management/reset password/*,如果:“!已完全\u验证()”,则允许\u}
-{path:^/management/login,如果:“!是完全认证的吗()”}
-{path:^/management/register,如果:“!是完全认证的吗()”}
-{路径:^/management/account confirm/*,如果:“!已完全\u验证()”,则允许\u}
-{path:^/management/ajax/generate password,如果:“!是完全认证的吗()”}
-{path:^/management/ajax/reset password,如果:“!是完全认证的吗()”}
-{path:^/management,如果“是完全认证的()”,则允许
-{path:^/management/ajax,如果:“是完全认证的吗()”}

自从默认的Symfony改为5.1.x以来,我已经在任何类型的Symfony创建的项目(最小或完整)上使用了它。 虽然我还没有找到让5.1.x运行的方法,但回滚到5.0.x似乎是可行的


如果我发现了一个修复或5.1.x得到了修复,我将更新我的答案。

我遇到了完全相同的问题(Symfony 5.2)

因此,我完全删除了我的
安全。访问控制

从my
config/packages/security.yaml

下一个错误消息是:

Because you have multiple guard authenticators, you need to set the "guard.entry_point" key to one of your authenticators (App\Security\AppCustomAuthenticator, App\Security\AppCustomAuthenticator).
虽然我只有一个验证器
App\Security\AppCustomAuthenticator

我阅读了关于guard身份验证的文档,发现这个问题似乎是由多个身份验证系统造成的

最终找到了解决方案(至少对我来说是这样): 我在我的guard authenticator中添加了
entry\u point
config:

guard:
            authenticators:
                - App\Security\AppCustomAuthenticator
            entry_point: App\Security\AppCustomAuthenticator <-- new config that saved me.
guard:
认证者:
-App\Security\AppCustomAuthenticator

入口点:App\Security\AppCustomAuthenticator问题在
public/index.php
bin/console.php
中,我在替换以下行时解决了这个问题

(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');

使用xdebug,我可以看到
$\u服务器['APP\u ENV']
是空的

<
(new Dotenv())->overload(dirname(__DIR__).'/.env');