Skip to content

Commit ce40d95

Browse files
committed
Rename ClientIdRule to ClientRule
1 parent d75b9d2 commit ce40d95

21 files changed

+53
-48
lines changed

src/Controllers/VerifiableCredentials/CredentialIssuerConfigurationController.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,27 @@ public function __construct(
3535

3636
public function configuration(): Response
3737
{
38-
// TODO mivanci Abstract configuring Credential Issuer / Configuration away from module config.
3938
// https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-credential-issuer-metadata-p
4039

4140
$signer = $this->moduleConfig->getProtocolSigner();
4241

4342
$credentialConfigurationsSupported = $this->moduleConfig->getCredentialConfigurationsSupported();
4443

4544
// For now, we only support one credential signing algorithm.
45+
/** @psalm-suppress MixedAssignment */
4646
foreach ($credentialConfigurationsSupported as $credentialConfigurationId => $credentialConfiguration) {
47-
// Draft 17
48-
$credentialConfiguration[ClaimsEnum::CredentialSigningAlgValuesSupported->value] = [
49-
$signer->algorithmId(),
50-
];
51-
// Earlier drafts
52-
// TODO mivanci Delete CryptographicSuitesSupported once we are on the final draft.
53-
$credentialConfiguration[ClaimsEnum::CryptographicSuitesSupported->value] = [
54-
$signer->algorithmId(),
55-
];
56-
$credentialConfigurationsSupported[$credentialConfigurationId] = $credentialConfiguration;
47+
if (is_array($credentialConfiguration)) {
48+
// Draft 17
49+
$credentialConfiguration[ClaimsEnum::CredentialSigningAlgValuesSupported->value] = [
50+
$signer->algorithmId(),
51+
];
52+
// Earlier drafts
53+
// TODO mivanci Delete CryptographicSuitesSupported once we are on the final draft.
54+
$credentialConfiguration[ClaimsEnum::CryptographicSuitesSupported->value] = [
55+
$signer->algorithmId(),
56+
];
57+
$credentialConfigurationsSupported[$credentialConfigurationId] = $credentialConfiguration;
58+
}
5759
}
5860

5961
$configuration = [

src/Factories/RequestRulesManagerFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\AcrValuesRule;
1616
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\AddClaimsToIdTokenRule;
1717
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientAuthenticationRule;
18-
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientIdRule;
18+
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientRule;
1919
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\CodeChallengeMethodRule;
2020
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\CodeChallengeRule;
2121
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\CodeVerifierRule;
@@ -84,7 +84,7 @@ private function getDefaultRules(): array
8484
{
8585
return [
8686
new StateRule($this->requestParamsResolver, $this->helpers),
87-
new ClientIdRule(
87+
new ClientRule(
8888
$this->requestParamsResolver,
8989
$this->helpers,
9090
$this->clientRepository,

src/Server/AuthorizationServer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
1919
use SimpleSAML\Module\oidc\Server\Grants\Interfaces\AuthorizationValidatableWithRequestRules;
2020
use SimpleSAML\Module\oidc\Server\RequestRules\RequestRulesManager;
21-
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientIdRule;
21+
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientRule;
2222
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\IdTokenHintRule;
2323
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\PostLogoutRedirectUriRule;
2424
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\RedirectUriRule;
@@ -79,7 +79,7 @@ public function validateAuthorizationRequest(ServerRequestInterface $request): O
7979
{
8080
$rulesToExecute = [
8181
StateRule::class,
82-
ClientIdRule::class,
82+
ClientRule::class,
8383
RedirectUriRule::class,
8484
];
8585

src/Server/Grants/AuthCodeGrant.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
use SimpleSAML\Module\oidc\Server\RequestRules\RequestRulesManager;
4141
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\AcrValuesRule;
4242
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientAuthenticationRule;
43-
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientIdRule;
43+
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientRule;
4444
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\CodeChallengeMethodRule;
4545
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\CodeChallengeRule;
4646
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\CodeVerifierRule;
@@ -389,7 +389,7 @@ public function respondToAccessTokenRequest(
389389
//[$clientId] = $this->getClientCredentials($request);
390390

391391
$rulesToExecute = [
392-
ClientIdRule::class,
392+
ClientRule::class,
393393
RedirectUriRule::class,
394394
ClientAuthenticationRule::class,
395395
CodeVerifierRule::class,
@@ -403,7 +403,7 @@ public function respondToAccessTokenRequest(
403403
);
404404

405405
/** @var \SimpleSAML\Module\oidc\Entities\Interfaces\ClientEntityInterface $client */
406-
$client = $resultBag->getOrFail(ClientIdRule::class)->getValue();
406+
$client = $resultBag->getOrFail(ClientRule::class)->getValue();
407407
/** @var ?string $clientAuthenticationParam */
408408
$clientAuthenticationParam = $resultBag->getOrFail(ClientAuthenticationRule::class)->getValue();
409409
/** @var ?string $codeVerifier */
@@ -668,7 +668,7 @@ public function validateAuthorizationRequestWithRequestRules(
668668
/** @var string|null $state */
669669
$state = $resultBag->getOrFail(StateRule::class)->getValue();
670670
/** @var \SimpleSAML\Module\oidc\Entities\Interfaces\ClientEntityInterface $client */
671-
$client = $resultBag->getOrFail(ClientIdRule::class)->getValue();
671+
$client = $resultBag->getOrFail(ClientRule::class)->getValue();
672672

673673
// Some rules have to have certain things available in order to work properly...
674674
$this->requestRulesManager->setData('default_scope', $this->defaultScope);

src/Server/Grants/ImplicitGrant.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use SimpleSAML\Module\oidc\Server\RequestRules\RequestRulesManager;
2525
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\AcrValuesRule;
2626
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\AddClaimsToIdTokenRule;
27-
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientIdRule;
27+
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\ClientRule;
2828
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\MaxAgeRule;
2929
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\PromptRule;
3030
use SimpleSAML\Module\oidc\Server\RequestRules\Rules\RedirectUriRule;
@@ -142,7 +142,7 @@ public function validateAuthorizationRequestWithRequestRules(
142142
/** @var string|null $state */
143143
$state = $resultBag->getOrFail(StateRule::class)->getValue();
144144
/** @var \SimpleSAML\Module\oidc\Entities\Interfaces\ClientEntityInterface $client */
145-
$client = $resultBag->getOrFail(ClientIdRule::class)->getValue();
145+
$client = $resultBag->getOrFail(ClientRule::class)->getValue();
146146

147147
// Some rules need certain things available in order to work properly...
148148
$this->requestRulesManager->setData('default_scope', $this->defaultScope);

src/Server/RequestRules/Rules/ClientAuthenticationRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function checkRule(
4747
array $allowedServerRequestMethods = [HttpMethodsEnum::GET],
4848
): ?ResultInterface {
4949
/** @var \SimpleSAML\Module\oidc\Entities\Interfaces\ClientEntityInterface $client */
50-
$client = $currentResultBag->getOrFail(ClientIdRule::class)->getValue();
50+
$client = $currentResultBag->getOrFail(ClientRule::class)->getValue();
5151

5252
// We will only perform client authentication if the client type is confidential.
5353
if (!$client->isConfidential()) {

src/Server/RequestRules/Rules/ClientIdRule.php renamed to src/Server/RequestRules/Rules/ClientRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
use SimpleSAML\OpenID\Federation;
2929
use Throwable;
3030

31-
class ClientIdRule extends AbstractRule
31+
/**
32+
* Resolve a client instance based on a client_id or request object.
33+
*/
34+
class ClientRule extends AbstractRule
3235
{
3336
protected const KEY_REQUEST_OBJECT_JTI = 'request_object_jti';
3437

src/Server/RequestRules/Rules/CodeChallengeRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function checkRule(
2828
array $allowedServerRequestMethods = [HttpMethodsEnum::GET],
2929
): ?ResultInterface {
3030
/** @var \SimpleSAML\Module\oidc\Entities\Interfaces\ClientEntityInterface $client */
31-
$client = $currentResultBag->getOrFail(ClientIdRule::class)->getValue();
31+
$client = $currentResultBag->getOrFail(ClientRule::class)->getValue();
3232
/** @var string $redirectUri */
3333
$redirectUri = $currentResultBag->getOrFail(RedirectUriRule::class)->getValue();
3434
/** @var string|null $state */

src/Server/RequestRules/Rules/CodeVerifierRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function checkRule(
2727
array $allowedServerRequestMethods = [HttpMethodsEnum::GET],
2828
): ?ResultInterface {
2929
/** @var \SimpleSAML\Module\oidc\Entities\Interfaces\ClientEntityInterface $client */
30-
$client = $currentResultBag->getOrFail(ClientIdRule::class)->getValue();
30+
$client = $currentResultBag->getOrFail(ClientRule::class)->getValue();
3131

3232
$codeVerifier = $this->requestParamsResolver->getFromRequestBasedOnAllowedMethods(
3333
ParamsEnum::CodeVerifier->value,

src/Server/RequestRules/Rules/MaxAgeRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function checkRule(
5252
);
5353

5454
/** @var \SimpleSAML\Module\oidc\Entities\Interfaces\ClientEntityInterface $client */
55-
$client = $currentResultBag->getOrFail(ClientIdRule::class)->getValue();
55+
$client = $currentResultBag->getOrFail(ClientRule::class)->getValue();
5656

5757
$authSimple = $this->authSimpleFactory->build($client);
5858

0 commit comments

Comments
 (0)