Dan*_* B. 7 php authentication rest restful-authentication symfony
我的Symfony2自定义身份验证提供程序现在似乎正在运行.
用户提供商
我几乎使用了FOSUserBundle,但我甚至没有为我的用户提供电子邮件地址,而且我不需要增加的功能或复杂功能.
所以我只是使用实体提供程序.
我将我的编码器设置为纯文本,因为API客户端库为我处理这个问题,但是,另一个障碍:似乎用户现在正在针对这些用户记录进行身份验证.
在我实现实体用户提供程序之前,我的登录表单给了我有效的响应:正确的凭据没有产生错误,错误的凭据导致我的自定义"不正确的用户/通过错误".
现在,即使我提供了我知道正确的凭据,我得到的只是错误消息"Bad credentials" ,好像我正在实现UserAuthenticationProvider,但据我所知,我不是.我的自定义提供程序直接实现AuthenticationProviderInterface.
所以目前我认为我错误地实现了实体用户提供程序,这样它就会以某种方式覆盖我的自定义身份验证提供程序.同时配置实体用户提供程序和自定义身份验证提供程序的正确方法是什么?
档
security.yml的相关部分
encoders:
WordRot\PlayBundle\Entity\User: plaintext
providers:
wordnik_users:
entity: { class: WordRotPlayBundle:User, property: username }
firewalls:
wordnik_secured:
pattern: ^/play
logout: ~
anonymous: ~
# The next line specifies the custom authentication provider:
wordnik: true
form_login:
provider: wordnik_users
login_path: /login
check_path: /play_check
# on success
always_use_default_target_path: true
default_target_path: /play
Run Code Online (Sandbox Code Playgroud)
编辑
这可能证明是有用的.这是主分支的差异......
编辑2
我发现有更多的断点:
false.WordnikListener构造但是从不调用其他方法(attemptAuthentication,requiresAuthentication).然而WordnikFactory#createListener,从来没有被称为!听众的构建令人惊讶.login_checkGET上,WordnikListener#requiresAuthenticationIS被称为.所以我们对此进行了长时间的讨论。基本问题是 form_login 服务干扰了 wodnik 服务。删除了 form_login,一切开始变得更好。
https://chat.stackoverflow.com/rooms/25251/discussion- Between-montgomery-jean-and-cerad
| 归档时间: |
|
| 查看次数: |
951 次 |
| 最近记录: |