Skip to content

Commit fce4118

Browse files
committed
Remove fetch and list endpoint
1 parent 62d842d commit fce4118

5 files changed

Lines changed: 0 additions & 305 deletions

File tree

routing/routes/routes.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use SimpleSAML\Module\oidc\Controllers\ConfigurationDiscoveryController;
1818
use SimpleSAML\Module\oidc\Controllers\EndSessionController;
1919
use SimpleSAML\Module\oidc\Controllers\Federation\EntityStatementController;
20-
use SimpleSAML\Module\oidc\Controllers\Federation\SubordinateListingsController;
2120
use SimpleSAML\Module\oidc\Controllers\JwksController;
2221
use SimpleSAML\Module\oidc\Controllers\OAuth2\OAuth2ServerConfigurationController;
2322
use SimpleSAML\Module\oidc\Controllers\UserInfoController;
@@ -114,14 +113,6 @@
114113
->controller([EntityStatementController::class, 'configuration'])
115114
->methods([HttpMethodsEnum::GET->value]);
116115

117-
$routes->add(RoutesEnum::FederationFetch->name, RoutesEnum::FederationFetch->value)
118-
->controller([EntityStatementController::class, 'fetch'])
119-
->methods([HttpMethodsEnum::GET->value]);
120-
121-
$routes->add(RoutesEnum::FederationList->name, RoutesEnum::FederationList->value)
122-
->controller([SubordinateListingsController::class, 'list'])
123-
->methods([HttpMethodsEnum::GET->value]);
124-
125116
/*****************************************************************************************************************
126117
* OpenID for Verifiable Credential Issuance
127118
****************************************************************************************************************/

src/Controllers/Federation/EntityStatementController.php

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use SimpleSAML\Module\oidc\Helpers;
88
use SimpleSAML\Module\oidc\ModuleConfig;
9-
use SimpleSAML\Module\oidc\Repositories\ClientRepository;
109
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
1110
use SimpleSAML\Module\oidc\Services\LoggerService;
1211
use SimpleSAML\Module\oidc\Services\OpMetadataService;
@@ -16,11 +15,9 @@
1615
use SimpleSAML\OpenID\Codebooks\ClientRegistrationTypesEnum;
1716
use SimpleSAML\OpenID\Codebooks\ContentTypesEnum;
1817
use SimpleSAML\OpenID\Codebooks\EntityTypesEnum;
19-
use SimpleSAML\OpenID\Codebooks\ErrorsEnum;
2018
use SimpleSAML\OpenID\Codebooks\HttpHeadersEnum;
2119
use SimpleSAML\OpenID\Federation;
2220
use SimpleSAML\OpenID\Jwks;
23-
use Symfony\Component\HttpFoundation\Request;
2421
use Symfony\Component\HttpFoundation\Response;
2522

2623
class EntityStatementController
@@ -35,7 +32,6 @@ public function __construct(
3532
protected readonly ModuleConfig $moduleConfig,
3633
protected readonly Jwks $jwks,
3734
protected readonly OpMetadataService $opMetadataService,
38-
protected readonly ClientRepository $clientRepository,
3935
protected readonly Helpers $helpers,
4036
protected readonly Routes $routes,
4137
protected readonly Federation $federation,
@@ -224,113 +220,6 @@ public function configuration(): Response
224220
return $this->prepareEntityStatementResponse($entityConfigurationToken);
225221
}
226222

