加入收藏 | 设为首页 | 会员中心 | 我要投稿 北几岛 (https://www.beijidao.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

php – 同一防火墙中的Symfony2身份验证方法

发布时间:2021-08-28 03:44:35 所属栏目:大数据 来源: https://www.jb51.cc
导读:我是Symfony2的新手.我阅读了文档并看到了一些登录表单的配置 http://symfony.com/doc/current/cookbook/security/form_login_setup.html # app/config/security.ymlsecurity: # ... firewalls: default: anonymous: ~ http_basic: ~ form_login: login_path

我是Symfony2的新手.我阅读了文档并看到了一些登录表单的配置
http://symfony.com/doc/current/cookbook/security/form_login_setup.html

# app/config/security.yml
security:
    # ...

    firewalls:
        default:
            anonymous: ~
            http_basic: ~
            form_login:
                login_path: /login
                check_path: /login_check

我不明白为什么在同一个防火墙中有2个安全方法http_basic和form_login?安全系统将使用哪种方法? http_basic或form_login或两者兼而有之?这是多余的吗?
上面的一些问题似乎很愚蠢,但似乎symfony2安全组件文档很差.

解决方法:

在旧的Symfony文档中有一个小提示:

When the user is not authenticated and if there is more than one
authentication mechanisms, Symfony2 automatically defines a default
entry point (in the example above, the login form; but if the user
send an Authorization HTTP header with wrong credentials, Symfony2
will use the HTTP basic entry point).

@H_502_26@

但是在下一个版本中,当文档被重新组织时,它被减少了,我不知道为什么.

所以我在GitHub上的symfony-docs存储库中打开了一个new issue,并提出了恢复提示的建议.

引自@WouterJ的回答:

The code seems to no longer work as described in the
quoted paragraph. It seems to always use form login, except when there
is no Authentication header sent and the HTTP basic credentials are
correct.

@H_502_26@

所以你是对的 – 这根本不是微不足道的.如果您想知道结论,请关注此问题.

(编辑:北几岛)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读