Revert client_credentials grant types

This commit is contained in:
Jeremy Benoist 2017-07-08 19:28:12 +02:00
parent b5d7eb148c
commit 2e5b2fa808
No known key found for this signature in database
GPG key ID: BCA73962457ACC3C
2 changed files with 2 additions and 22 deletions

View 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();

View 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');