需要Symfony2 http_digest防火墙配置示例

发布于 2024-12-01 07:42:47 字数 1220 浏览 3 评论 0原文

我想将 http_basic 更改为 http_digest 作为防火墙, 但并没有真正记录如何配置 http_digest。

参考似乎不完整或不是最新的:

http://symfony.com /doc/2.0/reference/configuration/security.html

http_basic:  
  provider: name  
http_digest:  
  provider: name  

然而,书中的示例使用领域而不使用提供程序。

http://symfony.com/doc/current/book/security.html

http_basic:  
  realm: "Secured Demo Area"  

至少该示例有效,但是当我将 http_basic 更改为 http_digest 时,缺少(未记录的)密钥。

ErrorException: 注意: 未定义的索引: key in ..\vendor\symfony\src\Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\HttpDigestFactory.php line 80

http_digest:  
  realm: "Secured Demo Area"  
  key: "whatever"

添加密钥似乎有效,但登录后会导致另一个错误:

致命错误:调用未定义的方法 Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint::getKey() 中..\vendor\symfony\src\Symfony\Component\Security\Http\Firewall\DigestAuthenticationListener.php 第 79 行

这就是我不知道我的配置中缺少什么的地方。 我只需要一个使用 Symfony 2 的 http_digest 的工作示例。

i want to change http_basic to http_digest for a firewall,
but it is not really documented how to configure http_digest.

There reference seems to be incomplete or not up to date:

http://symfony.com/doc/2.0/reference/configuration/security.html

http_basic:  
  provider: name  
http_digest:  
  provider: name  

The example in the book however use a realm and no provider.

http://symfony.com/doc/current/book/security.html

http_basic:  
  realm: "Secured Demo Area"  

At least that example works but when i change http_basic to http_digest a (not documented) key is missing.

ErrorException: Notice: Undefined index: key in ..\vendor\symfony\src\Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\HttpDigestFactory.php line 80

http_digest:  
  realm: "Secured Demo Area"  
  key: "whatever"

Adding a key seems to work but after login leads to another error:

Fatal error: Call to undefined method Symfony\Component\Security\Http\EntryPoint\DigestAuthenticationEntryPoint::getKey() in ..\vendor\symfony\src\Symfony\Component\Security\Http\Firewall\DigestAuthenticationListener.php on line 79

Thats the point where i have no clue what is missing in my configuration.
I just need a working example for http_digest with Symfony 2.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蘑菇王子 2024-12-08 07:42:47

这似乎在当前版本的 Symfony2 (2.0.10) 中得到了解决。

  secured_area:
        pattern:    ^/admin           
        http_digest:
            realm: "Admin"
            key: "thisismykey"

对我来说效果很好。

This seems to be resolved in current version of Symfony2 (2.0.10) .

  secured_area:
        pattern:    ^/admin           
        http_digest:
            realm: "Admin"
            key: "thisismykey"

Works for me fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文