aws_credential_helper package - github.com/mikeee/aws_credential_helper - Go Packages

aws_credential_helper

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 22 Imported by: 1

README

aws_credential_helper

This package provides a credential helper to authenticate using Roles Anywhere with AWS services.

It is CGO-less and does minimal external dependencies. This package currently only supports authentication using ECDSA keys.

Usage

Coming soon

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKeyType = errors.New("invalid key type, expected an ECDSA public key")

Functions

func BuildAuthorizationHeader

func BuildAuthorizationHeader(algorithm, serialNumber, scope, signedHeaders, signature string) string

func CalculateSignature

func CalculateSignature(stringToSign string, signer Signer) (string, error)

func CreateStringToSign

func CreateStringToSign(algorithm, requestDateTime, credentialSCope, canonicalRequest string) (string, error)

Types

type AssumedRoleUser

type AssumedRoleUser struct {
	Arn           string `json:"arn"`
	AssumedRoleId string `json:"assumedRoleId"`
}

type CreateSessionRequest

type CreateSessionRequest struct {
	DurationSeconds int    `json:"durationSeconds,omitempty"`
	ProfileArn      string `json:"profileArn"`
	RoleArn         string `json:"roleArn"`
	TrustAnchorArn  string `json:"trustAnchorArn"`
	RoleSessionName string `json:"roleSessionName,omitempty"`
	// contains filtered or unexported fields
}

type CreateSessionResponse

type CreateSessionResponse struct {
	CredentialSet []CredentialSetItem `json:"credentialSet"`
	SubjectArn    string              `json:"subjectArn"`
}

TODO: Marshal ARNs?

func CreateSession

func CreateSession(
	ctx context.Context,
	client *retryablehttp.Client,
	region string,
	request *CreateSessionRequest,
	signer Signer,
) (*CreateSessionResponse, error)

type CredentialProvider

type CredentialProvider struct {
	// contains filtered or unexported fields
}

func NewCredentialProvider

func NewCredentialProvider(ctx context.Context, authInput CredentialProviderInput) (*CredentialProvider, error)

func (*CredentialProvider) ChangeSigner

func (c *CredentialProvider) ChangeSigner(signer Signer) error

func (*CredentialProvider) Retrieve

func (c *CredentialProvider) Retrieve(ctx context.Context) (aws.Credentials, error)

type CredentialProviderInput

type CredentialProviderInput struct {
	Region string

	TrustProfileArn string
	TrustAnchorArn  string
	AssumeRoleArn   string

	Signer Signer
}

type CredentialSetItem

type CredentialSetItem struct {
	AssumedRoleUser  AssumedRoleUser `json:"assumedRoleUser"`
	Credentials      CredentialsItem `json:"credentials"`
	PackedPolicySize int             `json:"packedPolicySize"`
	RoleArn          string          `json:"roleArn"`
	SourceIdentity   string          `json:"sourceIdentity"`
}

type CredentialsItem

type CredentialsItem struct {
	AccessKeyId     string    `json:"accessKeyId"`
	Expiration      time.Time `json:"expiration"`
	SecretAccessKey string    `json:"secretAccessKey"`
	SessionToken    string    `json:"sessionToken"`
}

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

func NewSigner

func NewSigner(cert *x509.Certificate, pkey *ecdsa.PrivateKey) Signer

NewSigner creates a new Signer from a leaf certificate and its private key. Currently only supporting ECDSA keys however this will change.

func NewSignerWithChain

func NewSignerWithChain(cert *x509.Certificate, chain []*x509.Certificate, pkey *ecdsa.PrivateKey) Signer

NewSignerWithChain creates a Signer that, in addition to the leaf certificate, presents the intermediate CA certificates to IAM Roles Anywhere via the X-Amz-X509-Chain header. This lets the leaf be validated against a trust anchor registered higher in the chain (e.g. the root) rather than the immediate issuer.

func (*Signer) Sign

func (s *Signer) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL