0

我正在尝试构建一个FacebookAuth 适配器。在其中,我需要掌握Request对象以检索请求查询参数。

我在我的插件引导程序中添加了这个:

<?php
use lithium\action\Dispatcher;
use facebook\extensions\adapter\security\auth\Facebook;

Dispatcher::applyFilter('_callable', function($self, $params, $chain) {

    //debug(compact('self', 'params', 'chain'));
    Facebook::$request = $params['request'];

    // Always make sure to keep the filter chain going.
    $response = $chain->next($self, $params, $chain);

    return $response;
});

然后我可以check()使用self::$request. 但这似乎是错误的。

同样的情况,当我尝试重定向我的用户时,我看不到如何访问控制器lithium\action\Controller::redirect()并且不是静态的。

我是整个过滤器的新手,有人可以告诉我这是正确的实现吗?

4

1 回答 1

0

最后很简单,我只是$this->request作为 Auth::check 的参数传递,就可以了。

于 2011-07-20T00:52:38.967 回答