1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace erasys\OpenApi\Spec\v3; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key |
7
|
|
|
* (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access |
8
|
|
|
* code) as defined in RFC6749, and OpenID Connect Discovery. |
9
|
|
|
* |
10
|
|
|
* @see https://swagger.io/specification/#securitySchemeObject |
11
|
|
|
* @see https://tools.ietf.org/html/rfc6749 |
12
|
|
|
* @see https://tools.ietf.org/html/draft-ietf-oauth-discovery-06 |
13
|
|
|
*/ |
14
|
|
|
class SecurityScheme extends AbstractObject implements ExtensibleInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect". |
18
|
|
|
* |
19
|
|
|
* Applies To: all |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
public $type; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* A short description for security scheme. CommonMark syntax MAY be used for rich text representation. |
27
|
|
|
* |
28
|
|
|
* Applies To: all |
29
|
|
|
* |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
public $description; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* REQUIRED. The name of the header, query or cookie parameter to be used. |
36
|
|
|
* |
37
|
|
|
* Applies To: apiKey |
38
|
|
|
* |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
public $name; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". |
45
|
|
|
* |
46
|
|
|
* Applies To: apiKey |
47
|
|
|
* |
48
|
|
|
* @var string |
49
|
|
|
*/ |
50
|
|
|
public $in; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235. |
54
|
|
|
* |
55
|
|
|
* Applies To: http |
56
|
|
|
* |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
public $scheme; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an |
63
|
|
|
* authorization server, so this information is primarily for documentation purposes. |
64
|
|
|
* |
65
|
|
|
* Applies To: http ("bearer") |
66
|
|
|
* |
67
|
|
|
* @var string |
68
|
|
|
*/ |
69
|
|
|
public $bearerFormat; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* REQUIRED. An object containing configuration information for the flow types supported. |
73
|
|
|
* |
74
|
|
|
* Applies To: oauth2 |
75
|
|
|
* |
76
|
|
|
* @var OauthFlows |
77
|
|
|
*/ |
78
|
|
|
public $flows; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. |
82
|
|
|
* |
83
|
|
|
* Applies To: openIdConnect |
84
|
|
|
* |
85
|
|
|
* @var string |
86
|
|
|
*/ |
87
|
|
|
public $openIdConnectUrl; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @param string $type |
91
|
|
|
* @param string|null $description |
92
|
|
|
* @param array $additionalProperties |
93
|
|
|
*/ |
94
|
6 |
|
public function __construct(string $type, string $description = null, array $additionalProperties = []) |
95
|
|
|
{ |
96
|
6 |
|
parent::__construct($additionalProperties); |
97
|
6 |
|
$this->type = $type; |
98
|
6 |
|
$this->description = $description; |
99
|
6 |
|
} |
100
|
|
|
} |
101
|
|
|
|