Skip to content

Commit

Permalink
bug #36650 [Security] Fix bug introduced in entry_point configuration (
Browse files Browse the repository at this point in the history
…#36575) (wouterj)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[Security] Fix bug introduced in entry_point configuration (#36575)

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

6978471 Fixed #36575
  • Loading branch information
fabpot committed May 1, 2020
2 parents ed1b6ea + 6978471 commit c30d6f9
Showing 1 changed file with 5 additions and 7 deletions.
Expand Up @@ -560,14 +560,12 @@ private function createAuthenticationListeners(ContainerBuilder $container, stri
if ($entryPoints) {
// we can be sure the authenticator system is enabled
if (null !== $defaultEntryPoint) {
return $entryPoints[$defaultEntryPoint] ?? $defaultEntryPoint;
}

if (1 === \count($entryPoints)) {
return current($entryPoints);
$defaultEntryPoint = $entryPoints[$defaultEntryPoint] ?? $defaultEntryPoint;
} elseif (1 === \count($entryPoints)) {
$defaultEntryPoint = current($entryPoints);
} else {
throw new InvalidConfigurationException(sprintf('Because you have multiple authenticators in firewall "%s", you need to set the "entry_point" key to one of your authenticators (%s) or a service ID implementing "%s". The "entry_point" determines what should happen (e.g. redirect to "/login") when an anonymous user tries to access a protected page.', $id, implode(', ', $entryPoints), AuthenticationEntryPointInterface::class));
}

throw new InvalidConfigurationException(sprintf('Because you have multiple authenticators in firewall "%s", you need to set the "entry_point" key to one of your authenticators (%s) or a service ID implementing "%s". The "entry_point" determines what should happen (e.g. redirect to "/login") when an anonymous user tries to access a protected page.', $id, implode(', ', $entryPoints), AuthenticationEntryPointInterface::class));
}

if (false === $hasListeners) {
Expand Down

0 comments on commit c30d6f9

Please sign in to comment.