Skip to content

Commit d569953

Browse files
committed
fix usages of deprecated constants
1 parent 6cc66d9 commit d569953

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Security/Authentication/Provider/OAuthProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace FOS\OAuthServerBundle\Security\Authentication\Provider;
1313

1414
use FOS\OAuthServerBundle\Security\Authentication\Token\OAuthToken;
15+
use Symfony\Component\HttpFoundation\Response;
1516
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
1617
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1718
use Symfony\Component\Security\Core\Exception\AuthenticationException;
@@ -74,7 +75,7 @@ public function authenticate(TokenInterface $token)
7475
try {
7576
$this->userChecker->checkPreAuth($user);
7677
} catch (AccountStatusException $e) {
77-
throw new OAuth2AuthenticateException(OAuth2::HTTP_UNAUTHORIZED,
78+
throw new OAuth2AuthenticateException(Response::HTTP_UNAUTHORIZED,
7879
OAuth2::TOKEN_TYPE_BEARER,
7980
$this->serverService->getVariable(OAuth2::CONFIG_WWW_REALM),
8081
'access_denied',
@@ -103,7 +104,7 @@ public function authenticate(TokenInterface $token)
103104
try {
104105
$this->userChecker->checkPostAuth($user);
105106
} catch (AccountStatusException $e) {
106-
throw new OAuth2AuthenticateException(OAuth2::HTTP_UNAUTHORIZED,
107+
throw new OAuth2AuthenticateException(Response::HTTP_UNAUTHORIZED,
107108
OAuth2::TOKEN_TYPE_BEARER,
108109
$this->serverService->getVariable(OAuth2::CONFIG_WWW_REALM),
109110
'access_denied',

Security/EntryPoint/OAuthEntryPoint.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace FOS\OAuthServerBundle\Security\EntryPoint;
1313

14+
use Symfony\Component\HttpFoundation\Response;
1415
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
1516
use Symfony\Component\Security\Core\Exception\AuthenticationException;
1617
use Symfony\Component\HttpFoundation\Request;
@@ -29,7 +30,7 @@ public function __construct(OAuth2 $serverService)
2930
public function start(Request $request, AuthenticationException $authException = null)
3031
{
3132
$exception = new OAuth2AuthenticateException(
32-
OAuth2::HTTP_UNAUTHORIZED,
33+
Response::HTTP_UNAUTHORIZED,
3334
OAuth2::TOKEN_TYPE_BEARER,
3435
$this->serverService->getVariable(OAuth2::CONFIG_WWW_REALM),
3536
'access_denied',

Storage/OAuthStorage.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use FOS\OAuthServerBundle\Model\AuthCodeManagerInterface;
1717
use FOS\OAuthServerBundle\Model\ClientManagerInterface;
1818
use FOS\OAuthServerBundle\Model\ClientInterface;
19+
use Symfony\Component\HttpFoundation\Response;
1920
use Symfony\Component\Security\Core\User\UserProviderInterface;
2021
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
2122
use Symfony\Component\Security\Core\Exception\AuthenticationException;
@@ -255,7 +256,7 @@ public function unsetRefreshToken($tokenString)
255256
public function checkGrantExtension(IOAuth2Client $client, $uri, array $inputData, array $authHeaders)
256257
{
257258
if (!isset($this->grantExtensions[$uri])) {
258-
throw new OAuth2ServerException(OAuth2::HTTP_BAD_REQUEST, OAuth2::ERROR_UNSUPPORTED_GRANT_TYPE);
259+
throw new OAuth2ServerException(Response::HTTP_BAD_REQUEST, OAuth2::ERROR_UNSUPPORTED_GRANT_TYPE);
259260
}
260261

261262
$grantExtension = $this->grantExtensions[$uri];

0 commit comments

Comments
 (0)