chain_provider 和身份验证提供者
当将 chain_provider 与 Doctrine 和自定义用户提供程序一起使用时,是否也应该使用提供程序的身份验证提供程序?
我在 chain_provider 中使用自定义用户提供程序时遇到问题,如下所述:
providers:
chain_provider:
providers: [doctrine, egzakt_backend_ldap]
doctrine:
entity: { class: Egzakt\Backend\UserBundle\Entity\User }
egzakt_backend_ldap:
id: egzakt_backend_ldap.security.user.provider
firewalls:
secured_area:
pattern: /admin/
form_login:
provider: chain_provider
check_path: /admin/login_check
login_path: /admin/login
问题是egzakt_backend_ldap 用户提供程序被正确调用,但不是由良好的身份验证提供程序调用。它不是由我在工厂中声明为服务的“LdapAuthenticationProvider”调用,而是由“Symfony\Component\Security\Core\Authentication\ProviderDaoAuthenticationProvide r”调用,并且始终返回“所提供的密码无效”,因为它是没有使用好的身份验证提供程序来验证凭据。
但是,如果直接使用入口点,它就可以工作。问题是我想同时使用 Doctrine 和 Ldap 登录,如果 Doctrine 失败,它会回退到 Ldap :
firewalls:
secured_area:
pattern: /admin/
egzakt_backend_ldap:
check_path: /admin/login_check
login_path: /admin/login
通过这种方式,它使用良好的身份验证提供程序和用户提供程序。
有人知道我缺少什么吗?
When using the chain_provider with Doctrine and a custom User Provider, is it suppose to use the provider's Authentication Provider also?
I got an issue with using a custom User Provider in the chain_provider, as described below :
providers:
chain_provider:
providers: [doctrine, egzakt_backend_ldap]
doctrine:
entity: { class: Egzakt\Backend\UserBundle\Entity\User }
egzakt_backend_ldap:
id: egzakt_backend_ldap.security.user.provider
firewalls:
secured_area:
pattern: /admin/
form_login:
provider: chain_provider
check_path: /admin/login_check
login_path: /admin/login
The problem is that egzakt_backend_ldap User Provider is called correctly, but not by the good Authentication Provider. Instead of be called by "LdapAuthenticationProvider", which I declared as a service in my factory, it is called by "Symfony\Component\Security\Core\Authentication\ProviderDaoAuthenticationProvider" and always return a "The presented password is invalid" because it's not using the good Authentication Provider to validate the credentials.
BUT, if using the entry point directly, it's working. The problem is that I want to use BOTH Doctrine and Ldap to login, if Doctrine fails, it falls back to Ldap :
firewalls:
secured_area:
pattern: /admin/
egzakt_backend_ldap:
check_path: /admin/login_check
login_path: /admin/login
With this way, it uses the good Authentication Provider and User Provider.
Anyone has an idea about what I'm missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将配置的
providers
部分更改为:您错过了
chain
键,chain_provider
只是一个名称。You should change your
providers
section of config to this:You missed the
chain
key, thechain_provider
is just a name.