Class SecurityScheme

java.lang.Object
org.apache.juneau.dto.swagger.SwaggerElement
org.apache.juneau.dto.swagger.SecurityScheme

@Bean(properties="type,description,name,in,flow,authorizationUrl,tokenUrl,scopes,*") public class SecurityScheme extends SwaggerElement
Allows the definition of a security scheme that can be used by the operations.

Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code).

Example:

// Basic authentication sample { "type": "basic" } // API key sample { "type": "apiKey", "name": "api_key", "in": "header" } // Implicit OAuth2 sample { "type": "oauth2", "authorizationUrl": "http://swagger.io/api/oauth/dialog", "flow": "implicit", "scopes": { "write:pets": "modify pets in your account", "read:pets": "read your pets" } }

See Also:
  • Constructor Details

  • Method Details

    • copy

      public SecurityScheme copy()
      Make a deep copy of this object.
      Returns:
      A deep copy of this object.
    • strict

      protected SecurityScheme strict()
      Description copied from class: SwaggerElement
      Sets strict mode on this bean.
      Overrides:
      strict in class SwaggerElement
      Returns:
      This object.
    • getAuthorizationUrl

      Bean property getter: authorizationUrl.

      The authorization URL to be used for this flow.

      Returns:
      The property value, or null if it is not set.
    • setAuthorizationUrl

      Bean property setter: authorizationUrl.

      The authorization URL to be used for this flow.

      Parameters:
      value - The new value for this property.
      This SHOULD be in the form of a URL.
      Can be null to unset the property.
      Returns:
      This object.
    • getDescription

      Bean property getter: description.

      A short description for security scheme.

      Returns:
      The property value, or null if it is not set.
    • setDescription

      Bean property setter: description.

      A short description for security scheme.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getFlow

      public String getFlow()
      Bean property getter: flow.

      The flow used by the OAuth2 security scheme.

      Returns:
      The property value, or null if it is not set.
    • setFlow

      public SecurityScheme setFlow(String value)
      Bean property setter: flow.

      The flow used by the OAuth2 security scheme.

      Parameters:
      value - The new value for this property.
      Valid values:
      • "implicit"
      • "password"
      • "application"
      • "accessCode"

      Can be null to unset the property.
      Returns:
      This object.
    • getIn

      public String getIn()
      Bean property getter: in.

      The location of the API key.

      Returns:
      The property value, or null if it is not set.
    • setIn

      public SecurityScheme setIn(String value)
      Bean property setter: in.

      The location of the API key.

      Parameters:
      value - The new value for this property.
      Valid values:
      • "query"
      • "header"

      Can be null to unset the property.
      Returns:
      This object.
    • getName

      public String getName()
      Bean property getter: name.

      The name of the header or query parameter to be used.

      Returns:
      The property value, or null if it is not set.
    • setName

      public SecurityScheme setName(String value)
      Bean property setter: name.

      The name of the header or query parameter to be used.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • getScopes

      Bean property getter: scopes.

      The available scopes for the OAuth2 security scheme.

      Returns:
      The property value, or null if it is not set.
    • setScopes

      Bean property setter: scopes.

      The available scopes for the OAuth2 security scheme.

      Parameters:
      value - The new value for this property.
      Can be null to unset the property.
      Returns:
      This object.
    • addScope

      public SecurityScheme addScope(String key, String value)
      Bean property appender: scopes.

      The available scopes for the OAuth2 security scheme.

      Parameters:
      key - The scope key.
      value - The scope value.
      Returns:
      This object.
    • getTokenUrl

      public String getTokenUrl()
      Bean property getter: tokenUrl.

      The token URL to be used for this flow.

      Returns:
      The property value, or null if it is not set.
    • setTokenUrl

      Bean property setter: tokenUrl.

      The token URL to be used for this flow.

      Parameters:
      value - The new value for this property.
      This SHOULD be in the form of a URL.
      Can be null to unset the property.
      Returns:
      This object.
    • getType

      public String getType()
      Bean property getter: type.

      The type of the security scheme.

      Returns:
      The property value, or null if it is not set.
    • setType

      public SecurityScheme setType(String value)
      Bean property setter: type.

      The type of the security scheme.

      Parameters:
      value - The new value for this property.
      Valid values:
      • "basic"
      • "apiKey"
      • "oauth2"

      Property value is required.
      Returns:
      This object.
    • get

      public <T> T get(String property, Class<T> type)
      Description copied from class: SwaggerElement
      Generic property getter.

      Can be used to retrieve non-standard Swagger fields such as "$ref".

      Overrides:
      get in class SwaggerElement
      Type Parameters:
      T - The datatype to cast the value to.
      Parameters:
      property - The property name to retrieve.
      type - The datatype to cast the value to.
      Returns:
      The property value, or null if the property does not exist or is not set.
    • set

      public SecurityScheme set(String property, Object value)
      Description copied from class: SwaggerElement
      Generic property setter.

      Can be used to set non-standard Swagger fields such as "$ref".

      Overrides:
      set in class SwaggerElement
      Parameters:
      property - The property name to set.
      value - The new value for the property.
      Returns:
      This object.
    • keySet

      public Set<String> keySet()
      Description copied from class: SwaggerElement
      Returns all the keys on this element.
      Overrides:
      keySet in class SwaggerElement
      Returns:
      All the keys on this element.
      Never null.