1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * This file is part of the Nexus MCP SDK package.
7: *
8: * (c) 2026 John Paul E. Balandan, CPA <paulbalandan@gmail.com>
9: *
10: * For the full copyright and license information, please view
11: * the LICENSE file that was distributed with this source code.
12: */
13:
14: namespace Nexus\Mcp\Client\Auth;
15:
16: use Amp\Cancellation;
17:
18: /**
19: * The one leg of the OAuth flow the SDK cannot perform: putting the authorization URL in front of a
20: * resource owner and collecting the redirect the user-agent lands on.
21: *
22: * The SDK owns PKCE, the `state` value, the expected issuer, the URL it builds, and every validation of the
23: * response. An implementation only has to open `$redirect->url` and return where the user-agent ended up.
24: */
25: interface UserAuthorizationInterface
26: {
27: /**
28: * Reports the redirect URI the user-agent arrived at once the resource owner has answered.
29: *
30: * The implementation yields to the event loop while it waits rather than blocking it, and gives up when
31: * `$cancellation` fires, which happens when the request that needs the token is abandoned.
32: */
33: public function authorize(AuthorizationRedirect $redirect, Cancellation $cancellation): AuthorizationCallback;
34: }
35: