diff --git a/config/authentication.yaml b/config/authentication.yaml index 372df5aa687..3954d582514 100644 --- a/config/authentication.yaml +++ b/config/authentication.yaml @@ -2,7 +2,7 @@ # Access URL Id / authentication method / params parameters: authentication: - 1: + default: generic: enabled: true client_id: '' diff --git a/src/CoreBundle/ServiceHelper/AuthenticationConfigHelper.php b/src/CoreBundle/ServiceHelper/AuthenticationConfigHelper.php index a3b08e254c2..bea52da335a 100644 --- a/src/CoreBundle/ServiceHelper/AuthenticationConfigHelper.php +++ b/src/CoreBundle/ServiceHelper/AuthenticationConfigHelper.php @@ -23,15 +23,19 @@ public function getParams(string $providerName, ?AccessUrl $url = null): array $authentication = $this->parameterBag->get('authentication'); - if (!isset($authentication[$urlId])) { - throw new InvalidArgumentException('Invalid access URL Id'); + if (isset($authentication[$urlId])) { + $urlParams = $authentication[$urlId]; + } elseif (isset($authentication['default'])) { + $urlParams = $authentication['default']; + } else { + throw new InvalidArgumentException('Invalid access URL configuration'); } - if (!isset($authentication[$urlId][$providerName])) { - throw new InvalidArgumentException('Invalid authentication source'); + if (!isset($urlParams[$providerName])) { + throw new InvalidArgumentException('Invalid authentication provider for access URL'); } - return $authentication[$urlId][$providerName]; + return $urlParams[$providerName]; } public function isEnabled(string $methodName, ?AccessUrl $url = null): bool