【问题标题】:Need to use Cookie instead of Session for auth in Zend 1Zend 1 需要使用 Cookie 而不是 Session 进行身份验证
【发布时间】:2015-12-01 08:10:12
【问题描述】:

我有一个带有 zend 1 的应用,有一个 auth 示例

$adapter = $this->getAuthAdapter($form->getValues());
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);

Zend_Auth 使用 Session 存储,我想更改它并使用 Cookie 而不是 Session

有什么办法可以通过配置来做到这一点,或者我必须更改 Zend Storage?

【问题讨论】:

    标签: php authentication zend-framework session-cookies


    【解决方案1】:

    您的问题的基本答案在文档Zend Auth: Implementing Customized Storage 中。正如您发现的那样,默认存储是基于会话的,没有其他选项,但正如本章所述,您可以编写自己的实现。

    我曾经为一个应用程序编写了一个 cookie 实现,它非常简单。如果我能再次找到它,我也许可以在 github 上提供它。

    【讨论】:

    • 我为基于令牌的身份验证(用于 Web 服务)写了同样的东西。
    猜你喜欢
    • 2016-10-31
    • 2010-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-30
    • 1970-01-01
    • 1970-01-01
    • 2021-10-16
    相关资源
    最近更新 更多