2016-02-15 21:12:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wallabag\CoreBundle\Controller;
|
|
|
|
|
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
|
|
|
|
|
|
class DeveloperController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @param Request $request
|
|
|
|
*
|
|
|
|
* @Route("/developer", name="developer")
|
2016-02-16 06:55:18 +00:00
|
|
|
*
|
|
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
2016-02-15 21:12:50 +00:00
|
|
|
*/
|
|
|
|
public function indexAction(Request $request)
|
|
|
|
{
|
|
|
|
return $this->render('WallabagCoreBundle:Developer:index.html.twig');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Request $request
|
|
|
|
*
|
|
|
|
* @Route("/developer/client/create", name="create_client")
|
2016-02-16 06:55:18 +00:00
|
|
|
*
|
|
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
2016-02-15 21:12:50 +00:00
|
|
|
*/
|
|
|
|
public function createClientAction(Request $request)
|
|
|
|
{
|
|
|
|
$clientManager = $this->container->get('fos_oauth_server.client_manager.default');
|
|
|
|
$client = $clientManager->createClient();
|
|
|
|
$client->setRedirectUris(array('http://www.example.com'));
|
|
|
|
$client->setAllowedGrantTypes(array('token', 'authorization_code'));
|
|
|
|
$clientManager->updateClient($client);
|
|
|
|
|
|
|
|
return $this->render('WallabagCoreBundle:Developer:client.html.twig', array(
|
|
|
|
'client_id' => $client->getPublicId(),
|
2016-02-16 06:55:18 +00:00
|
|
|
'client_secret' => $client->getSecret(),
|
2016-02-15 21:12:50 +00:00
|
|
|
));
|
|
|
|
}
|
2016-02-16 06:55:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Request $request
|
|
|
|
*
|
|
|
|
* @Route("/developer/howto/first-app", name="howto-firstapp")
|
|
|
|
*
|
|
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
|
|
*/
|
|
|
|
public function howtoFirstAppAction(Request $request)
|
|
|
|
{
|
|
|
|
return $this->render('WallabagCoreBundle:Developer:howto_app.html.twig');
|
|
|
|
}
|
2016-02-15 21:12:50 +00:00
|
|
|
}
|