Symfony 2:自定义用户提供者
由于本文 http://symfony.com/doc/2.0/cookbook/security/ custom_provider.html 尚未编写,有人知道如何做到这一点吗? (在我的例子中,它将使用 LDAP 身份验证)。
感谢您的回答
Since this article http://symfony.com/doc/2.0/cookbook/security/custom_provider.html has not been written yet, has anyone an idea of how to do that ? (In my case it would be using LDAP authentication).
Thanks for your answers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为了帮助您入门,您可以查看我的博客文章,其中概述了如何创建一个非常基本的用户提供程序系统:
http://clintberry.com/2011/custom-user-providers-symfony2/
编辑: 这篇文章仅涵盖自定义用户提供程序。要使用 LDAP 身份验证,您还需要创建自己的身份验证提供程序或使用第三方库。 http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html
To help you get started you can check out my blog post which outlines how to create a very basic user provider system:
http://clintberry.com/2011/custom-user-providers-symfony2/
EDIT: This post only covers the custom User Provider. To use LDAP authentication you will need to create your own Authentication Provider as well or use a third party library. http://symfony.com/doc/current/cookbook/security/custom_authentication_provider.html
我建议您的第一件事是在伟大的网站 KnpBundles 上搜索 LDAP 捆绑包(结果 此处)。我看到了两个结果。如果您愿意使用外部捆绑包,则可以仅使用结果中给出的两个捆绑包。
如果您更愿意为此任务创建自己的捆绑包,我建议您从这两个捆绑包中获得启发。另一个有用的建议是检查 FOSFacebookBundle。它与 LDAP 没有任何关系,但是它们实现了自己的提供程序,因此所有的粘合剂都可以实现您自己的提供程序。
只是一个小通知,如果您正在针对 Symfony2 主分支进行开发,那么很高兴知道安全工厂注册已经发生了一些变化。因此,在查看其他捆绑包时要小心,以确定它们的目标版本。
希望这有帮助。
问候,
马特
This first thing I would suggest you is to do a search for a LDAP bundle on the great website KnpBundles (results here). I saw two results. If you are willing to use an external bundle, you could just use of the two given in the results.
If you prefer to create your own bundle for this task, what I would suggest is to inspire you from these two bundles. Another useful suggestion is to check the FOSFacebookBundle. It is in no mean related to LDAP but, they implements their own provider, so all the glue is there to implement your own.
Just a small notice, if you are developing against Symfony2 master branch, it is good to know that security factory registration has changed a bit. So, be carefull when looking at other bundles to be sure what version they are targeting.
Hope this helps.
Regards,
Matt