Skip to content

Authentication Traits

Juli Tera edited this page Apr 19, 2024 · 5 revisions

This wiki contains a mapping between Smithy Authentication traits and generated Ruby code.

See Identity and Auth section for detailed usage.

authDefinition trait

A meta-trait that marks a trait as an authentication scheme. Traits that are marked with this trait are applied to service shapes to indicate how a client can authenticate with the service.

@authDefinition
@trait(selector: "service")
structure fooExample {}

@fooExample
@httpBasicAuth
service WeatherService {
    version: "2017-02-11"
}

See Smithy Documentation for more details.

httpBasicAuth trait

Indicates that a service supports HTTP Basic Authentication as defined in RFC 2617.

@httpBasicAuth
service WeatherService {
    version: "2017-02-11"
}

See Smithy Documentation for more details.

httpDigestAuth trait

Indicates that a service supports HTTP Digest Authentication as defined in RFC 2617.

@httpDigestAuth
service WeatherService {
    version: "2017-02-11"
}

See Smithy Documentation for more details.

httpBearerAuth trait

Indicates that a service supports HTTP Bearer Authentication as defined in RFC 6750.

@httpBearerAuth
service WeatherService {
    version: "2017-02-11"
}

See Smithy Documentation for more details.

httpApiKeyAuth trait

Indicates that a service supports HTTP-specific authentication using an API key sent in a header or query string parameter.

@httpApiKeyAuth(name: "X-Api-Key", in: "header")
service WeatherService {
    version: "2017-02-11"
}

See Smithy Documentation for more details.

optionalAuth trait

Indicates that an operation MAY be invoked without authentication, regardless of any authentication traits applied to the operation.

@httpDigestAuth
service WeatherService {
    version: "2017-02-11"
    operations: [PingServer]
}

@optionalAuth
operation PingServer {}

See Smithy Documentation for more details.

auth trait

Defines the priority ordered authentication schemes supported by a service or operation.

See Smithy Documentation for full details and examples.