我的库中有一个身份验证资源,它根据用户是否存在、密码错误或正确密码正确返回各种状态之一。不过,我正在尝试将身份输入到我的控制器中。因此,在身份验证资源中,我将状态与用户一起返回。那么我的控制器中需要发生什么?我已经处理了登录并重定向到不同的控制器。我正在尝试执行类似 $this->auth->authenticate() 和 $this->auth->getIdentity() 的操作,以确保它们已经经过身份验证并且具有身份。我需要做什么才能将身份传递给我在预调度中调用 auth 的所有控制器?
另外,Zend Auth 中是否有某些东西可以跟踪已进行的登录尝试次数?
I have an auth resource in my library that is correctly returning one of the various statuses based on whether or not the user exists, wrong password, or correct password. I'm trying to get the identity into my controllers though. So in the auth resource I return the status along with user. What needs to happen in my controllers then? I've already handled logging in and redirecting to a different controller. I'm trying to do something like $this->auth->authenticate() and $this->auth->getIdentity() to make sure that they are already authenticated and that they have an identity. What do I need to do so that the identity gets passed around to all of the controllers that I call auth in predispatch?
Also, is there something in Zend Auth that keeps track of how many attempts at logging in have been made?
发布评论
评论(2)
如果使用 Zend_Auth 存储的缩进,您可以在任何您想要的地方使用它:
另请参阅 Matthews 教程
If use stored the indentiy with Zend_Auth you can get it everywhere you want with:
see also Matthews Tutorial on Zend_Auth
访问 Zend_Auth 单例将会起作用,但如果您想获取资源返回的确切值,请在控制器中添加如下内容:
Accessing the Zend_Auth singleton will work, but if you want to get the exact values returned by your resource, put something like this in your controller: