cmd

package
v0.15.7 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	UserEndpoint          = "https://portal.sso.%s.amazonaws.com/user"
	CredsEndpoint         = "https://portal.sso.%s.amazonaws.com/federation/credentials/"
	SsoCredsEndpointQuery = "?account_id=%s&role_name=%s&debug=true"
)

Variables

View Source
var (
	Version  string = "0.0.1"
	Revision string = "1111aaaa"
)
View Source
var (
	ClearCmd = &cobra.Command{
		Use:   "clear-cache <flags>",
		Short: "Clears any stored credentials in the OS secret store",
		RunE:  clear,
	}
)
View Source
var (
	ErrUnableToCreateSession = errors.New("sts - cannot start a new session")
)
View Source
var (
	RootCmd = &cobra.Command{
		Use:   "aws-cli-auth",
		Short: "CLI tool for retrieving AWS temporary credentials",
		Long: `CLI tool for retrieving AWS temporary credentials using SAML providers, or specified method of retrieval - i.e. force AWS_WEB_IDENTITY.
Useful in situations like CI jobs or containers where multiple env vars might be present.
Stores them under the $HOME/.aws/credentials file under a specified path or returns the crednetial_process payload for use in config`,
		Version: fmt.Sprintf("%s-%s", Version, Revision),
	}
)
View Source
var (
	SamlCmd = &cobra.Command{
		Use:   "saml <SAML ProviderUrl>",
		Short: "Get AWS credentials and out to stdout",
		Long:  `Get AWS credentials and out to stdout through your SAML provider authentication.`,
		RunE:  getSaml,
		PreRunE: func(cmd *cobra.Command, args []string) error {
			if reloadBeforeTime != 0 && reloadBeforeTime > duration {
				return fmt.Errorf("reload-before: %v, must be less than duration (-d): %v", reloadBeforeTime, duration)
			}
			if len(ssoRole) > 0 {
				sr := strings.Split(ssoRole, ":")
				if len(sr) != 2 {
					return fmt.Errorf("incorrectly formatted role for AWS SSO - must only be ACCOUNT:ROLE_NAME")
				}
				ssoRoleAccount, ssoRoleName = sr[0], sr[1]
			}
			return nil
		},
	}
)
View Source
var (
	SpecificCmd = &cobra.Command{
		Use:   "specific <flags>",
		Short: "Initiates a specific credential provider",
		Long: `Initiates a specific credential provider [WEB_ID] as opposed to relying on the defaultCredentialChain provider.
This is useful in CI situations where various authentication forms maybe present from AWS_ACCESS_KEY as env vars to metadata of the node.
Returns the same JSON object as the call to the AWS CLI for any of the sts AssumeRole* commands`,
		RunE: specific,
	}
)

Functions

func Execute

func Execute(ctx context.Context)

Types

This section is empty.

Jump to

Keyboard shortcuts

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