welcome back to dyb-tech
This commit is contained in:
Vendored
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class ApiPlatformOpenApiPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if (!$container->hasDefinition('lexik_jwt_authentication.api_platform.openapi.factory') || !$container->hasParameter('security.firewalls')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$checkPath = null;
|
||||
$usernamePath = null;
|
||||
$passwordPath = null;
|
||||
$firewalls = $container->getParameter('security.firewalls');
|
||||
foreach ($firewalls as $firewallName) {
|
||||
if ($container->hasDefinition('security.authenticator.json_login.' . $firewallName)) {
|
||||
$firewallOptions = $container->getDefinition('security.authenticator.json_login.' . $firewallName)->getArgument(4);
|
||||
$checkPath = $firewallOptions['check_path'];
|
||||
$usernamePath = $firewallOptions['username_path'];
|
||||
$passwordPath = $firewallOptions['password_path'];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$openApiFactoryDefinition = $container->getDefinition('lexik_jwt_authentication.api_platform.openapi.factory');
|
||||
$checkPathArg = $openApiFactoryDefinition->getArgument(1);
|
||||
$usernamePathArg = $openApiFactoryDefinition->getArgument(2);
|
||||
$passwordPathArg = $openApiFactoryDefinition->getArgument(3);
|
||||
|
||||
if (!$checkPath && !$checkPathArg) {
|
||||
$container->removeDefinition('lexik_jwt_authentication.api_platform.openapi.factory');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$checkPathArg) {
|
||||
$openApiFactoryDefinition->replaceArgument(1, $checkPath);
|
||||
}
|
||||
if (!$usernamePathArg) {
|
||||
$openApiFactoryDefinition->replaceArgument(2, $usernamePath ?? 'username');
|
||||
}
|
||||
if (!$passwordPathArg) {
|
||||
$openApiFactoryDefinition->replaceArgument(3, $passwordPath ?? 'password');
|
||||
}
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Lexik\Bundle\JWTAuthenticationBundle\Security\Guard\JWTTokenAuthenticator;
|
||||
use Symfony\Component\Config\Definition\BaseNode;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class DeprecateLegacyGuardAuthenticatorPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if (!$container->hasParameter('lexik_jwt_authentication.authenticator_manager_enabled') || !$container->getParameter('lexik_jwt_authentication.authenticator_manager_enabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$deprecationArgs = ['The "%service_id%" service is deprecated and will be removed in 3.0, use the new "jwt" authenticator instead.'];
|
||||
if (method_exists(BaseNode::class, 'getDeprecation')) {
|
||||
$deprecationArgs = ['lexik/jwt-authentication-bundle', '2.7', 'The "%service_id%" service is deprecated and will be removed in 3.0, use the new "jwt" authenticator instead.'];
|
||||
}
|
||||
|
||||
$container
|
||||
->getDefinition('lexik_jwt_authentication.security.guard.jwt_token_authenticator')
|
||||
->setDeprecated(...$deprecationArgs);
|
||||
}
|
||||
}
|
||||
vendor/lexik/jwt-authentication-bundle/DependencyInjection/Compiler/WireGenerateTokenCommandPass.php
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Lexik\Bundle\JWTAuthenticationBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
class WireGenerateTokenCommandPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
if (!$container->hasDefinition('lexik_jwt_authentication.generate_token_command') || !$container->hasDefinition('security.context_listener')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$container
|
||||
->getDefinition('lexik_jwt_authentication.generate_token_command')
|
||||
->replaceArgument(1, $container->getDefinition('security.context_listener')->getArgument(1))
|
||||
;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user