Interface SecurityRequirement

All Superinterfaces:
Constructible

public interface SecurityRequirement extends Constructible
SecurityRequirement
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    addScheme(String securitySchemeName)
    Adds a security scheme to the SecurityRequirement instance based on the scheme name.
    addScheme(String securitySchemeName, String scope)
    Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scope (optional) provided.
    addScheme(String securitySchemeName, List<String> scopes)
    Adds a security scheme to the SecurityRequirement instance based on the scheme name and required scopes (optional) provided.
    default List<String>
    getScheme(String securitySchemeName)
    Returns a list of scopes for a given scheme name.
    Returns a copy map (potentially immutable) of the schemes.
    default boolean
    hasScheme(String securitySchemeName)
    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
    Set all security schemes to the SecurityRequirement instance.
  • 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'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.