Documentation ¶
Overview ¶
Package credentials implements credential management for signing requests.
Credentials consist of an access key ID, a secret access key as well as an optional session token.
This package implements providers for retrieving credentials from different sources.
Index ¶
Constants ¶
const StaticProviderName = "StaticProvider"
StaticProviderName represents the name of the static credentials provider
Variables ¶
var ( // ErrStaticCredentialsEmpty indicates missing credentials required for a static provider ErrStaticCredentialsEmpty = errors.New("static credentials are empty") )
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials struct { // AWS Access Key ID AccessKeyID string // AWS Secret Access Key SecretAccessKey string // AWS Session Token SessionToken string // Name of provider used to retrieve credentials ProviderName string }
Credentials represents a set of credentials consisting of an access key ID and its corresponding secret as well as an optional session token.
func (Credentials) DeriveSigningKey ¶
DeriveSigningKey derives a HMAC signing key from the credentials in accordance with the AWS Signature Version 4 specification using the signing time as well as the region and service of the request.
type Provider ¶
type Provider interface { // Retrieve returns a set of credentials or an error if retrieval failed. Retrieve() (Credentials, error) // IsExpired indicates whether the credentials managed by the provider have expired. IsExpired() bool }
Provider presents an interface for retrieving credentials.
type StaticProvider ¶
type StaticProvider struct {
Credentials
}
StaticProvider implements a provider using a static set of credentials, returning the defined access key and optional session token. No expiry or renewal will be managed by the provider.
func NewStaticProvider ¶
func NewStaticProvider(id string, secret string, token string) *StaticProvider
NewStaticProvider returns a new static credentials provider using the given set of credentials.
func (*StaticProvider) IsExpired ¶
func (s *StaticProvider) IsExpired() bool
IsExpired returns whether the stored credentials are expired. In the case of a static provider, this will always return false since expiry is not managed by the provider.
func (*StaticProvider) Retrieve ¶
func (s *StaticProvider) Retrieve() (Credentials, error)
Retrieve verifies the required static credentials are available and returns them.