Do not make AbstractFactory internal and revert method rename

This commit is contained in:
Wouter de Jong 2020-05-02 20:56:43 +02:00
parent 6870a18803
commit c75659350e
10 changed files with 18 additions and 17 deletions

View File

@ -112,7 +112,7 @@ Routing
SecurityBundle
--------------
* Marked the `AbstractFactory`, `AnonymousFactory`, `FormLoginFactory`, `FormLoginLdapFactory`, `GuardAuthenticationFactory`,
* Marked the `AnonymousFactory`, `FormLoginFactory`, `FormLoginLdapFactory`, `GuardAuthenticationFactory`,
`HttpBasicFactory`, `HttpBasicLdapFactory`, `JsonLoginFactory`, `JsonLoginLdapFactory`, `RememberMeFactory`, `RemoteUserFactory`
and `X509Factory` as `@internal`. Instead of extending these classes, create your own implementation based on
`SecurityFactoryInterface`.

View File

@ -6,7 +6,7 @@ CHANGELOG
* Added XSD for configuration
* Added security configuration for priority-based access decision strategy
* Marked the `AbstractFactory`, `AnonymousFactory`, `FormLoginFactory`, `FormLoginLdapFactory`, `GuardAuthenticationFactory`, `HttpBasicFactory`, `HttpBasicLdapFactory`, `JsonLoginFactory`, `JsonLoginLdapFactory`, `RememberMeFactory`, `RemoteUserFactory` and `X509Factory` as `@internal`
* Marked the `AnonymousFactory`, `FormLoginFactory`, `FormLoginLdapFactory`, `GuardAuthenticationFactory`, `HttpBasicFactory`, `HttpBasicLdapFactory`, `JsonLoginFactory`, `JsonLoginLdapFactory`, `RememberMeFactory`, `RemoteUserFactory` and `X509Factory` as `@internal`
* Renamed method `AbstractFactory#createEntryPoint()` to `AbstractFactory#createDefaultEntryPoint()`
5.0.0

View File

@ -23,8 +23,6 @@ use Symfony\Component\DependencyInjection\Reference;
* @author Fabien Potencier <fabien@symfony.com>
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*
* @internal
*/
abstract class AbstractFactory implements SecurityFactoryInterface
{
@ -67,7 +65,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
}
// create entry point if applicable (optional)
$entryPointId = $this->createDefaultEntryPoint($container, $id, $config, $defaultEntryPointId);
$entryPointId = $this->createEntryPoint($container, $id, $config, $defaultEntryPointId);
return [$authProviderId, $listenerId, $entryPointId];
}
@ -128,7 +126,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface
*
* @return string|null the entry point id
*/
protected function createDefaultEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId)
protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId)
{
return $defaultEntryPointId;
}

View File

@ -21,7 +21,10 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
interface EntryPointFactoryInterface
{
/**
* Creates the entry point and returns the service ID.
* Register the entry point on the container and returns the service ID.
*
* This does not mean that the entry point is also used. This is managed
* by the "entry_point" firewall setting.
*/
public function createEntryPoint(ContainerBuilder $container, string $id, array $config): ?string;
public function registerEntryPoint(ContainerBuilder $container, string $id, array $config): ?string;
}

View File

@ -92,12 +92,12 @@ class FormLoginFactory extends AbstractFactory implements AuthenticatorFactoryIn
return $listenerId;
}
protected function createDefaultEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId)
protected function createEntryPoint(ContainerBuilder $container, string $id, array $config, ?string $defaultEntryPointId)
{
return $this->createEntryPoint($container, $id, $config);
return $this->registerEntryPoint($container, $id, $config);
}
public function createEntryPoint(ContainerBuilder $container, string $id, array $config): string
public function registerEntryPoint(ContainerBuilder $container, string $id, array $config): string
{
$entryPointId = 'security.authentication.form_entry_point.'.$id;
$container

View File

@ -114,7 +114,7 @@ class GuardAuthenticationFactory implements SecurityFactoryInterface, Authentica
return $authenticatorIds;
}
public function createEntryPoint(ContainerBuilder $container, string $id, array $config): ?string
public function registerEntryPoint(ContainerBuilder $container, string $id, array $config): ?string
{
try {
return $this->determineEntryPoint(null, $config);

View File

@ -38,7 +38,7 @@ class HttpBasicFactory implements SecurityFactoryInterface, AuthenticatorFactory
// entry point
$entryPointId = $defaultEntryPoint;
if (null === $entryPointId) {
$entryPointId = $this->createEntryPoint($container, $id, $config);
$entryPointId = $this->registerEntryPoint($container, $id, $config);
}
// listener
@ -82,7 +82,7 @@ class HttpBasicFactory implements SecurityFactoryInterface, AuthenticatorFactory
;
}
public function createEntryPoint(ContainerBuilder $container, string $id, array $config): string
public function registerEntryPoint(ContainerBuilder $container, string $id, array $config): string
{
$entryPointId = 'security.authentication.basic_entry_point.'.$id;
$container

View File

@ -43,7 +43,7 @@ class HttpBasicLdapFactory extends HttpBasicFactory
;
// entry point
$entryPointId = $this->createEntryPoint($container, $id, $config, $defaultEntryPoint);
$entryPointId = $this->registerEntryPoint($container, $id, $config, $defaultEntryPoint);
if (!empty($config['query_string'])) {
if ('' === $config['search_dn'] || '' === $config['search_password']) {

View File

@ -547,7 +547,7 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
$authenticationProviders[] = $authenticators;
}
if ($factory instanceof EntryPointFactoryInterface && ($entryPoint = $factory->createEntryPoint($container, $id, $firewall[$key]))) {
if ($factory instanceof EntryPointFactoryInterface && ($entryPoint = $factory->registerEntryPoint($container, $id, $firewall[$key]))) {
$entryPoints[$key] = $entryPoint;
}
} else {

View File

@ -178,7 +178,7 @@ class GuardAuthenticationFactoryTest extends TestCase
$authenticators = $factory->createAuthenticator($container, $firewallName, $config, $userProviderId);
$this->assertEquals('security.authenticator.guard.my_firewall.0', $authenticators[0]);
$entryPointId = $factory->createEntryPoint($container, $firewallName, $config, null);
$entryPointId = $factory->registerEntryPoint($container, $firewallName, $config, null);
$this->assertEquals('authenticator123', $entryPointId);
$authenticatorDefinition = $container->getDefinition('security.authenticator.guard.my_firewall.0');