Skip to content

Commit

Permalink
IBX-8558: Removed GuardRepositoryAuthenticationProvider due to Symf…
Browse files Browse the repository at this point in the history
…ony security deprecations (#405)

For more details see https://issues.ibexa.co/browse/IBX-8558 and #405

Key changes:

* IBX-8558: Removed `GuardRepositoryAuthenticationProvider` due to Symfony security deprecations
  • Loading branch information
konradoboza authored Aug 1, 2024
1 parent de74408 commit b4a44cc
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 190 deletions.
25 changes: 0 additions & 25 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -46960,31 +46960,6 @@ parameters:
count: 1
path: tests/lib/MVC/Symfony/Routing/UrlAliasRouterTest.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\TokenInterface\\:\\:getProviderKey\\(\\)\\.$#"
count: 1
path: tests/lib/MVC/Symfony/Security/Authentication/GuardRepositoryAuthenticationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\Authentication\\\\GuardRepositoryAuthenticationProviderTest\\:\\:testAuthenticate\\(\\) has no return type specified\\.$#"
count: 1
path: tests/lib/MVC/Symfony/Security/Authentication/GuardRepositoryAuthenticationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\Authentication\\\\GuardRepositoryAuthenticationProviderTest\\:\\:testAuthenticateUnsupportedToken\\(\\) has no return type specified\\.$#"
count: 1
path: tests/lib/MVC/Symfony/Security/Authentication/GuardRepositoryAuthenticationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\Authentication\\\\GuardRepositoryAuthenticationProviderTest\\:\\:testAuthenticateWrongGuardProviderKey\\(\\) has no return type specified\\.$#"
count: 1
path: tests/lib/MVC/Symfony/Security/Authentication/GuardRepositoryAuthenticationProviderTest.php

-
message: "#^Parameter \\#1 \\$token of method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\Authentication\\\\GuardRepositoryAuthenticationProvider\\:\\:authenticate\\(\\) expects Symfony\\\\Component\\\\Security\\\\Guard\\\\Token\\\\GuardTokenInterface, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Symfony\\\\Component\\\\Security\\\\Core\\\\Authentication\\\\Token\\\\AnonymousToken given\\.$#"
count: 1
path: tests/lib/MVC/Symfony/Security/Authentication/GuardRepositoryAuthenticationProviderTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Security\\\\HttpUtilsTest\\:\\:checkRequestPathProvider\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
17 changes: 0 additions & 17 deletions src/bundle/Core/DependencyInjection/Compiler/SecurityPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

namespace Ibexa\Bundle\Core\DependencyInjection\Compiler;

use Ibexa\Contracts\Core\Repository\PermissionResolver;
use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface;
use Ibexa\Core\MVC\Symfony\Security\Authentication\DefaultAuthenticationSuccessHandler;
use Ibexa\Core\MVC\Symfony\Security\Authentication\GuardRepositoryAuthenticationProvider;
use Ibexa\Core\MVC\Symfony\Security\HttpUtils;
use Ibexa\Core\MVC\Symfony\SiteAccess;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
Expand All @@ -26,21 +24,6 @@ final class SecurityPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (
!$container->hasDefinition('security.authentication.provider.guard')
) {
return;
}

$permissionResolverRef = new Reference(PermissionResolver::class);

$guardAuthenticationProviderDef = $container->findDefinition('security.authentication.provider.guard');
$guardAuthenticationProviderDef->setClass(GuardRepositoryAuthenticationProvider::class);
$guardAuthenticationProviderDef->addMethodCall(
'setPermissionResolver',
[$permissionResolverRef]
);

if (!$container->hasDefinition('security.http_utils')) {
return;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,10 @@ protected function registerCompilerPass(ContainerBuilder $container): void
$container->addCompilerPass(new SecurityPass());
}

public function testAlteredDaoAuthenticationProvider(): void
public function testAlteredHttpUtils(): void
{
$this->compile();

$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
'security.authentication.provider.guard',
'setPermissionResolver',
[new Reference(PermissionResolver::class)]
);
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall(
'security.http_utils',
'setSiteAccess',
Expand Down

This file was deleted.

0 comments on commit b4a44cc

Please sign in to comment.