I'm trying to build a Facebook
Auth adapter. Inside it, i need to get my hand on the Request
object to retreive request query parameters.
I've added this in my plugin bootstrap:
<?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;
});
Then i have access to the $request in my Facebook class (under check()
for instance) using self::$request
. But it seems wrong somehow.
Same situation when i try to redirect my user, i can't see how i can access a Controller & lithium\action\Controller::redirect()
is not static.
I'm new to this whole filter thing, can someone tell me that this is the correct implementation?
Quite simple finally, i just passed $this->request
as a parameter of the Auth::check, does the trick.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.