| 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: | /** |
| 17: | * A bearer access token an authorization server issued for one MCP server. |
| 18: | * |
| 19: | * @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.1 |
| 20: | */ |
| 21: | final readonly class AccessToken |
| 22: | { |
| 23: | /** |
| 24: | * @param string $value The `access_token` value sent in the `Authorization` header |
| 25: | * @param string $issuer Issuer identifier of the authorization server that minted it |
| 26: | * @param null|int $expiresAt Unix timestamp the token expires at, or `null` when the server named no lifetime |
| 27: | * @param null|string $refreshToken The `refresh_token`, when the server issued one |
| 28: | * @param list<non-empty-string> $scopes Scopes the token was granted |
| 29: | */ |
| 30: | public function __construct( |
| 31: | public string $value, |
| 32: | public string $issuer, |
| 33: | public ?int $expiresAt = null, |
| 34: | public ?string $refreshToken = null, |
| 35: | public array $scopes = [], |
| 36: | ) { |
| 37: | } |
| 38: | } |
| 39: |