| 1 |
<?php |
| 2 |
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure. |
| 3 |
|
| 4 |
namespace Yoast\WP\SEO\MyYoast_Client\Application\Ports; |
| 5 |
|
| 6 |
use Yoast\WP\SEO\MyYoast_Client\Application\Exceptions\Discovery_Failed_Exception; |
| 7 |
use Yoast\WP\SEO\MyYoast_Client\Application\Exceptions\ID_Token_Validation_Exception; |
| 8 |
use Yoast\WP\SEO\MyYoast_Client\Application\Exceptions\Server_Capability_Exception; |
| 9 |
|
| 10 |
/** |
| 11 |
* Port for OIDC ID token validation. |
| 12 |
*/ |
| 13 |
interface ID_Token_Validator_Interface { |
| 14 |
|
| 15 |
/** |
| 16 |
* Validates an ID token. |
| 17 |
* |
| 18 |
* @param string $id_token The raw ID token JWT. |
| 19 |
* @param string $client_id The expected client_id (audience). |
| 20 |
* @param string $expected_nonce The nonce sent in the authorization request. |
| 21 |
* |
| 22 |
* @return array<string, string|int|array<string>> The validated ID token payload (claims). |
| 23 |
* |
| 24 |
* @throws ID_Token_Validation_Exception If validation fails. |
| 25 |
* @throws Discovery_Failed_Exception If the discovery document cannot be fetched. |
| 26 |
* @throws Server_Capability_Exception If the server lacks required capabilities. |
| 27 |
*/ |
| 28 |
public function validate( string $id_token, string $client_id, string $expected_nonce ): array; |
| 29 |
} |
| 30 |
|