/
SecurityScheme.java
397 lines (361 loc) · 12.8 KB
/
SecurityScheme.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
/**
* Copyright (c) 2017 Contributors to the Eclipse Foundation
* Copyright 2017 SmartBear Software
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.eclipse.microprofile.openapi.models.security;
import org.eclipse.microprofile.openapi.models.Constructible;
import org.eclipse.microprofile.openapi.models.Extensible;
import org.eclipse.microprofile.openapi.models.Reference;
/**
* SecurityScheme
*
* @see "https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#security-scheme-object"
*/
public interface SecurityScheme extends Constructible, Extensible<SecurityScheme>, Reference<SecurityScheme> {
/**
* Type is a REQUIRED property that specifies the type of SecurityScheme instance.
* <p>
* This class is used in getType and setType to get or set the type of SecurityScheme object to one of the valid
* values.
* </p>
*/
public enum Type {
APIKEY("apiKey"), HTTP("http"), OAUTH2("oauth2"), OPENIDCONNECT("openIdConnect");
private final String value;
Type(String value) {
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
/**
* In is a REQUIRED property that specifies the location of the API key.
* <p>
* This class is used in getIn and setIn to get or set the in of SecurityScheme object to one of the enum constants
* listed.
* </p>
*/
public enum In {
COOKIE("cookie"), HEADER("header"), QUERY("query");
private final String value;
In(String value) {
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
}
/**
* Type is a REQUIRED property that specifies the type of SecurityScheme instance.
* <p>
* This method returns the type property from SecurityScheme instance.
* </p>
*
* @return Type type
**/
SecurityScheme.Type getType();
/**
* Type is a REQUIRED property that specifies the type of SecurityScheme instance.
* <p>
* This method sets the type property of SecurityScheme instance to the given Type argument.
* </p>
*
* @param type
* the type of SecurityScheme instance
*/
void setType(SecurityScheme.Type type);
/**
* Type is a REQUIRED property that specifies the type of SecurityScheme instance.
* <p>
* This method sets the type property of SecurityScheme instance to the given Type argument and returns the modified
* instance.
* </p>
*
* @param type
* the type of SecurityScheme instance
* @return SecurityScheme instance with the set type property
*/
default SecurityScheme type(SecurityScheme.Type type) {
setType(type);
return this;
}
/**
* A short description for security schema.
* <p>
* This method returns the description property from SecurityScheme instance.
* </p>
*
* @return String description
**/
String getDescription();
/**
* A short description for security schema.
* <p>
* This method sets the description property of SecurityScheme instance.
* </p>
*
* @param description
* short description of the SecuirtyScheme instance
*/
void setDescription(String description);
/**
* A short description for security schema.
* <p>
* This method sets the description property of SecurityScheme instance and returns the modified instance.
* </p>
*
* @param description
* short description of the SecuirtyScheme instance
* @return SecurityScheme instance with the set description property
*/
default SecurityScheme description(String description) {
setDescription(description);
return this;
}
/**
* Name is a REQUIRED property - this is the name of the header, query or cookie parameter to be used.
* <p>
* This method returns the name property from SecurityScheme instance.
* </p>
*
* @return String name
**/
String getName();
/**
* Name is a REQUIRED property - this is the name of the header, query or cookie parameter to be used.
* <p>
* This method sets the name property of SecurityScheme instance to the parameter.
* </p>
*
* @param name
* the name of the header, query or cookie parameter to be used
*/
void setName(String name);
/**
* Name is a REQUIRED property - this is the name of the header, query or cookie parameter to be used.
* <p>
* This method sets the name property of SecurityScheme instance to the given String argument and returns the
* modified instance.
* </p>
*
* @param name
* the name of the header, query or cookie parameter to be used
* @return SecurityScheme instance with the set name property
*/
default SecurityScheme name(String name) {
setName(name);
return this;
}
/**
* In is a REQUIRED property that indicates the location of the API key. Valid values are "query", "header",
* "cookie".
* <p>
* This method returns the in property from SecurityScheme instance.
* </p>
*
* @return In in
**/
SecurityScheme.In getIn();
/**
* In is a REQUIRED property that indicates the location of the API key. Valid values are "query", "header",
* "cookie".
* <p>
* The method sets the in property of SecurityScheme instance to the given In argument.
* </p>
*
* @param in
* the location of the API key
*/
void setIn(SecurityScheme.In in);
/**
* In is a REQUIRED property that indicates the location of the API key. Valid values are "query", "header",
* "cookie".
* <p>
* This method sets the in property of SecurityScheme instance to the given In argument and returns the modified
* instance.
* </p>
*
* @param in
* the location of the API key
* @return SecurityScheme instance with the set in property
*/
default SecurityScheme in(SecurityScheme.In in) {
setIn(in);
return this;
}
/**
* Schema is a REQUIRED property that is the name of the HTTP Authorization scheme to be used in the Authorization
* header as defined in RFC7235.
* <p>
* This method returns the scheme property from SecurityScheme instance.
* </p>
*
* @return String scheme
**/
String getScheme();
/**
* Schema is a REQUIRED property that is the name of the HTTP Authorization scheme to be used in the Authorization
* header as defined in RFC7235.
* <p>
* This method sets the scheme property of SecurityScheme instance to the given String argument.
* </p>
*
* @param scheme
* the name of the HTTP Authorization scheme to be used in the Authorization header
*/
void setScheme(String scheme);
/**
* Schema is a REQUIRED property that is the name of the HTTP Authorization scheme to be used in the Authorization
* header as defined in RFC7235.
* <p>
* This method sets the scheme property of SecurityScheme instance to the given String argument and returns the
* modified instance.
* </p>
*
* @param scheme
* the name of the HTTP Authorization scheme to be used in the Authorization header
* @return SecurityScheme instance with the set scheme property
*/
default SecurityScheme scheme(String scheme) {
setScheme(scheme);
return this;
}
/**
* bearerFormat is intended as a hint to the client to identify how the bearer token is formatted. Bearer tokens are
* usually generated by an authorization server, so this information is primarily for documentation purposes.
* <p>
* This method returns the bearerFormat property from SecurityScheme instance.
* </p>
*
* @return String bearerFormat
**/
String getBearerFormat();
/**
* bearerFormat is intended as a hint to the client to identify how the bearer token is formatted. Bearer tokens are
* usually generated by an authorization server, so this information is primarily for documentation purposes.
* <p>
* This method sets the bearerFormat property of SecurityScheme instance to the given String argument.
* </p>
*
* @param bearerFormat
* a hint to the client to identify how the bearer token is formatted
*/
void setBearerFormat(String bearerFormat);
/**
* bearerFormat is intended as a hint to the client to identify how the bearer token is formatted. Bearer tokens are
* usually generated by an authorization server, so this information is primarily for documentation purposes.
* <p>
* This method sets the bearerFormat property of SecurityScheme instance to the given String argument and returns
* the modified instance.
* </p>
*
* @param bearerFormat
* a hint to the client to identify how the bearer token is formatted
* @return SecurityScheme instance with the set bearerFormat property
*/
default SecurityScheme bearerFormat(String bearerFormat) {
setBearerFormat(bearerFormat);
return this;
}
/**
* Flows is a REQUIRED property.
* <p>
* Flows is an object containing configuration information for the flow types supported.
* </p>
* <p>
* This method returns the flows property from SecurityScheme instance.
* </p>
*
* @return OAuthFlows flows
**/
OAuthFlows getFlows();
/**
* Flows is a REQUIRED property.
* <p>
* Flows is an object containing configuration information for the flow types supported.
* </p>
* <p>
* This method sets the flows property of SecurityScheme instance to the given OAuthFlows argument.
* </p>
*
* @param flows
* an object containing configuration information for the flow types supported
*/
void setFlows(OAuthFlows flows);
/**
* Flows is a REQUIRED property.
* <p>
* Flows is an object containing configuration information for the flow types supported.
* </p>
* <p>
* This method sets the flows property of SecurityScheme instance to the given OAuthFlows argument and returns the
* modified instance.
* </p>
*
* @param flows
* an object containing configuration information for the flow types supported
* @return SecurityScheme instance with the set flows property
*/
default SecurityScheme flows(OAuthFlows flows) {
setFlows(flows);
return this;
}
/**
* openIdConnectUrl is a REQUIRED property.
* <p>
* This property allows to discover OAuth2 configuration values. openIdConnectUrl MUST be in a form of a URL.
* </p>
* <p>
* This method returns the openIdConnectUrl property from SecurityScheme instance.
* </p>
*
* @return String openIdConnectUrl
**/
String getOpenIdConnectUrl();
/**
* openIdConnectUrl is a REQUIRED property.
* <p>
* This property allows to discover OAuth2 configuration values. openIdConnectUrl MUST be in a form of a URL.
* </p>
* <p>
* This method sets the openIdConnectUrl property of a SecurityScheme instance to the given String argument.
* </p>
*
* @param openIdConnectUrl
* a URL where OAuth2 configuration values are stored
*/
void setOpenIdConnectUrl(String openIdConnectUrl);
/**
* penIdConnectUrl is a REQUIRED property.
* <p>
* This property allows to discover OAuth2 configuration values. openIdConnectUrl MUST be in a form of a URL.
* </p>
* <p>
* This method sets the openIdConnectUrl property of SecurityScheme instance to the given String argument and
* returns the modified instance.
* </p>
*
* @param openIdConnectUrl
* a URL where OAuth2 configuration values are stored
* @return SecurityScheme instance with the set openIdConnectUrl property
*/
default SecurityScheme openIdConnectUrl(String openIdConnectUrl) {
setOpenIdConnectUrl(openIdConnectUrl);
return this;
}
}