php - Symfony 3 - 无法实现 FOSUser 安全登录,因为我也使用 CAS 身份验证
问题描述
我想在我的 security.yml 上添加我的 FOSUser 登录方法,因为我使用身份验证 CAS,但我希望在我的主页上使用登录表单进行身份验证(数据库上的用户表与来自 CAS 身份验证的用户不同)
所以我像这样配置了我的security.yml:
# app/config/security.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
app:
id: bes_auth.user_provider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
# anonymous: true
public:
pattern: ^accueil
security: false
anonymous: true
main:
logout_on_user_change: true
pattern: ^/(admin|profile|packages|securiteInformatique|logout)
# pattern: ^/(?!accueil)
guard:
authenticators:
- app.security.login_form_authenticator:
check_path: fos_user_check_path
- bes_auth.authenticator
entry_point: Site\PagesBundle\Security\LoginFormAuthenticator
logout:
path: deconnexion #nom de la route de déconnexion
target: /
success_handler: bes_auth.authenticator
anonymous: true
access_control:
- { path: ^/admin, role: ROLE_SUPER_ADMIN }
- { path: ^/accueil, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, role: ROLE_USER }
但我现在有这个错误:
路径“security.firewalls.main.guard.authenticators.0”的类型无效。预期的标量,但得到了数组。
是关于 :
guard:
authenticators:
- app.security.login_form_authenticator:
check_path: fos_user_check_path
- bes_auth.authenticator
entry_point: Site\PagesBundle\Security\LoginFormAuthenticator
但是我看不出有什么问题,有人可以帮我吗?
解决方案
just change your first Guard Authenticator without the option check_path: fos_user_check_path like this :
...........
guard:
authenticators:
- app.security.login_form_authenticator
- bes_auth.authenticator
if you want more explain, this is the document: here
thanks, I hope it's help you
推荐阅读
- excel - 如何生成从 Excel 电子表格中读取数据的极坐标图?
- php - 通过jquery提交表单时PHP中的isset验证失败
- php - 仅通过电话号码注册 laravel
- ibm-cloud-infrastructure - 订购 VSI 时如何指定链接速度
- android - 如何在android中向NavigationUI添加动画过渡?
- filepath - 我已经通过 git clone 将文件下载到我在 google colab 上的笔记本中,我现在如何确定该文件的路径?
- jquery - 样式为显示块时计算类的长度
- matlab - 如何在背景中绘制带有网格线的漂亮条形?
- inheritance - Dart 中基于 Mixin 的继承是什么?
- swift - Swift - 表格视图单元格内的单击按钮不会在该单元格的功能处调用确实选择行