Interface SecuritySchemeConverter<T extends Trait>

    • Method Detail

      • getAuthSchemeType

        java.lang.Class<T> getAuthSchemeType()
        Get the U that matches this converter.
        Returns:
        The Smithy security auth scheme ID.
      • getAuthSchemeId

        default ShapeId getAuthSchemeId()
        Gets the shape ID of the auth scheme type.

        By default, this operation uses reflection to get the value of a static property of the auth scheme class named "ID". If that is not how a specific auth scheme class is implemented, then this method must be overridden.

        Returns:
        Returns the auth scheme's shape ID.
      • createSecurityScheme

        SecurityScheme createSecurityScheme​(Context<? extends Trait> context,
                                            T authTrait)
        Creates an OpenAPI security scheme.
        Parameters:
        context - Conversion context.
        authTrait - Authentication trait to convert.
        Returns:
        The generated security scheme
        See Also:
        Security Scheme Object
      • createSecurityRequirements

        default java.util.List<java.lang.String> createSecurityRequirements​(Context<? extends Trait> context,
                                                                            T authTrait,
                                                                            Shape shape)
        Creates a "security" requirements property to apply to an operation or top-level service using the Smithy auth scheme name as the key.

        The default implementation will return an empty list.

        Parameters:
        context - OpenAPI context
        authTrait - Authentication trait to convert.
        shape - Service or operation shape.
        Returns:
        The security requirements value.
      • getOpenApiAuthSchemeName

        default java.lang.String getOpenApiAuthSchemeName()
        Gets the name of OpenApi auth scheme.

        For compatibility with Amazon API Gateway, the `#` is replaced with an `.` when deriving the name from the auth scheme's shape ID.

        Returns:
        Returns the auth scheme's name.
      • getAuthRequestHeaders

        default java.util.Set<java.lang.String> getAuthRequestHeaders​(Context<? extends Trait> context,
                                                                      T authTrait)
        Gets the names of the headers set on HTTP requests used by this authentication scheme.

        This is useful when integrating with things like CORS.

        Parameters:
        context - Context for the conversion.
        authTrait - The auth trait that is being used.
        Returns:
        A set of header names.
      • getAuthResponseHeaders

        default java.util.Set<java.lang.String> getAuthResponseHeaders​(Context<? extends Trait> context,
                                                                       T authTrait)
        Gets the names of the headers set on HTTP responses used by this authentication scheme.

        This is useful when integrating with things like CORS.

        Parameters:
        context - Context for the conversion.
        authTrait - The auth trait that is being used.
        Returns:
        A set of header names.
      • usesHttpCredentials

        default boolean usesHttpCredentials()
        Reports if this authentication mechanism uses HTTP credentials, such as cookies, browser-managed usernames and passwords, or TLS client certificates.

        This is useful when integrating with things like CORS.

        Returns:
        Whether this authentication mechanism relies on browser-managed credentials
        See Also:
        Browser-managed credentials