Interface SecurityRequirement
-
- All Superinterfaces:
Constructible
public interface SecurityRequirement extends Constructible
SecurityRequirement- See Also:
- SecurityRequirement Object
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description SecurityRequirement
addScheme(java.lang.String securitySchemeName)
Adds a security scheme to the SecurityRequirement instance based on the scheme name.SecurityRequirement
addScheme(java.lang.String securitySchemeName, java.lang.String scope)
Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scope (optional) provided.SecurityRequirement
addScheme(java.lang.String securitySchemeName, java.util.List<java.lang.String> scopes)
Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scopes (optional) provided.default java.util.List<java.lang.String>
getScheme(java.lang.String securitySchemeName)
Returns a list of scopes for a given scheme name.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getSchemes()
Returns a copy map (potentially immutable) of the schemes.default boolean
hasScheme(java.lang.String securitySchemeName)
Check whether a scheme is present in the map.void
removeScheme(java.lang.String securitySchemeName)
Removes a security scheme to the SecurityRequirement instance based on the scheme name.void
setSchemes(java.util.Map<java.lang.String,java.util.List<java.lang.String>> items)
Set all security schemes to the SecurityRequirement instance.
-
-
-
Method Detail
-
addScheme
SecurityRequirement addScheme(java.lang.String securitySchemeName, java.lang.String scope)
Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scope (optional) provided.- Parameters:
securitySchemeName
- the name of security scheme declared in the Components section of the OpenAPI documentscope
- a required scope - only valid when the defined scheme's type is 'oauth2' or 'openIdConnect'. passing null will result in an empty list of scopes- Returns:
- Updated SecurityRequirement instance
-
addScheme
SecurityRequirement addScheme(java.lang.String securitySchemeName, java.util.List<java.lang.String> scopes)
Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scopes (optional) provided.- Parameters:
securitySchemeName
- the name of security scheme declared in the Components section of the OpenAPI documentscopes
- the scopes required - only valid when the defined scheme is 'oauth2' or 'openIdConnect'. passing null will result in an empty list of scopes- Returns:
- Updated SecurityRequirement instance
-
addScheme
SecurityRequirement addScheme(java.lang.String securitySchemeName)
Adds a security scheme to the SecurityRequirement instance based on the scheme name. No scopes are included, resulting in an empty list of scopes for the security scheme. This is valid when the defined security scheme is not 'oauth2' or 'openIdConnect'.- Parameters:
securitySchemeName
- the name of security scheme declared in the Components section of the OpenAPI document- Returns:
- Updated SecurityRequirement instance
-
removeScheme
void removeScheme(java.lang.String securitySchemeName)
Removes a security scheme to the SecurityRequirement instance based on the scheme name.- Parameters:
securitySchemeName
- the name of security scheme
-
getSchemes
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getSchemes()
Returns a copy map (potentially immutable) of the schemes.- Returns:
- all items
-
setSchemes
void setSchemes(java.util.Map<java.lang.String,java.util.List<java.lang.String>> items)
Set all security schemes to the SecurityRequirement instance. Keys are the name of security scheme declared in the Components section of the OpenAPI document, values are a list of required scope - only valid when the defined scheme is 'oauth2' or 'openIdConnect'- Parameters:
items
- a map containing the security schemes.
-
hasScheme
default boolean hasScheme(java.lang.String securitySchemeName)
Check whether a scheme is present in the map. This is a convenience method forgetSchemes().containsKey(name)
- Parameters:
securitySchemeName
- the name of security scheme- Returns:
- a boolean to indicate if the scheme is present or not.
-
getScheme
default java.util.List<java.lang.String> getScheme(java.lang.String securitySchemeName)
Returns a list of scopes for a given scheme name. This is a convenience method forgetSchemes().get(name)
- Parameters:
securitySchemeName
- the name of security scheme- Returns:
- a list of scopes or null.
-
-