|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* It's free open-source software released under the MIT License. |
|
5
|
|
|
* |
|
6
|
|
|
* @author Anatoly Fenric <[email protected]> |
|
7
|
|
|
* @copyright Copyright (c) 2018, Anatoly Fenric |
|
8
|
|
|
* @license https://github.com/sunrise-php/http-router/blob/master/LICENSE |
|
9
|
|
|
* @link https://github.com/sunrise-php/http-router |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Sunrise\Http\Router\OpenApi; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* OAS OAuth Flow Object |
|
16
|
|
|
* |
|
17
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#oauth-flow-object |
|
18
|
|
|
*/ |
|
19
|
|
|
class OAuthFlow extends AbstractObject |
|
20
|
|
|
{ |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var string |
|
24
|
|
|
* |
|
25
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-oauthflowauthorizationurl |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $authorizationUrl; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* @var string |
|
31
|
|
|
* |
|
32
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-oauthflowtokenurl |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $tokenUrl; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
* |
|
39
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-oauthflowrefreshurl |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $refreshUrl; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var string[] |
|
45
|
|
|
* |
|
46
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-oauthflowscopes |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $scopes; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @param string $authorizationUrl |
|
52
|
|
|
* |
|
53
|
|
|
* @return void |
|
54
|
|
|
*/ |
|
55
|
|
|
public function setAuthorizationUrl(string $authorizationUrl) : void |
|
56
|
|
|
{ |
|
57
|
|
|
$this->authorizationUrl = $authorizationUrl; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param string $tokenUrl |
|
62
|
|
|
* |
|
63
|
|
|
* @return void |
|
64
|
|
|
*/ |
|
65
|
|
|
public function setTokenUrl(string $tokenUrl) : void |
|
66
|
|
|
{ |
|
67
|
|
|
$this->tokenUrl = $tokenUrl; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param string $refreshUrl |
|
72
|
|
|
* |
|
73
|
|
|
* @return void |
|
74
|
|
|
*/ |
|
75
|
|
|
public function setRefreshUrl(string $refreshUrl) : void |
|
76
|
|
|
{ |
|
77
|
|
|
$this->refreshUrl = $refreshUrl; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param string $name |
|
82
|
|
|
* @param string $description |
|
83
|
|
|
* |
|
84
|
|
|
* @return void |
|
85
|
|
|
*/ |
|
86
|
|
|
public function addScope(string $name, string $description) : void |
|
87
|
|
|
{ |
|
88
|
|
|
$this->scopes[$name] = $description; |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|