Skip to content

Commit

Permalink
SSO: Allow default authentication params for all URLs - refs BT#21881
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Aug 26, 2024
1 parent 1afd985 commit 7526bdc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Access URL Id / authentication method / params
parameters:
authentication:
1:
default:
generic:
enabled: true
client_id: ''
Expand Down
14 changes: 9 additions & 5 deletions src/CoreBundle/ServiceHelper/AuthenticationConfigHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7526bdc

Please sign in to comment.