Skip to content

Commit af24e8b

Browse files
committed
Filter scopes based on config
1 parent 1ea7dc7 commit af24e8b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Factories/Entities/ClientEntityFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use SimpleSAML\Module\oidc\Entities\ClientEntity;
1212
use SimpleSAML\Module\oidc\Entities\Interfaces\ClientEntityInterface;
1313
use SimpleSAML\Module\oidc\Helpers;
14+
use SimpleSAML\Module\oidc\ModuleConfig;
1415
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
15-
use SimpleSAML\Module\oidc\Utils\ClaimTranslatorExtractor;
1616
use SimpleSAML\Module\oidc\Utils\RequestParamsResolver;
1717
use SimpleSAML\OpenID\Codebooks\ApplicationTypesEnum;
1818
use SimpleSAML\OpenID\Codebooks\ClaimsEnum;
@@ -27,7 +27,7 @@ class ClientEntityFactory
2727
public function __construct(
2828
private readonly SspBridge $sspBridge,
2929
private readonly Helpers $helpers,
30-
private readonly ClaimTranslatorExtractor $claimTranslatorExtractor,
30+
private readonly ModuleConfig $moduleConfig,
3131
private readonly RequestParamsResolver $requestParamsResolver,
3232
) {
3333
}
@@ -130,7 +130,7 @@ public function fromRegistrationData(
130130
// Filter to only allowed scopes
131131
$scopes = array_filter(
132132
$scopes,
133-
fn(string $scope): bool => $this->claimTranslatorExtractor->hasClaimSet($scope),
133+
fn(string $scope): bool => array_key_exists($scope, $this->moduleConfig->getScopes()),
134134
);
135135
// Let's ensure there is at least 'openid' scope present.
136136
$scopes = empty($scopes) ? [ScopesEnum::OpenId->value] : $scopes;

src/Services/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function __construct()
231231
$clientEntityFactory = new ClientEntityFactory(
232232
$sspBridge,
233233
$helpers,
234-
$claimTranslatorExtractor,
234+
$moduleConfig,
235235
$requestParamsResolver,
236236
);
237237
$this->services[ClientEntityFactory::class] = $clientEntityFactory;

0 commit comments

Comments
 (0)