需要Symfony2 http_digest防火墙配置示例

时间:2011-08-26 09:15:19

标签: symfony http-digest

我想将http_basic更改为http_basgest以获取防火墙, 但是没有真正记录如何配置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_diic时,缺少一个(未记录的)密钥。

ErrorException:注意:未定义索引:键入.. \ vendor \ symfony \ src \ Symfony \ Bundle \ SecurityBundle \ DependencyInjection \ Security \ Factory \ HttpDigestFactory.php第80行

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

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

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

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

1 个答案:

答案 0 :(得分:3)

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

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

对我很好。