Documentation ¶
Index ¶
- Constants
- Variables
- func AssumeAwsRole(samlResponse *string, samlAwsRole *samlAwsRole, sessionTime *int64) (*credentials.Credentials, error)
- func DeleteProfileSettings(profileName string) error
- func DisplayGlobalFlags()
- func ForceBatch()
- func Information(format string, args ...interface{})
- func LoadConfig() error
- func SelectAwsRoleFromSaml(session *LoginSession, saml *string, roleSelection bool) (*samlAwsRole, error)
- func SetGlobalFlags(flags *pflag.FlagSet)
- func StoreDefaultSettings(globalSettings *DefaultSettings) error
- func StoreProfileSettings(profileSettings *ProfileSettings) error
- func WriteAwsCredentials(session *LoginSession, cred *credentials.Credentials) error
- type Auth0Error
- type Auth0IdentityProvider
- func (p *Auth0IdentityProvider) ConfigurationFlags(flags *pflag.FlagSet)
- func (p *Auth0IdentityProvider) Configure(config *LoginSession) error
- func (p *Auth0IdentityProvider) Login() (*string, error)
- func (p *Auth0IdentityProvider) OverrideFlags(flags *pflag.FlagSet)
- func (p *Auth0IdentityProvider) Validate() error
- type Auth0ProfileSettings
- func (p *Auth0ProfileSettings) Create() IdpProfile
- func (p *Auth0ProfileSettings) Load(s *viper.Viper)
- func (p *Auth0ProfileSettings) Log(profileName *string)
- func (p *Auth0ProfileSettings) Prompt(rootProfileName *string, flagConfigProvider ConfigProvider, ...) error
- func (p *Auth0ProfileSettings) Store(tree *toml.Tree, prefix string) error
- func (p *Auth0ProfileSettings) Validate() error
- type ConfigProvider
- type DefaultSettings
- type IdpProfile
- type LoginSession
- type OfaStore
- type OktaIdentityProvider
- func (p *OktaIdentityProvider) ConfigurationFlags(flags *pflag.FlagSet)
- func (p *OktaIdentityProvider) Configure(config *LoginSession) error
- func (p *OktaIdentityProvider) Login() (*string, error)
- func (p *OktaIdentityProvider) OverrideFlags(flags *pflag.FlagSet)
- func (p *OktaIdentityProvider) Validate() error
- type OktaProfileSettings
- func (p *OktaProfileSettings) Create() IdpProfile
- func (p *OktaProfileSettings) Load(s *viper.Viper)
- func (p *OktaProfileSettings) Log(profileName *string)
- func (p *OktaProfileSettings) Prompt(rootProfileName *string, flagConfigProvider ConfigProvider, ...) error
- func (p *OktaProfileSettings) Store(tree *toml.Tree, prefix string) error
- func (p *OktaProfileSettings) Validate() error
- type OneloginIdentityProvider
- func (p *OneloginIdentityProvider) ConfigurationFlags(flags *pflag.FlagSet)
- func (p *OneloginIdentityProvider) Configure(config *LoginSession) error
- func (p *OneloginIdentityProvider) Login() (*string, error)
- func (p *OneloginIdentityProvider) OverrideFlags(flags *pflag.FlagSet)
- func (p *OneloginIdentityProvider) Validate() error
- type OneloginProfileSettings
- func (p *OneloginProfileSettings) Create() IdpProfile
- func (p *OneloginProfileSettings) Load(s *viper.Viper)
- func (p *OneloginProfileSettings) Log(profileName *string)
- func (p *OneloginProfileSettings) Prompt(rootProfileName *string, flagConfigProvider ConfigProvider, ...) error
- func (p *OneloginProfileSettings) Store(tree *toml.Tree, prefix string) error
- func (p *OneloginProfileSettings) Validate() error
- type ProfileSettings
- type StoreConfigProvider
Constants ¶
View Source
const ( FlagInteractive = "interactive" FlagBatch = "batch" FlagVerbose = "verbose" FlagQuiet = "quiet" FlagNoConfig = "no-config" FlagSetInteractive = "set-interactive" FlagSetVerbose = "set-verbose" FlagSetProfile = "set-profile" FlagSetProfileType = "set-profile-type" FlagSetAwsAccount = "set-account" FlagSetAwsRole = "set-role" FlagSetSessionTime = "set-session-time" FlagSetUser = "set-user" FlagSetURL = "set-url" FlagEval = "eval" FlagNoProfile = "no-default-profile" FlagNoRole = "no-default-role" FlagPassword = "password" FlagProfile = "profile" FlagAwsAccount = "account" FlagAwsRole = "role" FlagSessionTime = "session-time" FlagUser = "user" FlagProfileType = "profile-type" FlagURL = "url" FlagDescSetVerbose = "Sets the default verbose flag." FlagDescSetInteractive = "Sets the default interactive flag." FlagDescSetProfileName = "Sets the default profile name." FlagDescSetURL = "Sets the base/organization URL." FlagDescSetProfileType = "Sets the profile type " + allAuthTypes + "." FlagDescSetUser = "Sets the username." FlagDescSetAwsAccount = "Sets the AWS account for the role to assume." FlagDescSetAwsRole = "Sets the AWS role to assume." FlagDescSetSessionTime = "Sets the AWS session time." FlagDescEval = "Do not save AWS credentials, echo on stdout for eval." FlagDescUser = "Username to use." FlagDescProfile = "The profile to use." FlagDescProfileType = "Profile Type to use " + allAuthTypes + "." FlagDescPassword = "Password to use." FlagDescAwsAccount = "AWS account for the role to assume." FlagDescAwsRole = "AWS role to assume." FlagDescSessionTime = "AWS session time to use." FlagDescURL = "Base/organization URL to use." FlagDescNoProfile = "Ignore default profile." FlagDescNoRole = "Ignore default role." )
View Source
const ( StateLogin = "LOGIN" StateSuccess = "SUCCESS" StateMfaRequired = "MFA_REQUIRED" StateMfaChallenge = "MFA_CHALLENGE" StateMfaPrompt = "MFA_PROMPT" StateMfaVerify = "MFA_VERIFY" StateSamlAssert = "SAML_ASSERT" )
Variables ¶
View Source
var ( IdentityProviders = map[string]identityProvider{ // contains filtered or unexported fields } )
Functions ¶
func AssumeAwsRole ¶
func AssumeAwsRole(samlResponse *string, samlAwsRole *samlAwsRole, sessionTime *int64) (*credentials.Credentials, error)
AssumeAwsRole takes the SAML credentials and assumes an AWS role
func DeleteProfileSettings ¶
func DisplayGlobalFlags ¶
func DisplayGlobalFlags()
func ForceBatch ¶
func ForceBatch()
func Information ¶
func Information(format string, args ...interface{})
func SelectAwsRoleFromSaml ¶
func SelectAwsRoleFromSaml(session *LoginSession, saml *string, roleSelection bool) (*samlAwsRole, error)
func SetGlobalFlags ¶
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 Auth0Error ¶
type Auth0IdentityProvider ¶
type Auth0IdentityProvider struct { AuthMethod *string `validate:"omitempty,oneof=push sms voice totp recovery-code"` ClientId *string `validate:"required"` ClientSecret *string `validate:"required"` // contains filtered or unexported fields }
func (*Auth0IdentityProvider) ConfigurationFlags ¶
func (p *Auth0IdentityProvider) ConfigurationFlags(flags *pflag.FlagSet)
func (*Auth0IdentityProvider) Configure ¶
func (p *Auth0IdentityProvider) Configure(config *LoginSession) error
func (*Auth0IdentityProvider) Login ¶
func (p *Auth0IdentityProvider) Login() (*string, error)
Login logs into Auth0 using username and password
func (*Auth0IdentityProvider) OverrideFlags ¶
func (p *Auth0IdentityProvider) OverrideFlags(flags *pflag.FlagSet)
func (*Auth0IdentityProvider) Validate ¶
func (p *Auth0IdentityProvider) Validate() error
type Auth0ProfileSettings ¶
type Auth0ProfileSettings struct {
// contains filtered or unexported fields
}
func (*Auth0ProfileSettings) Create ¶
func (p *Auth0ProfileSettings) Create() IdpProfile
func (*Auth0ProfileSettings) Load ¶
func (p *Auth0ProfileSettings) Load(s *viper.Viper)
func (*Auth0ProfileSettings) Log ¶
func (p *Auth0ProfileSettings) Log(profileName *string)
func (*Auth0ProfileSettings) Prompt ¶
func (p *Auth0ProfileSettings) Prompt(rootProfileName *string, flagConfigProvider ConfigProvider, identityProviders map[string]IdpProfile) error
func (*Auth0ProfileSettings) Store ¶
func (p *Auth0ProfileSettings) Store(tree *toml.Tree, prefix string) error
func (*Auth0ProfileSettings) Validate ¶
func (p *Auth0ProfileSettings) Validate() error
type ConfigProvider ¶
type ConfigProvider func(field string) configField
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 IdpProfile ¶
type IdpProfile interface { Create() IdpProfile Validate() error Log(profileName *string) Prompt(rootProfileName *string, flagConfigProvider ConfigProvider, identityProviders map[string]IdpProfile) error Load(s *viper.Viper) Store(tree *toml.Tree, prefix string) error }
type LoginSession ¶
type LoginSession struct { ProfileName string `validate:"omitempty"` URL *url.URL `validate:"required,url"` User string `validate:"required"` Password *string `validate:"required"` ProfileType string `validate:"required,oneof=okta auth0 onelogin"` AwsAccount *string `validate:"omitempty"` AwsRole *string `validate:"omitempty"` AwsSessionTime *int64 `validate:"omitempty,gte=3600,lte=86400"` // one hour to one day IdentityProvider identityProvider // contains filtered or unexported fields }
LoginSession is the main Session structure for the ofa application.
func CreateLoginSession ¶
func CreateLoginSession(flags *pflag.FlagSet, noProfile bool) (*LoginSession, error)
CreateLoginSession creates a new configuration object with all the fields filled in
type OktaIdentityProvider ¶
type OktaIdentityProvider struct { AppURL *url.URL `validate:"required,url"` AuthMethod *string `validate:"omitempty,oneof=totp sms push"` // contains filtered or unexported fields }
func (*OktaIdentityProvider) ConfigurationFlags ¶
func (p *OktaIdentityProvider) ConfigurationFlags(flags *pflag.FlagSet)
func (*OktaIdentityProvider) Configure ¶
func (p *OktaIdentityProvider) Configure(config *LoginSession) error
func (*OktaIdentityProvider) Login ¶
func (p *OktaIdentityProvider) Login() (*string, error)
func (*OktaIdentityProvider) OverrideFlags ¶
func (p *OktaIdentityProvider) OverrideFlags(flags *pflag.FlagSet)
func (*OktaIdentityProvider) Validate ¶
func (p *OktaIdentityProvider) Validate() error
type OktaProfileSettings ¶
type OktaProfileSettings struct {
// contains filtered or unexported fields
}
func (*OktaProfileSettings) Create ¶
func (p *OktaProfileSettings) Create() IdpProfile
func (*OktaProfileSettings) Load ¶
func (p *OktaProfileSettings) Load(s *viper.Viper)
func (*OktaProfileSettings) Log ¶
func (p *OktaProfileSettings) Log(profileName *string)
func (*OktaProfileSettings) Prompt ¶
func (p *OktaProfileSettings) Prompt(rootProfileName *string, flagConfigProvider ConfigProvider, identityProviders map[string]IdpProfile) error
func (*OktaProfileSettings) Store ¶
func (p *OktaProfileSettings) Store(tree *toml.Tree, prefix string) error
func (*OktaProfileSettings) Validate ¶
func (p *OktaProfileSettings) Validate() error
type OneloginIdentityProvider ¶
type OneloginIdentityProvider struct { AuthMethod *string `validate:"omitempty,oneof=push totp sms email"` ClientId *string `validate:"required"` ClientSecret *string `validate:"required"` AppId *string `validate:"required"` ApiUrl *url.URL `validate:"required,url"` // contains filtered or unexported fields }
func (*OneloginIdentityProvider) ConfigurationFlags ¶
func (p *OneloginIdentityProvider) ConfigurationFlags(flags *pflag.FlagSet)
func (*OneloginIdentityProvider) Configure ¶
func (p *OneloginIdentityProvider) Configure(config *LoginSession) error
func (*OneloginIdentityProvider) Login ¶
func (p *OneloginIdentityProvider) Login() (*string, error)
func (*OneloginIdentityProvider) OverrideFlags ¶
func (p *OneloginIdentityProvider) OverrideFlags(flags *pflag.FlagSet)
func (*OneloginIdentityProvider) Validate ¶
func (p *OneloginIdentityProvider) Validate() error
type OneloginProfileSettings ¶
type OneloginProfileSettings struct {
// contains filtered or unexported fields
}
func (*OneloginProfileSettings) Create ¶
func (p *OneloginProfileSettings) Create() IdpProfile
func (*OneloginProfileSettings) Load ¶
func (p *OneloginProfileSettings) Load(s *viper.Viper)
func (*OneloginProfileSettings) Log ¶
func (p *OneloginProfileSettings) Log(profileName *string)
func (*OneloginProfileSettings) Prompt ¶
func (p *OneloginProfileSettings) Prompt(rootProfileName *string, flagConfigProvider ConfigProvider, identityProviders map[string]IdpProfile) error
func (*OneloginProfileSettings) Store ¶
func (p *OneloginProfileSettings) Store(tree *toml.Tree, prefix string) error
func (*OneloginProfileSettings) Validate ¶
func (p *OneloginProfileSettings) Validate() error
type ProfileSettings ¶
type ProfileSettings struct { ProfileName *string ProfileType *string `validate:"omitempty,oneof=okta auth0 onelogin"` URL *string `validate:"omitempty,url"` User *string `validate:"omitempty"` AwsAccount *string `validate:"omitempty"` AwsRole *string `validate:"omitempty"` AwsSessionTime *int64 `validate:"omitempty,gte=3600,lte=86400"` // contains filtered or unexported fields }
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
}
Click to show internal directories.
Click to hide internal directories.