Class SecurityScheme

java.lang.Object
com.jsgalactic.axiom.openapi.SecurityScheme

public final class SecurityScheme extends Object
A security scheme that routes can require by name (see RouteDoc.security(String...)). It only documents how clients authenticate; the application enforces access with its own middleware.

In a Swagger 2.0 document a bearer scheme is an API key in the Authorization header, because that format has no bearer type.

  • Method Details

    • bearer

      public static SecurityScheme bearer()
      An HTTP bearer token.
      Returns:
      the scheme
    • bearer

      public static SecurityScheme bearer(String format)
      An HTTP bearer token with a documented format, for example JWT.
      Parameters:
      format - format hint
      Returns:
      the scheme
    • basic

      public static SecurityScheme basic()
      HTTP basic authentication.
      Returns:
      the scheme
    • apiKeyHeader

      public static SecurityScheme apiKeyHeader(String header)
      An API key sent in a request header.
      Parameters:
      header - header name
      Returns:
      the scheme
      Throws:
      IllegalArgumentException - if the name is not a header name
    • apiKeyQuery

      public static SecurityScheme apiKeyQuery(String parameter)
      An API key sent as a query parameter.
      Parameters:
      parameter - parameter name
      Returns:
      the scheme
      Throws:
      IllegalArgumentException - if the name is not a plain parameter name