| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Facile\OpenIDClient\Token; |
| 6 | |
| 7 | /** |
| 8 | * @psalm-api |
| 9 | * |
| 10 | * @psalm-type ClaimSourceAggregateType = array{}&array{JWT: string} |
| 11 | * @psalm-type ClaimSourceDistributedType = array{}&array{endpoint: string, access_token?: string} |
| 12 | * @psalm-type ClaimSourceType = ClaimSourceAggregateType|ClaimSourceDistributedType |
| 13 | * @psalm-type AddressClaimType = array{}&array{ |
| 14 | * formatted?: string, |
| 15 | * street_address?: string, |
| 16 | * locality?: string, |
| 17 | * region?: string, |
| 18 | * postal_code?: string, |
| 19 | * country?: string, |
| 20 | * } |
| 21 | * @psalm-type TokenSetClaimsType = array{}&array{ |
| 22 | * sub?: string, |
| 23 | * name?: string, |
| 24 | * given_name?: string, |
| 25 | * family_name?: string, |
| 26 | * middle_name?: string, |
| 27 | * nickname?: string, |
| 28 | * preferred_username?: string, |
| 29 | * profile?: string, |
| 30 | * picture?: string, |
| 31 | * website?: string, |
| 32 | * email?: string, |
| 33 | * email_verified?: bool, |
| 34 | * gender?: string, |
| 35 | * birthdate?: string, |
| 36 | * zoneinfo?: string, |
| 37 | * locale?: string, |
| 38 | * phone_number?: string, |
| 39 | * phone_number_verified?: bool, |
| 40 | * address?: AddressClaimType, |
| 41 | * updated_at?: int, |
| 42 | * _claim_names?: array<string, string>, |
| 43 | * _claim_sources?: array<string, ClaimSourceType>, |
| 44 | * } |
| 45 | * @psalm-type TokenSetAttributesType = array{}&array{ |
| 46 | * code?: string, |
| 47 | * access_token?: string, |
| 48 | * id_token?: string, |
| 49 | * token_type?: string, |
| 50 | * refresh_token?: string, |
| 51 | * expires_in?: int, |
| 52 | * state?: string, |
| 53 | * code_verifier?: string, |
| 54 | * } |
| 55 | * @psalm-type TokenSetType = array{}&array{code?: string, state?: string, token_type?: string, access_token?: string, id_token?: string, refresh_token?: string, expires_in?: int, code_verifier?: string} |
| 56 | * @psalm-type TokenSetMixedType = TokenSetAttributesType&array{claims?: TokenSetClaimsType} |
| 57 | */ |
| 58 | interface TokenSetInterface |
| 59 | { |
| 60 | /** |
| 61 | * Get all attributes. |
| 62 | * |
| 63 | * @return array<string, mixed> |
| 64 | * |
| 65 | * @psalm-return TokenSetAttributesType |
| 66 | */ |
| 67 | public function getAttributes(): array; |
| 68 | |
| 69 | public function getTokenType(): ?string; |
| 70 | |
| 71 | public function getAccessToken(): ?string; |
| 72 | |
| 73 | public function getIdToken(): ?string; |
| 74 | |
| 75 | public function getRefreshToken(): ?string; |
| 76 | |
| 77 | public function getExpiresIn(): ?int; |
| 78 | |
| 79 | public function getCodeVerifier(): ?string; |
| 80 | |
| 81 | public function getCode(): ?string; |
| 82 | |
| 83 | public function getState(): ?string; |
| 84 | |
| 85 | /** |
| 86 | * @return array<string, mixed> |
| 87 | * |
| 88 | * @psalm-return TokenSetClaimsType |
| 89 | */ |
| 90 | public function claims(): array; |
| 91 | |
| 92 | public function withIdToken(string $idToken): self; |
| 93 | |
| 94 | /** |
| 95 | * @param array<string, mixed> $claims |
| 96 | * |
| 97 | * @psalm-param TokenSetClaimsType $claims |
| 98 | * |
| 99 | * @return $this |
| 100 | */ |
| 101 | public function withClaims(array $claims): self; |
| 102 | } |