Skip to content

Commit

Permalink
hf: symfony 7 (#431)
Browse files Browse the repository at this point in the history
* hf: symfony 7

* Update SaveAuthFailureMessage.php

changed style

* applied changes by cs fixer

applied changes by cs fixer

---------

Co-authored-by: vitsadecky <vit.sadecky@footshop.cz>
  • Loading branch information
vitsadecky and vitsadecky authored Feb 14, 2024
1 parent 2f6c934 commit 1d59f49
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Client/OAuth2ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function redirect(array $scopes, array $options);
*
* @param array $options Additional options that should be passed to the getAccessToken() of the underlying provider
*
* @return \League\OAuth2\Client\Token\AccessToken
* @return AccessToken
*
* @throws \KnpU\OAuth2ClientBundle\Exception\InvalidStateException
* @throws \KnpU\OAuth2ClientBundle\Exception\MissingAuthorizationCodeException
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/ProviderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(UrlGeneratorInterface $generator)
*
* @param string $class
*/
public function createProvider($class, array $options, string $redirectUri = null, array $redirectParams = [], array $collaborators = [])
public function createProvider($class, array $options, ?string $redirectUri = null, array $redirectParams = [], array $collaborators = [])
{
if (null !== $redirectUri) {
$redirectUri = $this->generator
Expand Down
2 changes: 1 addition & 1 deletion src/Security/Exception/FinishRegistrationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FinishRegistrationException extends AuthenticationException
* @param string $message
* @param int $code
*/
public function __construct($userInfo, $message = '', $code = 0, \Exception $previous = null)
public function __construct($userInfo, $message = '', $code = 0, ?\Exception $previous = null)
{
$this->userInformation = $userInfo;

Expand Down
7 changes: 6 additions & 1 deletion src/Security/Helper/SaveAuthFailureMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Http\SecurityRequestAttributes;

trait SaveAuthFailureMessage
{
Expand All @@ -23,6 +24,10 @@ protected function saveAuthenticationErrorToSession(Request $request, Authentica
throw new \LogicException('In order to save an authentication error, you must have a session available.');
}

$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);
$authenticationError = class_exists(Security::class)
? Security::AUTHENTICATION_ERROR
: SecurityRequestAttributes::AUTHENTICATION_ERROR;

$request->getSession()->set($authenticationError, $exception);
}
}

0 comments on commit 1d59f49

Please sign in to comment.