Interface SecurityRequirement
- All Superinterfaces:
Constructible
SecurityRequirement
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAdds a security scheme to the SecurityRequirement instance based on the scheme name.Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scope (optional) provided.Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scopes (optional) provided.Returns a list of scopes for a given scheme name.Returns a copy map (potentially immutable) of the schemes.default boolean
Check whether a scheme is present in the map.void
removeScheme
(String securitySchemeName) Removes a security scheme to the SecurityRequirement instance based on the scheme name.void
setSchemes
(Map<String, List<String>> items) Set all security schemes to the SecurityRequirement instance.
-
Method Details
-
addScheme
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
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
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
Removes a security scheme to the SecurityRequirement instance based on the scheme name.- Parameters:
securitySchemeName
- the name of security scheme
-
getSchemes
Returns a copy map (potentially immutable) of the schemes.- Returns:
- all items
-
setSchemes
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
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
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.
-