]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Revert client_credentials grant types 3267/head
authorJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 8 Jul 2017 17:28:12 +0000 (19:28 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Sat, 8 Jul 2017 17:28:12 +0000 (19:28 +0200)
src/Wallabag/ApiBundle/Controller/DeveloperController.php
tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php

index c8a1c6355b9f11a1b7a15dc4acd13eb282811b73..c7178017ef349f7a95e0eb35d28a3f93dd2e75a2 100644 (file)
@@ -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();
 
index 2caeccf5f0fc8bc9275fa79e972c0a4ca7f3e6d2..e9e5ee3b1fc575ba9ceca4476e239c8b983c2a10 100644 (file)
@@ -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');