aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-02-15 22:12:50 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-02-29 21:28:25 +0100
commit24152cdb5e48edc5128082b285736b06ebda3c82 (patch)
treec1b1ab19b3e6e29b6e18aac56f85c8bb7461ddaa /src/Wallabag/CoreBundle/Controller
parent8808b79230130d2b985748954833a80e57fffd6c (diff)
downloadwallabag-24152cdb5e48edc5128082b285736b06ebda3c82.tar.gz
wallabag-24152cdb5e48edc5128082b285736b06ebda3c82.tar.zst
wallabag-24152cdb5e48edc5128082b285736b06ebda3c82.zip
Fix #1597: first draft to create new client for the API
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r--src/Wallabag/CoreBundle/Controller/DeveloperController.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php
new file mode 100644
index 00000000..3cb86881
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php
@@ -0,0 +1,38 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Component\HttpFoundation\Request;
7use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8
9class DeveloperController extends Controller
10{
11 /**
12 * @param Request $request
13 *
14 * @Route("/developer", name="developer")
15 */
16 public function indexAction(Request $request)
17 {
18 return $this->render('WallabagCoreBundle:Developer:index.html.twig');
19 }
20
21 /**
22 * @param Request $request
23 *
24 * @Route("/developer/client/create", name="create_client")
25 */
26 public function createClientAction(Request $request)
27 {
28 $clientManager = $this->container->get('fos_oauth_server.client_manager.default');
29 $client = $clientManager->createClient();
30 $client->setRedirectUris(array('http://www.example.com'));
31 $client->setAllowedGrantTypes(array('token', 'authorization_code'));
32 $clientManager->updateClient($client);
33
34 return $this->render('WallabagCoreBundle:Developer:client.html.twig', array(
35 'client_id' => $client->getPublicId(),
36 ));
37 }
38}