Class HttpApiKeyAuthConverter
- java.lang.Object
-
- software.amazon.smithy.openapi.fromsmithy.security.HttpApiKeyAuthConverter
-
- All Implemented Interfaces:
SecuritySchemeConverter<HttpApiKeyAuthTrait>
public final class HttpApiKeyAuthConverter extends java.lang.Object implements SecuritySchemeConverter<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:
- API Gateway documentation
-
-
Constructor Summary
Constructors Constructor Description HttpApiKeyAuthConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SecuritySchemecreateSecurityScheme(Context<? extends Trait> context, HttpApiKeyAuthTrait trait)Creates an OpenAPI security scheme.java.util.Set<java.lang.String>getAuthRequestHeaders(Context<? extends Trait> context, HttpApiKeyAuthTrait trait)Gets the names of the headers set on HTTP requests used by this authentication scheme.java.lang.Class<HttpApiKeyAuthTrait>getAuthSchemeType()Get the U that matches this converter.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.smithy.openapi.fromsmithy.SecuritySchemeConverter
createSecurityRequirements, getAuthResponseHeaders, getAuthSchemeId, getOpenApiAuthSchemeName, usesHttpCredentials
-
-
-
-
Method Detail
-
getAuthSchemeType
public java.lang.Class<HttpApiKeyAuthTrait> getAuthSchemeType()
Description copied from interface:SecuritySchemeConverterGet the U that matches this converter.- Specified by:
getAuthSchemeTypein interfaceSecuritySchemeConverter<HttpApiKeyAuthTrait>- Returns:
- The Smithy security auth scheme ID.
-
createSecurityScheme
public SecurityScheme createSecurityScheme(Context<? extends Trait> context, HttpApiKeyAuthTrait trait)
Description copied from interface:SecuritySchemeConverterCreates an OpenAPI security scheme.- Specified by:
createSecuritySchemein interfaceSecuritySchemeConverter<HttpApiKeyAuthTrait>- Parameters:
context- Conversion context.trait- Authentication trait to convert.- Returns:
- The generated security scheme
- See Also:
- Security Scheme Object
-
getAuthRequestHeaders
public java.util.Set<java.lang.String> getAuthRequestHeaders(Context<? extends Trait> context, HttpApiKeyAuthTrait trait)
Description copied from interface:SecuritySchemeConverterGets 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:
getAuthRequestHeadersin interfaceSecuritySchemeConverter<HttpApiKeyAuthTrait>- Parameters:
context- Context for the conversion.trait- The auth trait that is being used.- Returns:
- A set of header names.
-
-