Skip to content

Commit

Permalink
feat: Upgrade Symfony version
Browse files Browse the repository at this point in the history
  • Loading branch information
Makar Sichevoi committed Aug 29, 2024
1 parent cf8fcce commit 26eb2d2
Show file tree
Hide file tree
Showing 30 changed files with 534 additions and 600 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@

use OAT\Bundle\Lti1p3Bundle\Security\Authentication\Provider\Message\LtiPlatformMessageAuthenticationProvider;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiPlatformMessageAuthenticationListener;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiPlatformMessageAuthenticator;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiToolMessageAuthenticator;
use OAT\Library\Lti1p3Core\Message\Launch\Validator\Platform\PlatformLaunchValidatorInterface;
use OAT\Library\Lti1p3Core\Security\OAuth2\Validator\RequestAccessTokenValidatorInterface;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\RemoteUserFactory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
Expand Down Expand Up @@ -57,23 +61,22 @@ public function createAuthenticator(
array $config,
string $userProviderId
): array|string {
$providerId = sprintf('security.authentication.provider.%s.%s', $this->getKey(), $firewallName);
$providerDefinition = new Definition(LtiPlatformMessageAuthenticationProvider::class);
$providerDefinition
$authenticatorId = sprintf('security.authenticator.%s.%s', $this->getKey(), $firewallName);
$authenticatorDefinition = new Definition(LtiPlatformMessageAuthenticator::class);
$authenticatorDefinition
->setShared(false)
->setArguments(
[
new Reference('security.firewall.map'),
new Reference(HttpMessageFactoryInterface::class),
new Reference(PlatformLaunchValidatorInterface::class),
$firewallName,
$config['types'] ?? []
]
);
$container->setDefinition($providerId, $providerDefinition);
$container->setDefinition($authenticatorId, $authenticatorDefinition);

$listenerId = sprintf('security.authentication.listener.%s.%s', $this->getKey(), $firewallName);
$container->setDefinition($listenerId, new ChildDefinition(LtiPlatformMessageAuthenticationListener::class));

return [$providerId, $listenerId];
return $authenticatorId;
}

public function addConfiguration(NodeDefinition $node): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@
namespace OAT\Bundle\Lti1p3Bundle\DependencyInjection\Security\Factory\Message;

use OAT\Bundle\Lti1p3Bundle\Security\Authentication\Provider\Message\LtiToolMessageAuthenticationProvider;
use OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandlerInterface;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiToolMessageAuthenticationListener;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiToolMessageAuthenticator;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Service\LtiServiceAuthenticator;
use OAT\Library\Lti1p3Core\Message\Launch\Validator\Tool\ToolLaunchValidatorInterface;
use OAT\Library\Lti1p3Core\Security\OAuth2\Validator\RequestAccessTokenValidatorInterface;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\RemoteUserFactory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
Expand All @@ -51,23 +56,23 @@ public function createAuthenticator(
array $config,
string $userProviderId
): array|string {
$providerId = sprintf('security.authentication.provider.%s.%s', $this->getKey(), $firewallName);
$providerDefinition = new Definition(LtiToolMessageAuthenticationProvider::class);
$providerDefinition
$authenticatorId = sprintf('security.authenticator.%s.%s', $this->getKey(), $firewallName);
$authenticatorDefinition = new Definition(LtiToolMessageAuthenticator::class);
$authenticatorDefinition
->setShared(false)
->setArguments(
[
new Reference('security.firewall.map'),
new Reference(HttpMessageFactoryInterface::class),
new Reference(LtiToolMessageExceptionHandlerInterface::class),
new Reference(ToolLaunchValidatorInterface::class),
$firewallName,
$config['types'] ?? []
]
);
$container->setDefinition($providerId, $providerDefinition);
$container->setDefinition($authenticatorId, $authenticatorDefinition);

$listenerId = sprintf('security.authentication.listener.%s.%s', $this->getKey(), $firewallName);
$container->setDefinition($listenerId, new ChildDefinition(LtiToolMessageAuthenticationListener::class));

return [$providerId, $listenerId];
return $authenticatorId;
}

public function addConfiguration(NodeDefinition $node): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

namespace OAT\Bundle\Lti1p3Bundle\DependencyInjection\Security\Factory\Service;

use OAT\Bundle\Lti1p3Bundle\Security\Authentication\Provider\Service\LtiServiceAuthenticationProvider;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Service\LtiServiceAuthenticationListener;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Service\LtiServiceAuthenticator;
use OAT\Library\Lti1p3Core\Security\OAuth2\Validator\RequestAccessTokenValidatorInterface;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\RemoteUserFactory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
Expand All @@ -51,23 +51,22 @@ public function createAuthenticator(
array $config,
string $userProviderId
): array|string {
$providerId = sprintf('security.authentication.provider.%s.%s', $this->getKey(), $firewallName);
$providerDefinition = new Definition(LtiServiceAuthenticationProvider::class);
$providerDefinition
$authenticatorId = sprintf('security.authenticator.%s.%s', $this->getKey(), $firewallName);
$authenticatorDefinition = new Definition(LtiServiceAuthenticator::class);
$authenticatorDefinition
->setShared(false)
->setArguments(
[
new Reference('security.firewall.map'),
new Reference(HttpMessageFactoryInterface::class),
new Reference(RequestAccessTokenValidatorInterface::class),
$firewallName,
$config['scopes'] ?? []
]
);
$container->setDefinition($providerId, $providerDefinition);
$container->setDefinition($authenticatorId, $authenticatorDefinition);

$listenerId = sprintf('security.authentication.listener.%s.%s', $this->getKey(), $firewallName);
$container->setDefinition($listenerId, new ChildDefinition(LtiServiceAuthenticationListener::class));

return [$providerId, $listenerId];
return $authenticatorId;
}

public function addConfiguration(NodeDefinition $node): void
Expand Down
42 changes: 21 additions & 21 deletions Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,27 +181,27 @@ services:
OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandlerInterface:
alias: OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandler

OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiPlatformMessageAuthenticationListener:
arguments:
- '@security.token_storage'
- '@security.authentication.manager'
- '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
- '@security.firewall.map'

OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiToolMessageAuthenticationListener:
arguments:
- '@security.token_storage'
- '@security.authentication.manager'
- '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
- '@OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandlerInterface'
- '@security.firewall.map'

OAT\Bundle\Lti1p3Bundle\Security\Firewall\Service\LtiServiceAuthenticationListener:
arguments:
- '@security.token_storage'
- '@security.authentication.manager'
- '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
- '@security.firewall.map'
# OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiPlatformMessageAuthenticationListener:
# arguments:
# - '@security.token_storage'
## - '@security.authenticator.manager.main'
# - '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
# - '@security.firewall.map'
#
# OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiToolMessageAuthenticationListener:
# arguments:
# - '@security.token_storage'
## - '@security.authenticator.manager.main'
# - '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
# - '@OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandlerInterface'
# - '@security.firewall.map'
#
# OAT\Bundle\Lti1p3Bundle\Security\Firewall\Service\LtiServiceAuthenticationListener:
# arguments:
# - '@security.token_storage'
## - '@security.authenticator'
# - '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
# - '@security.firewall.map'

OAT\Library\Lti1p3Core\Security\User\UserAuthenticatorInterface: ~

Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 26eb2d2

Please sign in to comment.