ofa

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagInteractive = "interactive"
	FlagBatch       = "batch"
	FlagVerbose     = "verbose"
	FlagQuiet       = "quiet"
	FlagNoConfig    = "no-config"

	FlagSetInteractive = "set-interactive"
	FlagSetVerbose     = "set-verbose"

	FlagSetAuthMethod  = "set-auth-method"
	FlagSetOktaAppURL  = "set-okta-app-url"
	FlagSetOktaURL     = "set-okta-url"
	FlagSetProfile     = "set-profile"
	FlagSetRole        = "set-role"
	FlagSetSessionTime = "set-session-time"
	FlagSetUser        = "set-user"

	FlagAuthMethod  = "auth-method"
	FlagOktaAppURL  = "okta-app-url"
	FlagOktaURL     = "okta-url"
	FlagPassword    = "password"
	FlagProfile     = "profile"
	FlagRole        = "role"
	FlagSessionTime = "session-time"
	FlagUser        = "user"

	FlagDescSetVerbose     = "Sets the default verbose flag."
	FlagDescSetInteractive = "Sets the default interactive flag."
	FlagDescSetProfileName = "Sets the default profile name."

	FlagDescSetAuthMethod  = "Sets the Okta Auth method."
	FlagDescSetOktaAppURL  = "Sets the Okta AWS app URL."
	FlagDescSetOktaURL     = "Sets the Okta organization URL."
	FlagDescSetRole        = "Sets the AWS role to assume."
	FlagDescSetSessionTime = "Sets the AWS session time."
	FlagDescSetUser        = "Sets the Okta user."

	FlagDescAuthMethod  = "Okta Auth method to use."
	FlagDescOktaAppURL  = "Okta AWS app URL to use."
	FlagDescOktaURL     = "Okta organization URL to use."
	FlagDescPassword    = "Okta passwort to use."
	FlagDescRole        = "AWS role to assume."
	FlagDescSessionTime = "AWS session time to use."
	FlagDescUser        = "Okta user to use."
)

Variables

This section is empty.

Functions

func AssumeAwsRole

func AssumeAwsRole(session *LoginSession, samlResponse *string, samlAwsRole *samlAwsRole) (*credentials.Credentials, error)

AssumeAwsRole takes the SAML credentials and assumes an AWS role

func DeleteProfileSettings

func DeleteProfileSettings(profileName string) error

func DisplayGlobalFlags

func DisplayGlobalFlags()

func Information

func Information(format string, args ...interface{})

func LoadConfig

func LoadConfig() error

LoadConfig loads the on-disk configuration file

func OktaLogin

func OktaLogin(session *LoginSession) (*string, error)

OktaLogin logs into Okta using username and password

func OktaSamlSession

func OktaSamlSession(session *LoginSession, sessionToken string) (samlResponse *string, err error)

func SelectAwsRoleFromSaml

func SelectAwsRoleFromSaml(session *LoginSession, saml *string) (*samlAwsRole, error)

func SetGlobalFlags

func SetGlobalFlags(flags *pflag.FlagSet)

func StoreDefaultSettings

func StoreDefaultSettings(globalSettings *DefaultSettings) error

func StoreProfileSettings

func StoreProfileSettings(profileSettings *ProfileSettings) error

func WriteAwsCredentials

func WriteAwsCredentials(session *LoginSession, cred *credentials.Credentials) error

WriteAwsCredentials writes the credentials for the AWS profile selected into the AWS config files.

Types

type DefaultSettings

type DefaultSettings struct {
	Verbose     *bool
	Interactive *bool
	Profile     ProfileSettings
}

func CreateDefaultSettings

func CreateDefaultSettings(flags *pflag.FlagSet) (*DefaultSettings, error)

func ListProfiles

func ListProfiles() (*DefaultSettings, map[string]*ProfileSettings)

func (*DefaultSettings) Display

func (g *DefaultSettings) Display()

type KeychainPassword

type KeychainPassword struct {
	URL      *url.URL `validate:"required,url"`
	User     string   `validate:"required"`
	Password *string
}

func NewKeychainPassword

func NewKeychainPassword(flags *pflag.FlagSet, promptForPassword bool) (*KeychainPassword, error)

func (*KeychainPassword) Delete

func (p *KeychainPassword) Delete() error

func (*KeychainPassword) Update

func (p *KeychainPassword) Update() error

type LoginSession

type LoginSession struct {
	ProfileName string  `validate:"omitempty"`
	User        string  `validate:"required"`
	Password    *string `validate:"required"`

	OktaURL        *url.URL `validate:"required,url"`
	OktaAppURL     *url.URL `validate:"required,url"`
	OktaAuthMethod *string  `validate:"omitempty,oneof=token sms push"`

	AwsRole        *string `validate:"omitempty"`
	AwsSessionTime *int64  `validate:"omitempty,gte=3600,lte=86400"` // one hour to one day
}

LoginSession is the Session structure for the ofa application.

func CreateLoginSession

func CreateLoginSession(flags *pflag.FlagSet) (*LoginSession, error)

CreateLoginSession creates a new configuration object with all the fields filled in

type ProfileSettings

type ProfileSettings struct {
	ProfileName    *string
	OktaAppURL     *string `validate:"omitempty,url"`
	OktaAuthMethod *string `validate:"omitempty,oneof=token sms push"`
	OktaUser       *string
	OktaURL        *string `validate:"omitempty,url"`
	AwsRole        *string
	AwsSessionTime *int64 `validate:"omitempty,gte=3600,lte=86400"`
}

func CreateProfileSettings

func CreateProfileSettings(flags *pflag.FlagSet, rootProfileName *string, defaultSettings ProfileSettings) (*ProfileSettings, error)

func NewProfileName

func NewProfileName(flags *pflag.FlagSet) (*ProfileSettings, error)

func SelectProfile

func SelectProfile(flags *pflag.FlagSet) *ProfileSettings

func (*ProfileSettings) Display

func (p *ProfileSettings) Display(profileName *string)

type StoreConfigProvider

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

Store Config gives access to the viper backed store

Jump to

Keyboard shortcuts

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