diff --git a/lib/Alchemy/Phrasea/Application/OAuth2.php b/lib/Alchemy/Phrasea/Application/OAuth2.php index 0a35b3ddca..c05cd0a369 100644 --- a/lib/Alchemy/Phrasea/Application/OAuth2.php +++ b/lib/Alchemy/Phrasea/Application/OAuth2.php @@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Application; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; +use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpFoundation\Request; use Silex\Provider\ValidatorServiceProvider; diff --git a/tests/Alchemy/Phrasea/Application/OAuth2Test.php b/tests/Alchemy/Phrasea/Application/OAuth2Test.php index 3c3a60a6e8..deca5ffe11 100644 --- a/tests/Alchemy/Phrasea/Application/OAuth2Test.php +++ b/tests/Alchemy/Phrasea/Application/OAuth2Test.php @@ -148,4 +148,15 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra $this->assertRegExp("/" . $this->queryParameters["scope"] . "/", $this->client->getResponse()->getContent()); $this->assertRegExp("/" . $this->queryParameters["state"] . "/", $this->client->getResponse()->getContent()); } + + public function testGetTokenNotHTTPS() + { + $acc = self::getAccount(); + + $this->setQueryParameters('grant_type', 'authorization_code'); + $this->setQueryParameters('code', '12345678918'); + $this->client->request('POST', '/token', $this->queryParameters); + + $this->assertEquals(400, $this->client->getResponse()->getStatusCode()); + } }