【问题标题】:Unrecognized option "knpu_guard" under "security.firewalls.main" (Symfony)“security.firewalls.main”(Symfony)下无法识别的选项“knpu_guard”
【发布时间】:2017-07-25 12:33:22
【问题描述】:

我想在我的网站上添加 facebook 登录选项。我尝试关注this tutorial。但是如果我在主要部分下添加knpu_guard 部分,我会收到此错误:

Unrecognized option "knpu_guard" under "security.firewalls.main"

security.yml 中的 firewalls 部分如下所示:

firewalls:
    main:
        anonymous: ~
        #pattern:    ^/
        provider: our_db_provider
        form_login:
            login_path: login
            check_path: login
        logout:
            path:   /logout
            target: /
        knpu_guard:
            authenticators:
                - app.form_login_authenticator
                - app.api_token_authenticator
                - app.facebook_authenticator
            # by default, use the start() function from FormLoginAuthenticator
            entry_point: app.form_login_authenticator

我刚刚添加了knpu_guard 部分,firewalls 部分下没有其他任何更改

【问题讨论】:

    标签: php symfony facebook-login symfony-3.2 php-7.1


    【解决方案1】:

    我认为该教程有点过时了,因为 knpu_guard 不再被接受。

    您可以使用guard 作为security.yml 文件中的键

    Discussion

    尝试使用这个

    form_login:
       login_path: login
       check_path: login
       provider: user_provider #where is this provider? It shouldn't be fos_userbundle for example?
    anonymous: true
    

    【讨论】:

    • 现在我得到这个错误:The service "security.authentication.manager" has a dependency on a non-existent service "app.form_login_authenticator".
    • 我已经更新了答案,但是现在很难理解这个问题
    • 用户存储在数据库中。我的User 类实现了UserInterface。我不使用fos_userbundle
    猜你喜欢
    • 2018-03-07
    • 2016-07-22
    • 1970-01-01
    • 1970-01-01
    • 2013-12-19
    • 2016-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多