‪TYPO3CMS  ‪main
SigningSecretResolver.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
26 {
30  protected array ‪$providers;
31 
32  public function ‪__construct(array ‪$providers)
33  {
34  $this->providers = array_filter(
36  static fn($provider) => $provider instanceof ‪SigningProviderInterface
37  );
38  }
39 
43  public function ‪findByType(string $type): ?‪SigningProviderInterface
44  {
45  return $this->providers[$type] ?? null;
46  }
47 
52  public function ‪findByIdentifier(SecretIdentifier ‪$identifier): ?‪SigningSecretInterface
53  {
54  if (!isset($this->providers[‪$identifier->type])) {
55  return null;
56  }
57  return $this->providers[‪$identifier->type]->findSigningSecret(‪$identifier->name);
58  }
59 
63  public function ‪revokeIdentifier(SecretIdentifier ‪$identifier): void
64  {
65  if (!isset($this->providers[‪$identifier->type])) {
66  return;
67  }
68  $this->providers[‪$identifier->type]->revokeSigningSecret(‪$identifier->name);
69  }
70 }
‪TYPO3\CMS\Core\Security\SigningSecretResolver
Definition: SigningSecretResolver.php:26
‪TYPO3\CMS\Core\Security\SigningSecretResolver\__construct
‪__construct(array $providers)
Definition: SigningSecretResolver.php:32
‪TYPO3\CMS\Core\Security\SigningSecretInterface
Definition: SigningSecretInterface.php:26
‪TYPO3\CMS\Core\Security\SigningSecretResolver\$providers
‪array $providers
Definition: SigningSecretResolver.php:30
‪TYPO3\CMS\Core\Security\SigningSecretResolver\findByIdentifier
‪findByIdentifier(SecretIdentifier $identifier)
Definition: SigningSecretResolver.php:52
‪TYPO3\CMS\Core\Security\SigningProviderInterface
Definition: SigningProviderInterface.php:24
‪TYPO3\CMS\Core\Security\SigningSecretResolver\findByType
‪findByType(string $type)
Definition: SigningSecretResolver.php:43
‪TYPO3\CMS\Core\Security\SigningSecretResolver\revokeIdentifier
‪revokeIdentifier(SecretIdentifier $identifier)
Definition: SigningSecretResolver.php:63
‪TYPO3\CMS\Core\Security
Definition: BlockSerializationTrait.php:18
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37