Top Description Methods
org.eclipse.microprofile.openapi.models.security

public Interface SecurityRequirement

extends Constructible
Imports
java.util.List, .Map, org.eclipse.microprofile.openapi.models.Constructible

SecurityRequirement
See Also
OpenAPI Specification Security Requirement Object

Method Summary

Modifier and TypeMethod and Description
public SecurityRequirement

Returns:

Updated SecurityRequirement instance
addScheme
(String
the name of security scheme declared in the Components section of the OpenAPI document
securitySchemeName
,
String
a required scope. passing null will result in an empty list of scopes
scope
)

Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scope (optional) provided.

public SecurityRequirement

Returns:

Updated SecurityRequirement instance
addScheme
(String
the name of security scheme declared in the Components section of the OpenAPI document
securitySchemeName
,
List<String>
the scopes required. passing null will result in an empty list of scopes
scopes
)

Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scopes (optional) provided.

public SecurityRequirement

Returns:

Updated SecurityRequirement instance
addScheme
(String
the name of security scheme declared in the Components section of the OpenAPI document
securitySchemeName
)

Adds a security scheme to the SecurityRequirement instance based on the scheme name.

public default List<String>

Returns:

a list of scopes or null.
getScheme
(String
the name of security scheme
securitySchemeName
)

Returns a list of scopes for a given scheme name.

public Map<String, List<String>>

Returns:

all items
getSchemes
()

Returns a copy map (potentially immutable) of the schemes.

public default boolean

Returns:

a boolean to indicate if the scheme is present or not.
hasScheme
(String
the name of security scheme
securitySchemeName
)

Check whether a scheme is present in the map.

public void
removeScheme(String
the name of security scheme
securitySchemeName
)

Removes a security scheme to the SecurityRequirement instance based on the scheme name.

public void
setSchemes(Map<String, List<String>>
a map containing the security schemes.
items
)

Set all security schemes to the SecurityRequirement instance.

Method Detail

addSchemeback to summary
public SecurityRequirement addScheme(String securitySchemeName, String scope)

Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scope (optional) provided.

Parameters
securitySchemeName:String

the name of security scheme declared in the Components section of the OpenAPI document

scope:String

a required scope. passing null will result in an empty list of scopes

Returns:SecurityRequirement

Updated SecurityRequirement instance

addSchemeback to summary
public SecurityRequirement addScheme(String securitySchemeName, List<String> scopes)

Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scopes (optional) provided.

Parameters
securitySchemeName:String

the name of security scheme declared in the Components section of the OpenAPI document

scopes:List<String>

the scopes required. passing null will result in an empty list of scopes

Returns:SecurityRequirement

Updated SecurityRequirement instance

addSchemeback to summary
public SecurityRequirement addScheme(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:String

the name of security scheme declared in the Components section of the OpenAPI document

Returns:SecurityRequirement

Updated SecurityRequirement instance

getSchemeback to summary
public default List<String> getScheme(String securitySchemeName)

Returns a list of scopes for a given scheme name. This is a convenience method for getSchemes().get(name)

Parameters
securitySchemeName:String

the name of security scheme

Returns:List<String>

a list of scopes or null.

getSchemesback to summary
public Map<String, List<String>> getSchemes()

Returns a copy map (potentially immutable) of the schemes.

Returns:Map<String, List<String>>

all items

hasSchemeback to summary
public default boolean hasScheme(String securitySchemeName)

Check whether a scheme is present in the map. This is a convenience method for getSchemes().containsKey(name)

Parameters
securitySchemeName:String

the name of security scheme

Returns:boolean

a boolean to indicate if the scheme is present or not.

removeSchemeback to summary
public void removeScheme(String securitySchemeName)

Removes a security scheme to the SecurityRequirement instance based on the scheme name.

Parameters
securitySchemeName:String

the name of security scheme

setSchemesback to summary
public void setSchemes(Map<String, List<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:Map<String, List<String>>

a map containing the security schemes.