Package org.apache.juneau.bean.openapi3
Class SecurityRequirement
java.lang.Object
org.apache.juneau.bean.openapi3.OpenApiElement
org.apache.juneau.bean.openapi3.SecurityRequirement
Lists the required security schemes for this operation.
See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.SecurityRequirement
(SecurityRequirement copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionaddRequirement
(String schemeName, String... scopes) Adds a security requirement.copy()
Makes a copy of this object.<T> T
Generic property getter.Returns the security requirements map.keySet()
Returns all the keys on this element.Generic property setter.setApiKeyAuth
(String schemeName) Adds a security requirement for a scheme that doesn't use scopes.setRequirements
(Map<String, List<String>> value) Sets the security requirements map.strict()
Sets strict mode on this bean.Sets strict mode on this bean.
-
Constructor Details
-
SecurityRequirement
public SecurityRequirement()Default constructor. -
SecurityRequirement
Copy constructor.- Parameters:
copyFrom
- The object to copy.
-
-
Method Details
-
copy
Makes a copy of this object.- Returns:
- A new copy of this object.
-
getRequirements
Returns the security requirements map.- Returns:
- The security requirements map.
-
setRequirements
Sets the security requirements map.- Parameters:
value
- The new value for this property.- Returns:
- This object.
-
addRequirement
Adds a security requirement.- Parameters:
schemeName
- The security scheme name. Must not benull .scopes
- The required scopes. Must not benull .- Returns:
- This object.
-
setApiKeyAuth
Adds a security requirement for a scheme that doesn't use scopes.This is a convenience method for adding security schemes that don't use scopes, such as API keys, HTTP Basic authentication, or HTTP Bearer tokens. According to the OpenAPI specification, security schemes that don't use scopes should have an empty array as the value.
This method is equivalent to calling
addRequirement(schemeName) with no scopes.Example:
// Add API key authentication requirement SecurityRequirementrequirement =new SecurityRequirement() .setApiKeyAuth("api_key" );// Results in: { "api_key": [] } See Also:
- Parameters:
schemeName
- The security scheme name. Must not benull .- Returns:
- This object.
-
get
Description copied from class:OpenApiElement
Generic property getter.Can be used to retrieve non-standard Swagger fields such as
"$ref" .- Overrides:
get
in classOpenApiElement
- Type Parameters:
T
- The datatype to cast the value to.- Parameters:
property
- The property name to retrieve.type
- The datatype to cast the value to.- Returns:
- The property value, or
null if the property does not exist or is not set.
-
set
Description copied from class:OpenApiElement
Generic property setter.Can be used to set non-standard Swagger fields such as
"$ref" .- Overrides:
set
in classOpenApiElement
- Parameters:
property
- The property name to set. Must not benull .value
- The new value for the property.- Returns:
- This object
-
keySet
Description copied from class:OpenApiElement
Returns all the keys on this element.- Overrides:
keySet
in classOpenApiElement
- Returns:
- All the keys on this element.
Nevernull .
-
strict
Description copied from class:OpenApiElement
Sets strict mode on this bean.- Overrides:
strict
in classOpenApiElement
- Returns:
- This object
-
strict
Description copied from class:OpenApiElement
Sets strict mode on this bean.- Overrides:
strict
in classOpenApiElement
- Parameters:
value
- The new value for this property.
Non-boolean values will be converted to boolean usingBoolean.
.valueOf (value.toString())
Can benull (interpreted asfalse ).- Returns:
- This object
-