1: <?php declare(strict_types=1);
2:
3: namespace Salient\Http\OAuth2;
4:
5: use Salient\Http\GenericToken;
6:
7: /**
8: * @api
9: */
10: class OAuth2AccessToken extends GenericToken
11: {
12: /** @var string[] */
13: private array $Scopes;
14: /** @var array<string,mixed> */
15: private array $Claims;
16:
17: /**
18: * @api
19: *
20: * @param string[] $scopes
21: * @param array<string,mixed> $claims
22: */
23: public function __construct(
24: string $token,
25: $expires = null,
26: array $scopes = [],
27: array $claims = []
28: ) {
29: $this->Scopes = $scopes;
30: $this->Claims = $claims;
31:
32: parent::__construct($token, 'Bearer', $expires);
33: }
34:
35: /**
36: * Get the token's scopes
37: *
38: * @return string[]
39: */
40: public function getScopes(): array
41: {
42: return $this->Scopes;
43: }
44:
45: /**
46: * Get the token's claims
47: *
48: * @return array<string,mixed>
49: */
50: public function getClaims(): array
51: {
52: return $this->Claims;
53: }
54: }
55: