cmd

package
v0.0.0-...-b7c8c1e Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2018 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "awsSts2",
	Short: "Small AWS toolkit",
	Long:  `Prime useage is to allow single sign on session for CLI`,
}

RootCmd represents the base command when called without any subcommands

Functions

func Credentials

func Credentials(username, password string) (string, string, error)

Credentials extract the usrename and password from config or interactivly

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func SetFatalExitWriter

func SetFatalExitWriter(w io.Writer)

SetFatalExitWriter for testing

func SetJournalWriter

func SetJournalWriter(w io.Writer)

SetJournalWriter for testing

func UpdateAwsConfigFile

func UpdateAwsConfigFile(profileName, id, secret, session string) error

UpdateAwsConfigFile in .aws home folder

Types

type AccountAliasCache

type AccountAliasCache struct {
	//Aliases list
	Roles []*RoleAlias `json:"roles"`
}

AccountAliasCache stores previously looked up aliases

func (*AccountAliasCache) Read

func (c *AccountAliasCache) Read(rc io.Reader) error

func (*AccountAliasCache) Write

func (c *AccountAliasCache) Write(wc io.Writer) error

type Arn

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

Arn principal and role

func ExtractRoles

func ExtractRoles(saml *Saml, cache *AccountAliasCache) (arns []Arn, err error)

ExtractRoles from the saml single sign on response

func SelectRole

func SelectRole(defaultRole string, roles []Arn) (*Arn, error)

SelectRole to create tokens for

func (Arn) String

func (a Arn) String() string

type AttributeValue

type AttributeValue struct {
	Name  string   `xml:"Name,attr"`
	Value []string `xml:"AttributeValue"`
}

AttributeValue contains the core information for role based assertion

type RoleAlias

type RoleAlias struct {
	//Account number
	Role string `json:"role"`
	//Aliases list, typicaly a single entry
	Names []string `json:"names"`
}

RoleAlias single account

func (RoleAlias) String

func (a RoleAlias) String() string

type SSO

type SSO struct {
	Client *http.Client
	URL    string
}

SSO Single Signon

func (SSO) SingleSignOn

func (sso SSO) SingleSignOn(username, password string) (*Saml, error)

SingleSignOn logs the user in to the STS signon page and retreives the content

type Saml

type Saml string

Saml response body

func (Saml) AsAssertion

func (s Saml) AsAssertion() string

AsAssertion returns the assertion blob to send to AWS AssumeRole

func (Saml) AsXML

func (s Saml) AsXML() ([]byte, error)

AsXML returns the decoded xml content

type SamlDocument

type SamlDocument struct {
	XMLName   xml.Name         `xml:"Response"`
	Assertion []AttributeValue `xml:"Assertion>AttributeStatement>Attribute"`
}

SamlDocument contains the payload of the STS authentication

Jump to

Keyboard shortcuts

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