Skip to content

Commit

Permalink
Fix casing of OAuth2AuthenticationFailedException
Browse files Browse the repository at this point in the history
  • Loading branch information
HypeMC committed Mar 31, 2020
1 parent b40fd51 commit 9ec7875
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions EventListener/ConvertExceptionToResponseListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Trikoder\Bundle\OAuth2Bundle\Security\Exception\InsufficientScopesException;
use Trikoder\Bundle\OAuth2Bundle\Security\Exception\Oauth2AuthenticationFailedException;
use Trikoder\Bundle\OAuth2Bundle\Security\Exception\OAuth2AuthenticationFailedException;

/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
Expand All @@ -17,7 +17,7 @@ final class ConvertExceptionToResponseListener
public function onKernelException(ExceptionEvent $event): void
{
$exception = $event->getThrowable();
if ($exception instanceof InsufficientScopesException || $exception instanceof Oauth2AuthenticationFailedException) {
if ($exception instanceof InsufficientScopesException || $exception instanceof OAuth2AuthenticationFailedException) {
$event->setResponse(new Response($exception->getMessage(), $exception->getCode()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class Oauth2AuthenticationFailedException extends AuthenticationException
class OAuth2AuthenticationFailedException extends AuthenticationException
{
public static function create(string $message): self
{
Expand Down
4 changes: 2 additions & 2 deletions Security/Firewall/OAuth2Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Trikoder\Bundle\OAuth2Bundle\Security\Authentication\Token\OAuth2Token;
use Trikoder\Bundle\OAuth2Bundle\Security\Authentication\Token\OAuth2TokenFactory;
use Trikoder\Bundle\OAuth2Bundle\Security\Exception\InsufficientScopesException;
use Trikoder\Bundle\OAuth2Bundle\Security\Exception\Oauth2AuthenticationFailedException;
use Trikoder\Bundle\OAuth2Bundle\Security\Exception\OAuth2AuthenticationFailedException;

final class OAuth2Listener
{
Expand Down Expand Up @@ -68,7 +68,7 @@ public function __invoke(RequestEvent $event)
/** @var OAuth2Token $authenticatedToken */
$authenticatedToken = $this->authenticationManager->authenticate($this->oauth2TokenFactory->createOAuth2Token($request, null, $this->providerKey));
} catch (AuthenticationException $e) {
throw Oauth2AuthenticationFailedException::create($e->getMessage());
throw OAuth2AuthenticationFailedException::create($e->getMessage());
}

if (!$this->isAccessToRouteGranted($event->getRequest(), $authenticatedToken)) {
Expand Down

0 comments on commit 9ec7875

Please sign in to comment.