aws_smithy_runtime_api::client::identity

Trait ResolveIdentity

Source
pub trait ResolveIdentity:
    Send
    + Sync
    + Debug {
    // Required method
    fn resolve_identity<'a>(
        &'a self,
        runtime_components: &'a RuntimeComponents,
        config_bag: &'a ConfigBag,
    ) -> IdentityFuture<'a> ;

    // Provided methods
    fn fallback_on_interrupt(&self) -> Option<Identity> { ... }
    fn cache_location(&self) -> IdentityCacheLocation { ... }
    fn cache_partition(&self) -> Option<IdentityCachePartition> { ... }
}
Available on crate feature client only.
Expand description

Resolver for identities.

Every AuthScheme has one or more compatible identity resolvers, which are selected from runtime components by the auth scheme implementation itself.

The identity resolver must return an IdentityFuture with the resolved identity, or an error if resolution failed. There is no optionality for identity resolvers. The identity either resolves successfully, or it fails. The orchestrator will choose exactly one auth scheme to use, and thus, its chosen identity resolver is the only identity resolver that runs. There is no fallback to other auth schemes in the absence of an identity.

Required Methods§

Source

fn resolve_identity<'a>( &'a self, runtime_components: &'a RuntimeComponents, config_bag: &'a ConfigBag, ) -> IdentityFuture<'a>

Asynchronously resolves an identity for a request using the given config.

Provided Methods§

Source

fn fallback_on_interrupt(&self) -> Option<Identity>

Returns a fallback identity.

This method should be used as a fallback plan, i.e., when a call to resolve_identity is interrupted by a timeout and its future fails to complete.

The fallback identity should be set aside and ready to be returned immediately. Therefore, a new identity should NOT be fetched within this method, which might cause a long-running operation.

Source

fn cache_location(&self) -> IdentityCacheLocation

Returns the location of an identity cache associated with this identity resolver.

By default, identity resolvers will use the identity cache stored in runtime components. Implementing types can change the cache location if they want to. Refer to IdentityCacheLocation explaining why a concrete identity resolver might want to change the cache location.

Source

fn cache_partition(&self) -> Option<IdentityCachePartition>

Returns the identity cache partition associated with this identity resolver.

By default this returns None and cache partitioning is left up to SharedIdentityResolver.

Implementors§

Source§

impl ResolveIdentity for Login

Available on crate feature http-auth only.
Source§

impl ResolveIdentity for Token

Available on crate feature http-auth only.
Source§

impl ResolveIdentity for SharedIdentityResolver