1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* The MIT License (MIT) |
7
|
|
|
* |
8
|
|
|
* Copyright (c) 2014-2018 Spomky-Labs |
9
|
|
|
* |
10
|
|
|
* This software may be modified and distributed under the terms |
11
|
|
|
* of the MIT license. See the LICENSE file for details. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace OAuth2Framework\Component\Core\Client; |
15
|
|
|
|
16
|
|
|
use OAuth2Framework\Component\Core\DataBag\DataBag; |
17
|
|
|
use OAuth2Framework\Component\Core\ResourceOwner\ResourceOwner; |
18
|
|
|
use OAuth2Framework\Component\Core\ResourceOwner\ResourceOwnerId; |
19
|
|
|
use OAuth2Framework\Component\Core\UserAccount\UserAccountId; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* This interface is used for every client types. |
23
|
|
|
* A client is a resource owner with a set of allowed grant types and can perform requests against |
24
|
|
|
* available endpoints. |
25
|
|
|
*/ |
26
|
|
|
interface Client extends ResourceOwner, \JsonSerializable |
27
|
|
|
{ |
28
|
|
|
public function getClientId(): ClientId; |
29
|
|
|
|
30
|
|
|
public function getOwnerId(): ?UserAccountId; |
|
|
|
|
31
|
|
|
|
32
|
|
|
public function setParameter(DataBag $parameter): void; |
|
|
|
|
33
|
|
|
|
34
|
|
|
public function markAsDeleted(): void; |
|
|
|
|
35
|
|
|
|
36
|
|
|
public function isDeleted(): bool; |
37
|
|
|
|
38
|
|
|
public function isGrantTypeAllowed(string $grant_type): bool; |
39
|
|
|
|
40
|
|
|
public function isResponseTypeAllowed(string $response_type): bool; |
41
|
|
|
|
42
|
|
|
public function isPublic(): bool; |
43
|
|
|
|
44
|
|
|
public function getTokenEndpointAuthenticationMethod(): string; |
45
|
|
|
|
46
|
|
|
public function getClientCredentialsExpiresAt(): int; |
47
|
|
|
|
48
|
|
|
public function areClientCredentialsExpired(): bool; |
49
|
|
|
|
50
|
|
|
public function getPublicId(): ResourceOwnerId; |
51
|
|
|
|
52
|
|
|
public function has(string $key): bool; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return mixed|null |
56
|
|
|
*/ |
57
|
|
|
public function get(string $key); |
58
|
|
|
|
59
|
|
|
public function all(): array; |
60
|
|
|
} |
61
|
|
|
|
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.