227-
public function fetch(Request $request): Response
228-
{
229-
$subject = $request->query->getString(ClaimsEnum::Sub->value);
230-
231-
if (empty($subject)) {
232-
return $this->routes->newJsonErrorResponse(
233-
ErrorsEnum::InvalidRequest->value,
234-
sprintf('Missing parameter %s', ClaimsEnum::Sub->value),
235-
400,
236-
);
237-
}
238-
239-
/** @var non-empty-string $subject */
240-
241-
$cachedSubordinateStatement = $this->federationCache?->get(
242-
null,
243-
self::KEY_RP_SUBORDINATE_ENTITY_STATEMENT,
244-
$subject,
245-
);
246-
247-
if (!is_null($cachedSubordinateStatement)) {
248-
return $this->prepareEntityStatementResponse((string)$cachedSubordinateStatement);
249-
}
250-
251-
$client = $this->clientRepository->findFederatedByEntityIdentifier($subject);
252-
if (empty($client)) {
253-
return $this->routes->newJsonErrorResponse(
254-
ErrorsEnum::NotFound->value,
255-
sprintf('Subject not found (%s)', $subject),
256-
404,
257-
);
258-
}
259-
260-
$jwks = $client->getFederationJwks();
261-
if (empty($jwks)) {
262-
return $this->routes->newJsonErrorResponse(
263-
ErrorsEnum::InvalidClient->value,
264-
sprintf('Subject does not contain JWKS claim (%s)', $subject),
265-
401,
266-
);
267-
}
268-
269-
$currentTimestamp = $this->helpers->dateTime()->getUtc()->getTimestamp();
270-
271-
$payload = [
272-
ClaimsEnum::Iss->value => $this->moduleConfig->getIssuer(),
273-
ClaimsEnum::Iat->value => $currentTimestamp,
274-
ClaimsEnum::Jti->value => $this->helpers->random()->getIdentifier(),
275-
276-
ClaimsEnum::Sub->value => $subject,
277-
ClaimsEnum::Exp->value => $this->helpers->dateTime()->getUtc()->add(
278-
$this->moduleConfig->getFederationEntityStatementDuration(),
279-
)->getTimestamp(),
280-
ClaimsEnum::Jwks->value => $jwks,
281-
ClaimsEnum::Metadata->value => [
282-
EntityTypesEnum::OpenIdRelyingParty->value => [
283-
ClaimsEnum::ClientName->value => $client->getName(),
284-
ClaimsEnum::ClientId->value => $client->getIdentifier(),
285-
ClaimsEnum::RedirectUris->value => $client->getRedirectUris(),
286-
ClaimsEnum::Scope->value => implode(' ', $client->getScopes()),
287-
ClaimsEnum::ClientRegistrationTypes->value => $client->getClientRegistrationTypes(),
288-
// Optional claims...
289-
...(array_filter(
290-
[
291-
ClaimsEnum::BackChannelLogoutUri->value => $client->getBackChannelLogoutUri(),
292-
ClaimsEnum::PostLogoutRedirectUris->value => $client->getPostLogoutRedirectUri(),
293-
],
294-
)),
295-
// TODO v7 mivanci Continue
296-
// https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata
297-
// https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#client-metadata
298-
],
299-
],
300-
];
301-
302-
// TODO v7 mivanci Continue
303-
// Note: claims which can be present in subordinate statements:
304-
// * metadata_policy
305-
// * constraints
306-
// * metadata_policy_crit
307-
308-
$signingKeyPair = $this->moduleConfig
309-
->getFederationSignatureKeyPairBag()
310-
->getFirstOrFail();
311-
312-
313-
$header = [
314-
ClaimsEnum::Kid->value => $signingKeyPair->getKeyPair()->getKeyId(),
315-
];
316-
317-
$subordinateStatementToken = $this->federation->entityStatementFactory()->fromData(
318-
$signingKeyPair->getKeyPair()->getPrivateKey(),
319-
$signingKeyPair->getSignatureAlgorithm(),
320-
$payload,
321-
$header,
322-
)->getToken();
323-
324-
$this->federationCache?->set(
325-
$subordinateStatementToken,
326-
$this->moduleConfig->getFederationEntityStatementCacheDurationForProduced(),
327-
self::KEY_RP_SUBORDINATE_ENTITY_STATEMENT,
328-
$subject,
329-
);
330-
331-
return $this->prepareEntityStatementResponse($subordinateStatementToken);
332-
}
333-
334223
protected function prepareEntityStatementResponse(string $entityStatementToken): Response
335224
{
336225
return $this->routes->newResponse(

src/Controllers/Federation/SubordinateListingsController.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

tests/unit/src/Controllers/Federation/EntityStatementControllerTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use SimpleSAML\Module\oidc\Controllers\Federation\EntityStatementController;
1111
use SimpleSAML\Module\oidc\Helpers;
1212
use SimpleSAML\Module\oidc\ModuleConfig;
13-
use SimpleSAML\Module\oidc\Repositories\ClientRepository;
1413
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
1514
use SimpleSAML\Module\oidc\Services\LoggerService;
1615
use SimpleSAML\Module\oidc\Services\OpMetadataService;
@@ -25,7 +24,6 @@ class EntityStatementControllerTest extends TestCase
2524
protected MockObject $moduleConfigMock;
2625
protected MockObject $jwksMock;
2726
protected MockObject $opMetadataServiceMock;
28-
protected MockObject $clientRepositoryMock;
2927
protected MockObject $helpersMock;
3028
protected MockObject $routesMock;
3129
protected MockObject $federationMock;
@@ -38,7 +36,6 @@ protected function setUp(): void
3836
$this->moduleConfigMock = $this->createMock(ModuleConfig::class);
3937
$this->jwksMock = $this->createMock(Jwks::class);
4038
$this->opMetadataServiceMock = $this->createMock(OpMetadataService::class);
41-
$this->clientRepositoryMock = $this->createMock(ClientRepository::class);
4239
$this->helpersMock = $this->createMock(Helpers::class);
4340
$this->routesMock = $this->createMock(Routes::class);
4441
$this->federationMock = $this->createMock(Federation::class);
@@ -50,7 +47,6 @@ protected function sut(
5047
?ModuleConfig $moduleConfig = null,
5148
?Jwks $jwks = null,
5249
?OpMetadataService $opMetadataService = null,
53-
?ClientRepository $clientRepository = null,
5450
?Helpers $helpers = null,
5551
?Routes $routes = null,
5652
?Federation $federation = null,
@@ -60,7 +56,6 @@ protected function sut(
6056
$moduleConfig ??= $this->moduleConfigMock;
6157
$jwks ??= $this->jwksMock;
6258
$opMetadataService ??= $this->opMetadataServiceMock;
63-
$clientRepository ??= $this->clientRepositoryMock;
6459
$helpers ??= $this->helpersMock;
6560
$routes ??= $this->routesMock;
6661
$federation ??= $this->federationMock;
@@ -71,7 +66,6 @@ protected function sut(
7166
$moduleConfig,
7267
$jwks,
7368
$opMetadataService,
74-
$clientRepository,
7569
$helpers,
7670
$routes,
7771
$federation,

tests/unit/src/Controllers/Federation/SubordinateListingsControllerTest.php

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)