-
-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #1056 Drop PHP <7.1 and Symfony <5.3 support (wouter-toppy)
This PR was squashed before being merged into the 3.x branch. Discussion ---------- Drop PHP <7.1 and Symfony <5.3 support Fix for #996 For tag 3.x Commits ------- ac9c8a6 Drop PHP <7.1 and Symfony <5.3 support
- Loading branch information
Showing
7 changed files
with
93 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,51 +3,74 @@ | |
namespace Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Security\Factory; | ||
|
||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface; | ||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; | ||
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; | ||
|
||
if (interface_exists(SecurityFactoryInterface::class) && !interface_exists(AuthenticatorFactoryInterface::class)) { | ||
eval(' | ||
namespace Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Security\Factory; | ||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface; | ||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; | ||
/** | ||
* Wires the "jwt" authenticator from user configuration. | ||
* | ||
* @author Robin Chalas <[email protected]> | ||
*/ | ||
class JWTAuthenticatorFactory implements SecurityFactoryInterface | ||
{ | ||
use JWTAuthenticatorFactoryTrait; | ||
} | ||
'); | ||
} elseif (!method_exists(SecurityExtension::class, 'addAuthenticatorFactory')) { | ||
eval(' | ||
namespace Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Security\Factory; | ||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface; | ||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; | ||
/** | ||
* Wires the "jwt" authenticator from user configuration. | ||
* | ||
* @author Robin Chalas <[email protected]> | ||
*/ | ||
class JWTAuthenticatorFactory implements AuthenticatorFactoryInterface, SecurityFactoryInterface | ||
{ | ||
use JWTAuthenticatorFactoryTrait; | ||
} | ||
'); | ||
} else { | ||
use Symfony\Component\Config\Definition\Builder\NodeDefinition; | ||
use Symfony\Component\DependencyInjection\ChildDefinition; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
/** | ||
* Wires the "jwt" authenticator from user configuration. | ||
* | ||
* @author Robin Chalas <[email protected]> | ||
*/ | ||
class JWTAuthenticatorFactory implements AuthenticatorFactoryInterface | ||
{ | ||
/** | ||
* @throws \LogicException | ||
*/ | ||
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint) | ||
{ | ||
throw new \LogicException('This method is implemented for BC purpose and should never be called.'); | ||
} | ||
|
||
/** | ||
* Wires the "jwt" authenticator from user configuration. | ||
* | ||
* @author Robin Chalas <[email protected]> | ||
* {@inheritdoc} | ||
*/ | ||
class JWTAuthenticatorFactory implements AuthenticatorFactoryInterface | ||
public function getPriority(): int | ||
{ | ||
use JWTAuthenticatorFactoryTrait; | ||
return -10; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getKey(): string | ||
{ | ||
return 'jwt'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function addConfiguration(NodeDefinition $node) | ||
{ | ||
$node | ||
->children() | ||
->scalarNode('provider') | ||
->defaultNull() | ||
->end() | ||
->scalarNode('authenticator') | ||
->defaultValue('lexik_jwt_authentication.security.jwt_authenticator') | ||
->end() | ||
->end() | ||
; | ||
} | ||
|
||
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string | ||
{ | ||
$authenticatorId = 'security.authenticator.jwt.' . $firewallName; | ||
|
||
$userProviderId = empty($config['provider']) ? $userProviderId : 'security.user.provider.concrete.' . $config['provider']; | ||
|
||
$container | ||
->setDefinition($authenticatorId, new ChildDefinition($config['authenticator'])) | ||
->replaceArgument(3, new Reference($userProviderId)) | ||
; | ||
|
||
// Compile-time parameter removed by RemoveLegacyAuthenticatorPass | ||
// Stop setting it when guard support gets removed (aka when removing Symfony<5.3 support) | ||
$container->setParameter('lexik_jwt_authentication.authenticator_manager_enabled', true); | ||
|
||
return $authenticatorId; | ||
} | ||
} |
82 changes: 0 additions & 82 deletions
82
DependencyInjection/Security/Factory/JWTAuthenticatorFactoryTrait.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 0 additions & 41 deletions
41
Security/Authenticator/ForwardCompatAuthenticatorTrait.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters