org.eclipse.microprofile.openapi.models.security

## Interface SecurityRequirement

All Superinterfaces:
  Constructible, Map<String,List<String>>

    public interface SecurityRequirement
    extends Constructible, Map<String,List<String>>

SecurityRequirement

See Also:
  SecurityRequirement Object

### Nested Class Summary

### Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K,V>`

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
`SecurityRequirement` `addScheme(String securitySchemeName)` Adds a security scheme to the SecurityRequirement instance based on the scheme name.
`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.
`SecurityRequirement` `addScheme(String securitySchemeName, String scope)` Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scope (optional) provided.
`boolean` `containsKey(Object key)` Deprecated. since 1.1
`List<String>` `get(Object key)` Deprecated. since 1.1
`default List<String>` `getScheme(String securitySchemeName)` Returns a list of scopes for a given scheme name.
`Map<String,List<String>>` `getSchemes()` Returns a copy map (potentially immutable) of the schemes.
`default boolean` `hasScheme(String securitySchemeName)` Check whether a scheme is present in the map.
`List<String>` `put(String key, List<String> value)` Deprecated. since 1.1
`void` `putAll(Map<? extends String,? extends List<String>> m)` Deprecated. since 1.1
`List<String>` `remove(Object key)` Deprecated. since 1.1
`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.

### Methods inherited from interface java.util.Map

`clear, compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values`

### Method Detail

#### addScheme

    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` - the name of security scheme declared in the Components section of the OpenAPI document
  `scope` - 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(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` - the name of security scheme declared in the Components section of the OpenAPI document
  `scopes` - 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(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(String securitySchemeName)

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

Parameters:
  `securitySchemeName` - the name of security scheme

#### getSchemes

    Map<String,List<String>> getSchemes()

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

Returns:
  all items

#### setSchemes

    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` - a map containing the security schemes.

#### hasScheme

    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` - the name of security scheme
Returns:
  a boolean to indicate if the scheme is present or not.

#### getScheme

    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` - the name of security scheme
Returns:
  a list of scopes or null.

#### get

    @Deprecated
    List<String> get(Object key)

Deprecated. since 1.1
In the next version, `SecurityRequirement` will no longer extends `Map`, this method will no longer be present. Use `getScheme(String)` instead.

Specified by:
  `get` in interface `Map<String,List<String>>`

#### containsKey

    @Deprecated
    boolean containsKey(Object key)

Deprecated. since 1.1
In the next version, `SecurityRequirement` will no longer extends `Map`, this method will no longer be present. Use `hasScheme(String)` instead.

Specified by:
  `containsKey` in interface `Map<String,List<String>>`

#### put

    @Deprecated
    List<String> put(String key,
                                 List<String> value)

Deprecated. since 1.1
In the next version, `SecurityRequirement` will no longer extends `Map`, this method will no longer be present. Use `addScheme(String, List)` instead.

Specified by:
  `put` in interface `Map<String,List<String>>`

#### putAll

    @Deprecated
    void putAll(Map<? extends String,? extends List<String>> m)

Deprecated. since 1.1
In the next version, `SecurityRequirement` will no longer extends `Map`, this method will no longer be present. Use `setSchemes(Map)` instead.

Specified by:
  `putAll` in interface `Map<String,List<String>>`

#### remove

    @Deprecated
    List<String> remove(Object key)

Deprecated. since 1.1
In the next version, `SecurityRequirement` will no longer extends `Map`, this method will no longer be present. Use `removeScheme(String)` instead.

Specified by:
  `remove` in interface `Map<String,List<String>>`