Interface SecurityRequirement

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

public interface SecurityRequirement extends Constructible, Map<String,List<String>>
SecurityRequirement
See Also:
  • Method Details

    • 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 is 'oauth2' or 'openIdConnect'. null values will be rejected (implementation will throw an exception) or ignored.
      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'. null values will be rejected (implementation will throw an exception) or ignored.
      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 path item for a given name. This is a convenience method for getSchemes().get(name)
      Parameters:
      securitySchemeName - the name of security scheme
      Returns:
      the corresponding path item or null.
    • get

      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>>