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> TGeneric 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
-
addRequirement
Adds a security requirement.- Parameters:
schemeName- The security scheme name. Must not benull .scopes- The required scopes. Must not benull .- Returns:
- This object.
-
copy
Makes a copy of this object.- Returns:
- A new copy of this object.
-
get
Description copied from class:OpenApiElementGeneric property getter.Can be used to retrieve non-standard Swagger fields such as
"$ref" .- Overrides:
getin 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.
-
getRequirements
Returns the security requirements map.- Returns:
- The security requirements map.
-
keySet
Description copied from class:OpenApiElementReturns all the keys on this element.- Overrides:
keySetin classOpenApiElement- Returns:
- All the keys on this element.
Nevernull .
-
set
Description copied from class:OpenApiElementGeneric property setter.Can be used to set non-standard Swagger fields such as
"$ref" .- Overrides:
setin classOpenApiElement- Parameters:
property- The property name to set. Must not benull .value- The new value for the property.- 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.
-
setRequirements
Sets the security requirements map.- Parameters:
value- The new value for this property.- Returns:
- This object.
-
strict
Description copied from class:OpenApiElementSets strict mode on this bean.- Overrides:
strictin classOpenApiElement- Returns:
- This object
-
strict
Description copied from class:OpenApiElementSets strict mode on this bean.- Overrides:
strictin 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
-