Skip to content

Commit a41fef6

Browse files
authored
Merge pull request #105 from SebScoFr/master
Fixing HTTP status code definition
2 parents 486a6a5 + 5921db2 commit a41fef6

File tree

7 files changed

+52
-44
lines changed

7 files changed

+52
-44
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
language: php
22

33
php:
4-
- 5.3
5-
- 5.4
64
- 5.5
75
- 5.6
6+
- 7.0
7+
- 7.1
8+
- 7.2
89
- hhvm
910

1011
install:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=5.3.2",
20-
"symfony/http-foundation": "~2.0|~3.0|~4.0"
19+
"php": "^5.5.9|>=7.0.8",
20+
"symfony/http-foundation": "~3.0|~4.0"
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "~4.0"

lib/OAuth2.php

Lines changed: 38 additions & 36 deletions
Large diffs are not rendered by default.

lib/OAuth2RedirectException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace OAuth2;
44

5+
use Symfony\Component\HttpFoundation\Response;
6+
57
/**
68
* Redirect the end-user's user agent with error message.
79
*
@@ -37,7 +39,7 @@ class OAuth2RedirectException extends OAuth2ServerException
3739
*/
3840
public function __construct($redirectUri, $error, $errorDescription = null, $state = null, $method = OAuth2::TRANSPORT_QUERY)
3941
{
40-
parent::__construct(OAuth2::HTTP_FOUND, $error, $errorDescription);
42+
parent::__construct(Response::HTTP_FOUND, $error, $errorDescription);
4143

4244
$this->method = $method;
4345
$this->redirectUri = $redirectUri;

tests/Fixtures/OAuth2GrantExtensionJwtBearer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use OAuth2\OAuth2ServerException;
88
use OAuth2\Model\IOAuth2Client;
99
use OAuth2\Tests\Fixtures\OAuth2StorageStub;
10+
use Symfony\Component\HttpFoundation\Response;
1011

1112
class OAuth2GrantExtensionJwtBearer extends OAuth2StorageStub implements IOAuth2GrantExtension
1213
{
@@ -15,7 +16,7 @@ class OAuth2GrantExtensionJwtBearer extends OAuth2StorageStub implements IOAuth2
1516
public function checkGrantExtension(IOAuth2Client $client, $uri, array $inputData, array $authHeaders)
1617
{
1718
if ('urn:ietf:params:oauth:grant-type:jwt-bearer' !== $uri) {
18-
throw new OAuth2ServerException(OAuth2::HTTP_BAD_REQUEST, OAuth2::ERROR_UNSUPPORTED_GRANT_TYPE);
19+
throw new OAuth2ServerException(Response::HTTP_BAD_REQUEST, OAuth2::ERROR_UNSUPPORTED_GRANT_TYPE);
1920
}
2021

2122
if (!isset($inputData['jwt'])) {

tests/Fixtures/OAuth2GrantExtensionLifetimeStub.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use OAuth2\IOAuth2GrantExtension;
77
use OAuth2\OAuth2ServerException;
88
use OAuth2\Model\IOAuth2Client;
9+
use Symfony\Component\HttpFoundation\Response;
910

1011
class OAuth2GrantExtensionLifetimeStub extends OAuth2StorageStub implements IOAuth2GrantExtension
1112
{
@@ -14,7 +15,7 @@ class OAuth2GrantExtensionLifetimeStub extends OAuth2StorageStub implements IOAu
1415
public function checkGrantExtension(IOAuth2Client $client, $uri, array $inputData, array $authHeaders)
1516
{
1617
if ('http://company.com/fb_access_token_time_limited' !== $uri) {
17-
throw new OAuth2ServerException(OAuth2::HTTP_BAD_REQUEST, OAuth2::ERROR_UNSUPPORTED_GRANT_TYPE);
18+
throw new OAuth2ServerException(Response::HTTP_BAD_REQUEST, OAuth2::ERROR_UNSUPPORTED_GRANT_TYPE);
1819
}
1920

2021
if (!isset($inputData['fb_access_token'])) {

tests/Fixtures/OAuth2GrantExtensionStub.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use OAuth2\OAuth2ServerException;
88
use OAuth2\Model\IOAuth2Client;
99
use OAuth2\Tests\Fixtures\OAuth2StorageStub;
10+
use Symfony\Component\HttpFoundation\Response;
1011

1112
class OAuth2GrantExtensionStub extends OAuth2StorageStub implements IOAuth2GrantExtension
1213
{
@@ -15,7 +16,7 @@ class OAuth2GrantExtensionStub extends OAuth2StorageStub implements IOAuth2Grant
1516
public function checkGrantExtension(IOAuth2Client $client, $uri, array $inputData, array $authHeaders)
1617
{
1718
if ('http://company.com/fb_access_token' !== $uri) {
18-
throw new OAuth2ServerException(OAuth2::HTTP_BAD_REQUEST, OAuth2::ERROR_UNSUPPORTED_GRANT_TYPE);
19+
throw new OAuth2ServerException(Response::HTTP_BAD_REQUEST, OAuth2::ERROR_UNSUPPORTED_GRANT_TYPE);
1920
}
2021

2122
if (!isset($inputData['fb_access_token'])) {

0 commit comments

Comments
 (0)