Files
Phraseanet/lib/Alchemy/Phrasea/ControllerProvider/Api/OAuth2.php
Benoît Burnichon e25cd4097c Change DispatcherAware to accept concrete instances
Dispatcher is already instanciated when invoking controller. So useless to lazy load it.
2015-05-14 21:06:39 +02:00

49 lines
1.3 KiB
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2015 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\ControllerProvider\Api;
use Alchemy\Phrasea\Application as PhraseaApplication;
use Alchemy\Phrasea\Controller\Api\OAuth2Controller;
use Silex\Application;
use Silex\ControllerCollection;
use Silex\ControllerProviderInterface;
use Silex\ServiceProviderInterface;
class OAuth2 implements ControllerProviderInterface, ServiceProviderInterface
{
public function register(Application $app)
{
$app['controller.oauth2'] = $app->share(function (PhraseaApplication $app) {
return (new OAuth2Controller($app))
->setDispatcher($app['dispatcher']);
});
}
public function boot(Application $app)
{
}
public function connect(Application $app)
{
/** @var ControllerCollection $controllers */
$controllers = $app['controllers_factory'];
$controllers->match('/authorize', 'controller.oauth2:authorizeAction')
->method('GET|POST')
->bind('oauth2_authorize');
$controllers->post('/token', 'controller.oauth2:tokenAction');
return $controllers;
}
}