← All changes
|
src/myyoast-client/application/ports/client-registration-interface.php
+31
-15
28.0
→
trunk
View file →
| @@ -11,17 +11,20 @@ | ||
| 11 | 11 | */ |
| 12 | 12 | interface Client_Registration_Interface { |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * Ensures the plugin is registered, performing DCR if needed. | |
| 15 | + * Ensures the registration's redirect URIs exactly match the given set. | |
| 16 | 16 | * |
| 17 | - * @param string[] $redirect_uris The OAuth redirect URIs to register with. | |
| 17 | + * Performs DCR when not yet registered; when registered with a different set, updates the | |
| 18 | + * registration in place via RFC 7592 (preserving the client_id) rather than re-registering. | |
| 18 | 19 | * |
| 20 | + * @param string[] $redirect_uris The exact set of OAuth redirect URIs the registration should have. | |
| 21 | + * | |
| 19 | 22 | * @return Registered_Client The client credentials. |
| 20 | 23 | * |
| 21 | 24 | * @throws Registration_Failed_Exception If registration fails. |
| 22 | 25 | */ |
| 23 | - public function ensure_registered( array $redirect_uris = [] ): Registered_Client; | |
| 26 | + public function ensure_registered( array $redirect_uris ): Registered_Client; | |
| 24 | 27 | |
| 25 | 28 | /** |
| 26 | 29 | * Returns the stored registered client, or null if not registered. |
| 27 | 30 | * |
| @@ -29,20 +32,8 @@ | ||
| 29 | 32 | */ |
| 30 | 33 | public function get_registered_client(): ?Registered_Client; |
| 31 | 34 | |
| 32 | 35 | /** |
| 33 | - * Whether the plugin is registered as an OAuth client. | |
| 34 | - * | |
| 35 | - * When redirect URIs are provided, also verifies that all of them | |
| 36 | - * are included in the stored registration. | |
| 37 | - * | |
| 38 | - * @param string[] $redirect_uris Optional redirect URIs to verify against the stored registration. | |
| 39 | - * | |
| 40 | - * @return bool | |
| 41 | - */ | |
| 42 | - public function is_registered( array $redirect_uris = [] ): bool; | |
| 43 | - | |
| 44 | - /** | |
| 45 | 36 | * Reads the current client registration from the server. |
| 46 | 37 | * |
| 47 | 38 | * @return array<string, string|string[]> The registration metadata. |
| 48 | 39 | * |
| @@ -78,5 +69,30 @@ | ||
| 78 | 69 | * |
| 79 | 70 | * @return void |
| 80 | 71 | */ |
| 81 | 72 | public function rotate_dpop_keys(): void; |
| 73 | + | |
| 74 | + /** | |
| 75 | + * Whether the given redirect URI has completed the OAuth authorization-code flow on this site. | |
| 76 | + * | |
| 77 | + * Per-URI verification state lives on the stored registration. It is pruned to the current | |
| 78 | + * redirect-URI set whenever the registration's redirect URIs change, and reset when the | |
| 79 | + * registration is forgotten (deregister or full local-data wipe). | |
| 80 | + * | |
| 81 | + * @param string $redirect_uri The redirect URI to check. | |
| 82 | + * | |
| 83 | + * @return bool | |
| 84 | + */ | |
| 85 | + public function is_uri_validated( string $redirect_uri ): bool; | |
| 86 | + | |
| 87 | + /** | |
| 88 | + * Records that the given redirect URI has completed the authorization-code flow. | |
| 89 | + * | |
| 90 | + * Called by the authorization-code handler on every successful exchange; idempotent and a no-op | |
| 91 | + * when the site is not registered. | |
| 92 | + * | |
| 93 | + * @param string $redirect_uri The redirect URI that completed the auth-code flow. | |
| 94 | + * | |
| 95 | + * @return void | |
| 96 | + */ | |
| 97 | + public function mark_uri_validated( string $redirect_uri ): void; | |
| 82 | 98 | } |