Class HttpApiKeyAuthConverter
java.lang.Object
software.amazon.smithy.openapi.fromsmithy.security.HttpApiKeyAuthConverter
- All Implemented Interfaces:
SecuritySchemeConverter<HttpApiKeyAuthTrait>
public final class HttpApiKeyAuthConverter
extends 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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateSecurityScheme
(Context<? extends Trait> context, HttpApiKeyAuthTrait trait) Creates an OpenAPI security scheme.getAuthRequestHeaders
(Context<? extends Trait> context, HttpApiKeyAuthTrait trait) Gets the names of the headers set on HTTP requests used by this authentication scheme.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
-
Constructor Details
-
HttpApiKeyAuthConverter
public HttpApiKeyAuthConverter()
-
-
Method Details
-
getAuthSchemeType
Description copied from interface:SecuritySchemeConverter
Get the U that matches this converter.- Specified by:
getAuthSchemeType
in interfaceSecuritySchemeConverter<HttpApiKeyAuthTrait>
- Returns:
- The Smithy security auth scheme ID.
-
createSecurityScheme
public SecurityScheme createSecurityScheme(Context<? extends Trait> context, HttpApiKeyAuthTrait trait) Description copied from interface:SecuritySchemeConverter
Creates an OpenAPI security scheme.- Specified by:
createSecurityScheme
in interfaceSecuritySchemeConverter<HttpApiKeyAuthTrait>
- Parameters:
context
- Conversion context.trait
- Authentication trait to convert.- Returns:
- The generated security scheme
- See Also:
-
getAuthRequestHeaders
public Set<String> getAuthRequestHeaders(Context<? extends Trait> context, 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 interfaceSecuritySchemeConverter<HttpApiKeyAuthTrait>
- Parameters:
context
- Context for the conversion.trait
- The auth trait that is being used.- Returns:
- A set of header names.
-