Class HttpApiKeyAuthConverter

java.lang.Object
software.amazon.smithy.openapi.fromsmithy.security.HttpApiKeyAuthConverter
All Implemented Interfaces:
SecuritySchemeConverter<software.amazon.smithy.model.traits.HttpApiKeyAuthTrait>

public final class HttpApiKeyAuthConverter extends Object implements SecuritySchemeConverter<software.amazon.smithy.model.traits.HttpApiKeyAuthTrait>
Uses an HTTP header named X-Api-Key that contains an API key.

This is compatible with Amazon API Gateway API key authorization.

See Also:
  • Constructor Details

    • HttpApiKeyAuthConverter

      public HttpApiKeyAuthConverter()
  • Method Details

    • getAuthSchemeType

      public Class<software.amazon.smithy.model.traits.HttpApiKeyAuthTrait> getAuthSchemeType()
      Description copied from interface: SecuritySchemeConverter
      Get the U that matches this converter.
      Specified by:
      getAuthSchemeType in interface SecuritySchemeConverter<software.amazon.smithy.model.traits.HttpApiKeyAuthTrait>
      Returns:
      The Smithy security auth scheme ID.
    • createSecurityScheme

      public SecurityScheme createSecurityScheme(Context<? extends software.amazon.smithy.model.traits.Trait> context, software.amazon.smithy.model.traits.HttpApiKeyAuthTrait trait)
      Description copied from interface: SecuritySchemeConverter
      Creates an OpenAPI security scheme.
      Specified by:
      createSecurityScheme in interface SecuritySchemeConverter<software.amazon.smithy.model.traits.HttpApiKeyAuthTrait>
      Parameters:
      context - Conversion context.
      trait - Authentication trait to convert.
      Returns:
      The generated security scheme
      See Also:
    • getAuthRequestHeaders

      public Set<String> getAuthRequestHeaders(Context<? extends software.amazon.smithy.model.traits.Trait> context, software.amazon.smithy.model.traits.HttpApiKeyAuthTrait trait)
      Description copied from interface: SecuritySchemeConverter
      Gets the names of the headers set on HTTP requests used by this authentication scheme.

      This is useful when integrating with things like CORS.

      Specified by:
      getAuthRequestHeaders in interface SecuritySchemeConverter<software.amazon.smithy.model.traits.HttpApiKeyAuthTrait>
      Parameters:
      context - Context for the conversion.
      trait - The auth trait that is being used.
      Returns:
      A set of header names.