diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-08 19:28:12 +0200 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2017-07-08 19:28:12 +0200 |
commit | 2e5b2fa808ca2793705069e56a3cc7e6631f9d9d (patch) | |
tree | bfcade5d680f6958e52335510ab302262bc8d570 | |
parent | b5d7eb148c4cd62ff187b08765f0c13c7d330fcf (diff) | |
download | wallabag-2e5b2fa808ca2793705069e56a3cc7e6631f9d9d.tar.gz wallabag-2e5b2fa808ca2793705069e56a3cc7e6631f9d9d.tar.zst wallabag-2e5b2fa808ca2793705069e56a3cc7e6631f9d9d.zip |
Revert client_credentials grant types
-rw-r--r-- | src/Wallabag/ApiBundle/Controller/DeveloperController.php | 2 | ||||
-rw-r--r-- | tests/Wallabag/ApiBundle/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 c8a1c635..c7178017 100644 --- a/src/Wallabag/ApiBundle/Controller/DeveloperController.php +++ b/src/Wallabag/ApiBundle/Controller/DeveloperController.php | |||
@@ -43,7 +43,7 @@ class DeveloperController extends Controller | |||
43 | $clientForm->handleRequest($request); | 43 | $clientForm->handleRequest($request); |
44 | 44 | ||
45 | if ($clientForm->isSubmitted() && $clientForm->isValid()) { | 45 | if ($clientForm->isSubmitted() && $clientForm->isValid()) { |
46 | $client->setAllowedGrantTypes(['client_credentials', 'token', 'authorization_code', 'password', 'refresh_token']); | 46 | $client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']); |
47 | $em->persist($client); | 47 | $em->persist($client); |
48 | $em->flush(); | 48 | $em->flush(); |
49 | 49 | ||
diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index 2caeccf5..e9e5ee3b 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php | |||
@@ -34,7 +34,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
34 | $this->assertContains('My app', $alert[0]); | 34 | $this->assertContains('My app', $alert[0]); |
35 | } | 35 | } |
36 | 36 | ||
37 | public function testCreateTokenFromPasswords() | 37 | public function testCreateToken() |
38 | { | 38 | { |
39 | $client = $this->getClient(); | 39 | $client = $this->getClient(); |
40 | $apiClient = $this->createApiClientForUser('admin'); | 40 | $apiClient = $this->createApiClientForUser('admin'); |
@@ -56,26 +56,6 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
56 | $this->assertArrayHasKey('refresh_token', $data); | 56 | $this->assertArrayHasKey('refresh_token', $data); |
57 | } | 57 | } |
58 | 58 | ||
59 | public function testCreateTokenFromClientCredentialsOnly() | ||
60 | { | ||
61 | $client = $this->getClient(); | ||
62 | $apiClient = $this->createApiClientForUser('admin', ['client_credentials']); | ||
63 | |||
64 | $client->request('POST', '/oauth/v2/token', [ | ||
65 | 'grant_type' => 'client_credentials', | ||
66 | 'client_id' => $apiClient->getPublicId(), | ||
67 | 'client_secret' => $apiClient->getSecret(), | ||
68 | ]); | ||
69 | |||
70 | $this->assertSame(200, $client->getResponse()->getStatusCode()); | ||
71 | |||
72 | $data = json_decode($client->getResponse()->getContent(), true); | ||
73 | $this->assertArrayHasKey('access_token', $data); | ||
74 | $this->assertArrayHasKey('expires_in', $data); | ||
75 | $this->assertArrayHasKey('token_type', $data); | ||
76 | // Client Credentials created-clients have no refresh tokens | ||
77 | } | ||
78 | |||
79 | public function testListingClient() | 59 | public function testListingClient() |
80 | { | 60 | { |
81 | $this->logInAs('admin'); | 61 | $this->logInAs('admin'); |