使用 sfGuard 验证用户凭据
我使用 symfony 1.4 和 sfGuard 以及 Propel,考虑到这是我第一次使用 symfony,我对架构的某些部分仍然是个菜鸟。
我被要求创建一些网络服务,其中之一是获取用户(电子邮件)和密码并打印出 json 字符串反馈作为结果。
我不知道如何使用 sfGuard 执行此类任务,因此如果有人有一个示例,我们将不胜感激。
我认为该算法应该是 sha1,因为在 sf_guard_user 表中我发现了类似的行
id username algorithm salt password created_at last_login is_active is_super_admin
4 [email protected] sha1 623de866b49c696b452e0d12b55895c8 dcbe87a60a769b9e3b5f0988141b824fa5206235 2011-12-06 02:32:43 2011-12-27 15:49:41 1 0
I use symfony 1.4 with sfGuard with Propel, and considering that this is my first symfony experience, I'm still a total noob with some part of the architecture.
I was asked to create some webservices, one of this shall be taking user (email) and password and print out a json string feedback as result.
I don't have a clue about how to perform such a task with sfGuard, so if anybody has an example it'd be appreciated.
I think that the algorithm should be sha1, because in the sf_guard_user table I found rows like
id username algorithm salt password created_at last_login is_active is_super_admin
4 [email protected] sha1 623de866b49c696b452e0d12b55895c8 dcbe87a60a769b9e3b5f0988141b824fa5206235 2011-12-06 02:32:43 2011-12-27 15:49:41 1 0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需看一下 sfGuardValidatorUser 类即可。
基本上是这样的:
checkPassword
公共方法检查密码>sfGuardUser 类(默认类似于sha1(db_salt.subscribed_password) == db_password
)Just have a look at
sfGuardValidatorUser
class.Basically it's something like this:
checkPassword
public method from thesfGuardUser
class (default is something likesha1(db_salt.submitted_password) == db_password
)好吧,我发现了一个肮脏的伎俩,但它有效。
我可以伪造一个登录表单提交,然后按照通常的登录模式进行操作,它会变成这样:
我希望这可以帮助陷入同样困境的人。
Ok, I've found a dirty trick, but it works.
I can fake a login form submission and sitck to the usual login patter, which it becomes something like:
I hope that this could help somebody stuck in the same limbo.