Skip to content

FirewallFactory

Builds a live FirewallMap from SecurityConfigHandler’s canonical array, resolving each firewall’s <authenticator ref="..."> and entry-point against explicit registries the app assembles itself — no implicit global service-locator lookups, so wiring stays visible and testable.

Apps that assemble firewalls purely in PHP never need this class or security.xml at all.

final class FirewallFactory

Since1.0.0
SourceConfig/FirewallFactory.php

public function __construct(array<string, AuthenticatorInterface> $authenticators, array<string, EntryPointInterface> $entryPoints): mixed

Keyed by entry-point (e.g. “login”, “challenge”).

ParameterTypeDescription
$authenticatorsarray``<``string``, AuthenticatorInterface>Keyed by the ref used in security.xml.
$entryPointsarray``<``string``, EntryPointInterface>Keyed by entry-point (e.g. “login”, “challenge”).

Returns mixed

MethodDescription
build(array{firewalls: array<string, array{pattern: string, stateless: bool, sessionless: bool, entry_point: ?string, provider: ?string, authenticators: array<int, string>}>} $config): FirewallMap

public function build(array{firewalls: array<string, array{pattern: string, stateless: bool, sessionless: bool, entry_point: ?string, provider: ?string, authenticators: array<int, string>}>} $config): FirewallMap

The canonical array from SecurityConfigHandler::toCanonicalArray().

ParameterTypeDescription
$configarray{firewalls: array<string, array{pattern: string, stateless: bool, sessionless: bool, entry_point: ?string, provider: ?string, authenticators: array<int, string>}>}The canonical array from SecurityConfigHandler::toCanonicalArray().

Returns FirewallMap — The resulting firewalls, in the same order as $config.

ThrowsWhen
RuntimeExceptionIf a firewall references an authenticator ref or entry-point key not present in the constructor’s registries.