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 Security Scheme Object |
16
|
|
|
* |
17
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#security-scheme-object |
18
|
|
|
*/ |
19
|
|
|
class SecurityScheme 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-securityschemetype |
26
|
|
|
*/ |
27
|
|
|
protected $type; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
* |
32
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-securityschemedescription |
33
|
|
|
*/ |
34
|
|
|
protected $description; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
* |
39
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-securityschemename |
40
|
|
|
*/ |
41
|
|
|
protected $name; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
* |
46
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-securityschemein |
47
|
|
|
*/ |
48
|
|
|
protected $in; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var string |
52
|
|
|
* |
53
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-securityschemescheme |
54
|
|
|
*/ |
55
|
|
|
protected $scheme; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var string |
59
|
|
|
* |
60
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-securityschemebearerformat |
61
|
|
|
*/ |
62
|
|
|
protected $bearerFormat; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var OAuthFlows |
66
|
|
|
* |
67
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-securityschemeflows |
68
|
|
|
*/ |
69
|
|
|
protected $flows; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var string |
73
|
|
|
* |
74
|
|
|
* @link https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-securityschemeopenidconnecturl |
75
|
|
|
*/ |
76
|
|
|
protected $openIdConnectUrl; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param string $type |
80
|
|
|
*/ |
81
|
|
|
public function __construct(string $type) |
82
|
|
|
{ |
83
|
|
|
$this->type = $type; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param string $description |
88
|
|
|
* |
89
|
|
|
* @return void |
90
|
|
|
*/ |
91
|
|
|
public function setDescription(string $description) : void |
92
|
|
|
{ |
93
|
|
|
$this->description = $description; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @param string $name |
98
|
|
|
* |
99
|
|
|
* @return void |
100
|
|
|
*/ |
101
|
|
|
public function setName(string $name) : void |
102
|
|
|
{ |
103
|
|
|
$this->name = $name; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @param string $in |
108
|
|
|
* |
109
|
|
|
* @return void |
110
|
|
|
*/ |
111
|
|
|
public function setIn(string $in) : void |
112
|
|
|
{ |
113
|
|
|
$this->in = $in; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param string $scheme |
118
|
|
|
* |
119
|
|
|
* @return void |
120
|
|
|
*/ |
121
|
|
|
public function setScheme(string $scheme) : void |
122
|
|
|
{ |
123
|
|
|
$this->scheme = $scheme; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param string $bearerFormat |
128
|
|
|
* |
129
|
|
|
* @return void |
130
|
|
|
*/ |
131
|
|
|
public function setBearerFormat(string $bearerFormat) : void |
132
|
|
|
{ |
133
|
|
|
$this->bearerFormat = $bearerFormat; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param OAuthFlows $flows |
138
|
|
|
* |
139
|
|
|
* @return void |
140
|
|
|
*/ |
141
|
|
|
public function setFlows(OAuthFlows $flows) : void |
142
|
|
|
{ |
143
|
|
|
$this->flows = $flows; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param string $openIdConnectUrl |
148
|
|
|
* |
149
|
|
|
* @return void |
150
|
|
|
*/ |
151
|
|
|
public function setOpenIdConnectUrl(string $openIdConnectUrl) : void |
152
|
|
|
{ |
153
|
|
|
$this->openIdConnectUrl = $openIdConnectUrl; |
154
|
|
|
} |
155
|
|
|
} |
156
|
|
|
|