SSO: Allow default authentication params for all URLs - refs BT#21881

pull/5753/head
Angel Fernando Quiroz Campos 1 year ago
parent 4c930fe811
commit 789a347d5a
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 2
      config/authentication.yaml
  2. 14
      src/CoreBundle/ServiceHelper/AuthenticationConfigHelper.php

@ -2,7 +2,7 @@
# Access URL Id / authentication method / params # Access URL Id / authentication method / params
parameters: parameters:
authentication: authentication:
1: default:
generic: generic:
enabled: false enabled: false
client_id: '' client_id: ''

@ -23,15 +23,19 @@ readonly class AuthenticationConfigHelper
$authentication = $this->parameterBag->get('authentication'); $authentication = $this->parameterBag->get('authentication');
if (!isset($authentication[$urlId])) { if (isset($authentication[$urlId])) {
throw new InvalidArgumentException('Invalid access URL Id'); $urlParams = $authentication[$urlId];
} elseif (isset($authentication['default'])) {
$urlParams = $authentication['default'];
} else {
throw new InvalidArgumentException('Invalid access URL configuration');
} }
if (!isset($authentication[$urlId][$providerName])) { if (!isset($urlParams[$providerName])) {
throw new InvalidArgumentException('Invalid authentication source'); 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 public function isEnabled(string $methodName, ?AccessUrl $url = null): bool

Loading…
Cancel
Save