All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.smithy.kotlin.runtime.http.auth.AnonymousAuthScheme.kt Maven / Gradle / Ivy

The newest version!
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0
 */

package aws.smithy.kotlin.runtime.http.auth

import aws.smithy.kotlin.runtime.auth.AuthSchemeId
import aws.smithy.kotlin.runtime.collections.Attributes
import aws.smithy.kotlin.runtime.collections.emptyAttributes
import aws.smithy.kotlin.runtime.identity.Identity
import aws.smithy.kotlin.runtime.identity.IdentityProvider
import aws.smithy.kotlin.runtime.identity.IdentityProviderConfig
import aws.smithy.kotlin.runtime.time.Instant

/**
 * A no-op signer that does nothing with the request
 */
public object AnonymousHttpSigner : HttpSigner {
    override suspend fun sign(signingRequest: SignHttpRequest) {}
}

/**
 * Anonymous identity
 */
public object AnonymousIdentity : Identity {
    override val expiration: Instant? = null
    override val attributes: Attributes = emptyAttributes()
}

public object AnonymousIdentityProvider : IdentityProvider {
    override suspend fun resolve(attributes: Attributes): Identity = AnonymousIdentity
}

/**
 * A no-op auth scheme
 */
public object AnonymousAuthScheme : AuthScheme {
    override val schemeId: AuthSchemeId = AuthSchemeId.Anonymous
    override val signer: HttpSigner = AnonymousHttpSigner
    override fun identityProvider(identityProviderConfig: IdentityProviderConfig): IdentityProvider = AnonymousIdentityProvider
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy