...
AWS SDK for Go API Reference
We announced the upcoming end-of-support for AWS SDK for Go (v1). We recommend that you migrate to AWS SDK for Go v2. For dates, additional details, and information on how to migrate, please refer to the linked announcement.
import "github.com/aws/aws-sdk-go/aws/auth/bearer"
Overview
Index

Overview ▾

type StaticTokenProvider

type StaticTokenProvider struct {
    Token Token
}

StaticTokenProvider provides a utility for wrapping a static bearer token value within an implementation of a token provider.

func (StaticTokenProvider) RetrieveBearerToken

func (s StaticTokenProvider) RetrieveBearerToken(aws.Context) (Token, error)

RetrieveBearerToken returns the static token specified.

type Token

type Token struct {
    Value string

    CanExpire bool
    Expires   time.Time
}

Token provides a type wrapping a bearer token and expiration metadata.

func (Token) Expired

func (t Token) Expired(now time.Time) bool

Expired returns if the token's Expires time is before or equal to the time provided. If CanExpire is false, Expired will always return false.

type TokenProvider

type TokenProvider interface {
    RetrieveBearerToken(aws.Context) (Token, error)
}

TokenProvider provides interface for retrieving bearer tokens.

type TokenProviderFunc

type TokenProviderFunc func(aws.Context) (Token, error)

TokenProviderFunc provides a helper utility to wrap a function as a type that implements the TokenProvider interface.

func (TokenProviderFunc) RetrieveBearerToken

func (fn TokenProviderFunc) RetrieveBearerToken(ctx aws.Context) (Token, error)

RetrieveBearerToken calls the wrapped function, returning the Token or error.