|
19 | 19 | use SimpleSAML\OpenID\Factories\DateIntervalDecoratorFactory; |
20 | 20 | use SimpleSAML\OpenID\Factories\HttpClientDecoratorFactory; |
21 | 21 | use SimpleSAML\OpenID\Factories\JwsSerializerManagerDecoratorFactory; |
22 | | -use SimpleSAML\OpenID\Federation\CacheEntityCollectionStore; |
23 | | -use SimpleSAML\OpenID\Federation\EntityCollectionBuilder; |
24 | | -use SimpleSAML\OpenID\Federation\EntityCollectionFetcher; |
25 | | -use SimpleSAML\OpenID\Federation\EntityCollectionFilter; |
26 | | -use SimpleSAML\OpenID\Federation\EntityCollectionPaginator; |
27 | | -use SimpleSAML\OpenID\Federation\EntityCollectionSorter; |
28 | | -use SimpleSAML\OpenID\Federation\EntityCollectionStoreInterface; |
| 22 | +use SimpleSAML\OpenID\Federation\EntityCollection\CacheEntityCollectionStore; |
| 23 | +use SimpleSAML\OpenID\Federation\EntityCollection\EntityCollectionFetcher; |
| 24 | +use SimpleSAML\OpenID\Federation\EntityCollection\EntityCollectionFilter; |
| 25 | +use SimpleSAML\OpenID\Federation\EntityCollection\EntityCollectionPaginator; |
| 26 | +use SimpleSAML\OpenID\Federation\EntityCollection\EntityCollectionResponseFactory; |
| 27 | +use SimpleSAML\OpenID\Federation\EntityCollection\EntityCollectionSorter; |
| 28 | +use SimpleSAML\OpenID\Federation\EntityCollection\EntityCollectionStoreInterface; |
| 29 | +use SimpleSAML\OpenID\Federation\EntityCollection\InMemoryEntityCollectionStore; |
29 | 30 | use SimpleSAML\OpenID\Federation\EntityStatementFetcher; |
30 | 31 | use SimpleSAML\OpenID\Federation\Factories\EntityStatementFactory; |
31 | 32 | use SimpleSAML\OpenID\Federation\Factories\RequestObjectFactory; |
|
35 | 36 | use SimpleSAML\OpenID\Federation\Factories\TrustMarkFactory; |
36 | 37 | use SimpleSAML\OpenID\Federation\Factories\TrustMarkStatusResponseFactory; |
37 | 38 | use SimpleSAML\OpenID\Federation\FederationDiscovery; |
38 | | -use SimpleSAML\OpenID\Federation\InMemoryEntityCollectionStore; |
39 | 39 | use SimpleSAML\OpenID\Federation\MetadataPolicyApplicator; |
40 | 40 | use SimpleSAML\OpenID\Federation\MetadataPolicyResolver; |
41 | 41 | use SimpleSAML\OpenID\Federation\SubordinateListingFetcher; |
42 | 42 | use SimpleSAML\OpenID\Federation\TrustChainResolver; |
43 | 43 | use SimpleSAML\OpenID\Federation\TrustMarkFetcher; |
44 | 44 | use SimpleSAML\OpenID\Federation\TrustMarkStatusResponseFetcher; |
45 | 45 | use SimpleSAML\OpenID\Federation\TrustMarkValidator; |
46 | | -use SimpleSAML\OpenID\Helpers; |
47 | 46 | use SimpleSAML\OpenID\Jwks\Factories\JwksDecoratorFactory; |
48 | 47 | use SimpleSAML\OpenID\Jws\Factories\JwsDecoratorBuilderFactory; |
49 | 48 | use SimpleSAML\OpenID\Jws\Factories\JwsVerifierDecoratorFactory; |
@@ -85,7 +84,7 @@ class Federation |
85 | 84 |
|
86 | 85 | protected ?EntityCollectionPaginator $entityCollectionPaginator = null; |
87 | 86 |
|
88 | | - protected ?EntityCollectionBuilder $entityCollectionBuilder = null; |
| 87 | + protected ?EntityCollectionResponseFactory $entityCollectionBuilder = null; |
89 | 88 |
|
90 | 89 | protected ?EntityStatementFetcher $entityStatementFetcher = null; |
91 | 90 |
|
@@ -154,6 +153,7 @@ public function __construct( |
154 | 153 | // phpcs:ignore |
155 | 154 | protected readonly TrustMarkStatusEndpointUsagePolicyEnum $defaultTrustMarkStatusEndpointUsagePolicyEnum = TrustMarkStatusEndpointUsagePolicyEnum::NotUsed, |
156 | 155 | int $maxDiscoveryDepth = 10, |
| 156 | + protected ?EntityCollectionStoreInterface $entityCollectionStore = null, |
157 | 157 | ) { |
158 | 158 | $this->maxCacheDurationDecorator = $this->dateIntervalDecoratorFactory()->build($maxCacheDuration); |
159 | 159 | $this->timestampValidationLeewayDecorator = $this->dateIntervalDecoratorFactory() |
@@ -360,17 +360,30 @@ public function subordinateListingFetcher(): SubordinateListingFetcher |
360 | 360 | } |
361 | 361 |
|
362 | 362 |
|
363 | | - public function federationDiscovery(?EntityCollectionStoreInterface $store = null): FederationDiscovery |
| 363 | + public function entityCollectionStore(): EntityCollectionStoreInterface |
364 | 364 | { |
365 | | - if (!$this->federationDiscovery instanceof \SimpleSAML\OpenID\Federation\FederationDiscovery) { |
366 | | - $effectiveStore = $store ?? ($this->cacheDecorator() instanceof \SimpleSAML\OpenID\Decorators\CacheDecorator |
367 | | - ? new CacheEntityCollectionStore($this->cacheDecorator()) |
368 | | - : new InMemoryEntityCollectionStore()); |
| 365 | + if ($this->entityCollectionStore instanceof Federation\EntityCollection\EntityCollectionStoreInterface) { |
| 366 | + return $this->entityCollectionStore; |
| 367 | + } |
| 368 | + |
| 369 | + return $this->entityCollectionStore = |
| 370 | + $this->cacheDecorator() instanceof \SimpleSAML\OpenID\Decorators\CacheDecorator ? |
| 371 | + new CacheEntityCollectionStore( |
| 372 | + $this->cacheDecorator(), |
| 373 | + $this->helpers(), |
| 374 | + $this->logger, |
| 375 | + ) : |
| 376 | + new InMemoryEntityCollectionStore(); |
| 377 | + } |
| 378 | + |
369 | 379 |
|
| 380 | + public function federationDiscovery(): FederationDiscovery |
| 381 | + { |
| 382 | + if (!$this->federationDiscovery instanceof \SimpleSAML\OpenID\Federation\FederationDiscovery) { |
370 | 383 | $this->federationDiscovery = new FederationDiscovery( |
371 | 384 | $this->entityStatementFetcher(), |
372 | 385 | $this->subordinateListingFetcher(), |
373 | | - $effectiveStore, |
| 386 | + $this->entityCollectionStore(), |
374 | 387 | $this->maxCacheDurationDecorator(), |
375 | 388 | $this->logger, |
376 | 389 | $this->maxDiscoveryDepth, |
@@ -405,18 +418,16 @@ public function entityCollectionSorter(): EntityCollectionSorter |
405 | 418 |
|
406 | 419 | public function entityCollectionPaginator(): EntityCollectionPaginator |
407 | 420 | { |
408 | | - return $this->entityCollectionPaginator ??= new EntityCollectionPaginator(); |
| 421 | + return $this->entityCollectionPaginator ??= new EntityCollectionPaginator( |
| 422 | + $this->helpers(), |
| 423 | + ); |
409 | 424 | } |
410 | 425 |
|
411 | 426 |
|
412 | | - /** |
413 | | - * @param \SimpleSAML\OpenID\Federation\EntityCollectionStoreInterface|null $store Forwarded to |
414 | | - * federationDiscovery() |
415 | | - */ |
416 | | - public function entityCollectionBuilder(?EntityCollectionStoreInterface $store = null): EntityCollectionBuilder |
| 427 | + public function entityCollectionResponseFactory(): EntityCollectionResponseFactory |
417 | 428 | { |
418 | | - return $this->entityCollectionBuilder ??= new EntityCollectionBuilder( |
419 | | - $this->federationDiscovery($store), |
| 429 | + return $this->entityCollectionBuilder ??= new EntityCollectionResponseFactory( |
| 430 | + $this->federationDiscovery(), |
420 | 431 | $this->entityCollectionFilter(), |
421 | 432 | $this->entityCollectionSorter(), |
422 | 433 | $this->entityCollectionPaginator(), |
|
0 commit comments