From 2e5b2fa808ca2793705069e56a3cc7e6631f9d9d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 8 Jul 2017 19:28:12 +0200 Subject: [PATCH] Revert client_credentials grant types --- .../Controller/DeveloperController.php | 2 +- .../Controller/DeveloperControllerTest.php | 22 +------------------ 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/Wallabag/ApiBundle/Controller/DeveloperController.php b/src/Wallabag/ApiBundle/Controller/DeveloperController.php index c8a1c6355..c7178017e 100644 --- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php +++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php @@ -43,7 +43,7 @@ class DeveloperController extends Controller $clientForm->handleRequest($request); if ($clientForm->isSubmitted() && $clientForm->isValid()) { - $client->setAllowedGrantTypes(['client_credentials', 'token', 'authorization_code', 'password', 'refresh_token']); + $client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']); $em->persist($client); $em->flush(); diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index 2caeccf5f..e9e5ee3b1 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php @@ -34,7 +34,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase $this->assertContains('My app', $alert[0]); } - public function testCreateTokenFromPasswords() + public function testCreateToken() { $client = $this->getClient(); $apiClient = $this->createApiClientForUser('admin'); @@ -56,26 +56,6 @@ class DeveloperControllerTest extends WallabagCoreTestCase $this->assertArrayHasKey('refresh_token', $data); } - public function testCreateTokenFromClientCredentialsOnly() - { - $client = $this->getClient(); - $apiClient = $this->createApiClientForUser('admin', ['client_credentials']); - - $client->request('POST', '/oauth/v2/token', [ - 'grant_type' => 'client_credentials', - 'client_id' => $apiClient->getPublicId(), - 'client_secret' => $apiClient->getSecret(), - ]); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $data = json_decode($client->getResponse()->getContent(), true); - $this->assertArrayHasKey('access_token', $data); - $this->assertArrayHasKey('expires_in', $data); - $this->assertArrayHasKey('token_type', $data); - // Client Credentials created-clients have no refresh tokens - } - public function testListingClient() { $this->logInAs('admin');