config

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Version app version
	Version = "2.6.0"

	// AWSCredentialsFormat format const
	AWSCredentialsFormat = "aws-credentials"
	// EnvVarFormat format const
	EnvVarFormat = "env-var"
	// ProcessCredentialsFormat format const
	ProcessCredentialsFormat = "process-credentials"
	// NoopFormat format const
	NoopFormat = "noop"

	// AllProfilesFlag cli flag const
	AllProfilesFlag = "all-profiles"
	// AuthzIDFlag cli flag const
	AuthzIDFlag = "authz-id"
	// AWSAcctFedAppIDFlag cli flag const
	AWSAcctFedAppIDFlag = "aws-acct-fed-app-id"
	// AWSCredentialsFlag cli flag const
	AWSCredentialsFlag = "aws-credentials"
	// AWSIAMIdPFlag cli flag const
	AWSIAMIdPFlag = "aws-iam-idp"
	// AWSIAMRoleFlag cli flag const
	AWSIAMRoleFlag = "aws-iam-role"
	// AWSRegionFlag cli flag const
	AWSRegionFlag = "aws-region"
	// AWSSessionDurationFlag cli flag const
	AWSSessionDurationFlag = "aws-session-duration"
	// AWSSTSRoleSessionNameFlag cli flag const
	AWSSTSRoleSessionNameFlag = "aws-sts-role-session-name"
	// CustomScopeFlag cli flag const
	CustomScopeFlag = "custom-scope"
	// DebugFlag cli flag const
	DebugFlag = "debug"
	// DebugAPICallsFlag cli flag const
	DebugAPICallsFlag = "debug-api-calls"
	// ExecFlag cli flag const
	ExecFlag = "exec"
	// FormatFlag cli flag const
	FormatFlag = "format"
	// OIDCClientIDFlag cli flag const
	OIDCClientIDFlag = "oidc-client-id"
	// OpenBrowserFlag cli flag const
	OpenBrowserFlag = "open-browser"
	// OpenBrowserCommandFlag cli flag const
	OpenBrowserCommandFlag = "open-browser-command"
	// OrgDomainFlag cli flag const
	OrgDomainFlag = "org-domain"
	// PrivateKeyFlag cli flag const
	PrivateKeyFlag = "private-key"
	// PrivateKeyFileFlag cli flag const
	PrivateKeyFileFlag = "private-key-file"
	// KeyIDFlag cli flag const
	KeyIDFlag = "key-id"
	// ProfileFlag cli flag const
	ProfileFlag = "profile"
	// QRCodeFlag cli flag const
	QRCodeFlag = "qr-code"
	// SessionDurationFlag DEPRECATED cli flag const
	SessionDurationFlag = "session-duration"
	// ShortUserAgentFlag cli flag const
	ShortUserAgentFlag = "short-user-agent"
	// WriteAWSCredentialsFlag cli flag const
	WriteAWSCredentialsFlag = "write-aws-credentials"
	// LegacyAWSVariablesFlag cli flag const
	LegacyAWSVariablesFlag = "legacy-aws-variables"
	// ExpiryAWSVariablesFlag cli flag const
	ExpiryAWSVariablesFlag = "expiry-aws-variables"
	// CacheAccessTokenFlag cli flag const
	CacheAccessTokenFlag = "cache-access-token"

	// UsernameFlag cli flag const
	UsernameFlag = "username"
	// PasswordFlag cli flag const
	PasswordFlag = "password"

	// AllProfilesEnvVar env var const
	AllProfilesEnvVar = "OKTA_AWSCLI_ALL_PROFILES"
	// AuthzIDEnvVar env var const
	AuthzIDEnvVar = "OKTA_AWSCLI_AUTHZ_ID"
	// AWSCredentialsEnvVar env var const
	AWSCredentialsEnvVar = "OKTA_AWSCLI_AWS_CREDENTIALS"
	// AWSIAMIdPEnvVar env var const
	AWSIAMIdPEnvVar = "OKTA_AWSCLI_IAM_IDP"
	// AWSIAMRoleEnvVar env var const
	AWSIAMRoleEnvVar = "OKTA_AWSCLI_IAM_ROLE"
	// AWSSessionDurationEnvVar env var const
	AWSSessionDurationEnvVar = "OKTA_AWSCLI_SESSION_DURATION"
	// AWSRegionEnvVar env var const
	AWSRegionEnvVar = "OKTA_AWSCLI_AWS_REGION"
	// AWSSTSRoleSessionNameEnvVar env var const
	AWSSTSRoleSessionNameEnvVar = "OKTA_AWSCLI_STS_ROLE_SESSION_NAME"
	// CacheAccessTokenEnvVar env var const
	CacheAccessTokenEnvVar = "OKTA_AWSCLI_CACHE_ACCESS_TOKEN"
	// CustomScopeEnvVar env var const
	CustomScopeEnvVar = "OKTA_AWSCLI_CUSTOM_SCOPE"
	// DebugEnvVar env var const
	DebugEnvVar = "OKTA_AWSCLI_DEBUG"
	// DebugAPICallsEnvVar env var const
	DebugAPICallsEnvVar = "OKTA_AWSCLI_DEBUG_API_CALLS"
	// ExpiryAWSVariablesEnvVar env var const
	ExpiryAWSVariablesEnvVar = "OKTA_AWSCLI_EXPIRY_AWS_VARIABLES"
	// ExecEnvVar env var const
	ExecEnvVar = "OKTA_AWSCLI_EXEC"
	// FormatEnvVar env var const
	FormatEnvVar = "OKTA_AWSCLI_FORMAT"
	// LegacyAWSVariablesEnvVar env var const
	LegacyAWSVariablesEnvVar = "OKTA_AWSCLI_LEGACY_AWS_VARIABLES"
	// OktaOIDCClientIDEnvVar env var const
	OktaOIDCClientIDEnvVar = "OKTA_AWSCLI_OIDC_CLIENT_ID"
	// OldOktaOIDCClientIDEnvVar env var const
	OldOktaOIDCClientIDEnvVar = "OKTA_OIDC_CLIENT_ID"
	// OktaOrgDomainEnvVar env var const
	OktaOrgDomainEnvVar = "OKTA_AWSCLI_ORG_DOMAIN"
	// OldOktaOrgDomainEnvVar env var const
	OldOktaOrgDomainEnvVar = "OKTA_ORG_DOMAIN"
	// OktaAWSAccountFederationAppIDEnvVar env var const
	OktaAWSAccountFederationAppIDEnvVar = "OKTA_AWSCLI_AWS_ACCOUNT_FEDERATION_APP_ID"
	// OldOktaAWSAccountFederationAppIDEnvVar env var const
	OldOktaAWSAccountFederationAppIDEnvVar = "OKTA_AWS_ACCOUNT_FEDERATION_APP_ID"
	// OpenBrowserEnvVar env var const
	OpenBrowserEnvVar = "OKTA_AWSCLI_OPEN_BROWSER"
	// OpenBrowserCommandEnvVar env var const
	OpenBrowserCommandEnvVar = "OKTA_AWSCLI_OPEN_BROWSER_COMMAND"
	// PrivateKeyEnvVar env var const
	PrivateKeyEnvVar = "OKTA_AWSCLI_PRIVATE_KEY"
	// PrivateKeyFileEnvVar env var const
	PrivateKeyFileEnvVar = "OKTA_AWSCLI_PRIVATE_KEY_FILE"
	// KeyIDEnvVar env var const
	KeyIDEnvVar = "OKTA_AWSCLI_KEY_ID"
	// ProfileEnvVar env var const
	ProfileEnvVar = "OKTA_AWSCLI_PROFILE"
	// QRCodeEnvVar env var const
	QRCodeEnvVar = "OKTA_AWSCLI_QR_CODE"
	// ShortUserAgentEnvVar env var const
	ShortUserAgentEnvVar = "OKTA_AWSCLI_DEBUG_SHORT_USER_AGENT"
	// WriteAWSCredentialsEnvVar env var const
	WriteAWSCredentialsEnvVar = "OKTA_AWSCLI_WRITE_AWS_CREDENTIALS"

	// UsernameEnvVar env var const
	UsernameEnvVar = "OKTA_AWSCLI_USERNAME"
	// PasswordEnvVar env var const
	PasswordEnvVar = "OKTA_AWSCLI_PASSWORD"

	// CannotBeBlankErrMsg error message const
	CannotBeBlankErrMsg = "cannot be blank"
	// OrgDomainMsg error message const
	OrgDomainMsg = "Org Domain"

	// DotOkta string const
	DotOkta = ".okta"
	// OktaYaml string const
	OktaYaml = "okta.yaml"
)
View Source
const PrependDebug = "[DEBUG] "

PrependDebug debug logline label

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	AllProfiles           bool
	AuthzID               string
	AWSCredentials        string
	AWSIAMIdP             string
	AWSIAMRole            string
	AWSRegion             string
	AWSSessionDuration    int64
	AWSSTSRoleSessionName string
	CacheAccessToken      bool
	CustomScope           string
	Debug                 bool
	DebugAPICalls         bool
	Exec                  bool
	ExpiryAWSVariables    bool
	FedAppID              string
	Format                string
	KeyID                 string
	LegacyAWSVariables    bool
	OIDCAppID             string
	OpenBrowser           bool
	OpenBrowserCommand    string
	OrgDomain             string
	PrivateKey            string
	PrivateKeyFile        string
	Profile               string
	QRCode                bool
	ShortUserAgent        bool
	WriteAWSCredentials   bool
	Username              string
	Password              string
}

Attributes attributes for config construction

type Clock

type Clock interface {
	Now() time.Time
}

Clock interface to abstract time operations

type Config

type Config struct {
	Logger logger.Logger
	// contains filtered or unexported fields
}

Config A config object for the CLI

External consumers of Config use its setters and getters to interact with the underlying data values encapsulated on the Attribute. This allows Config to control data access, be concerned with evaluation, validation, and not allowing direct access to values as is done on structs in the generic case.

func NewConfig

func NewConfig(attrs *Attributes) (*Config, error)

NewConfig create config from attributes

func NewEvaluatedConfig

func NewEvaluatedConfig() (*Config, error)

NewEvaluatedConfig Returns a new config loading and evaluating attributes in this order of precedence:

  1. CLI flags
  2. ENV variables
  3. .env file

func (*Config) AWSCredentials

func (c *Config) AWSCredentials() string

AWSCredentials --

func (*Config) AWSIAMIdP

func (c *Config) AWSIAMIdP() string

AWSIAMIdP --

func (*Config) AWSIAMRole

func (c *Config) AWSIAMRole() string

AWSIAMRole --

func (*Config) AWSRegion

func (c *Config) AWSRegion() string

AWSRegion --

func (*Config) AWSSTSRoleSessionName

func (c *Config) AWSSTSRoleSessionName() string

AWSSTSRoleSessionName --

func (*Config) AWSSessionDuration

func (c *Config) AWSSessionDuration() int64

AWSSessionDuration --

func (*Config) AllProfiles

func (c *Config) AllProfiles() bool

AllProfiles --

func (*Config) AuthzID

func (c *Config) AuthzID() string

AuthzID --

func (*Config) CacheAccessToken

func (c *Config) CacheAccessToken() bool

CacheAccessToken --

func (*Config) Clock

func (c *Config) Clock() Clock

Clock --

func (*Config) CustomScope

func (c *Config) CustomScope() string

CustomScope --

func (*Config) Debug

func (c *Config) Debug() bool

Debug --

func (*Config) DebugAPICalls

func (c *Config) DebugAPICalls() bool

DebugAPICalls --

func (*Config) Exec

func (c *Config) Exec() bool

Exec --

func (*Config) ExpiryAWSVariables

func (c *Config) ExpiryAWSVariables() bool

ExpiryAWSVariables --

func (*Config) FedAppID

func (c *Config) FedAppID() string

FedAppID --

func (*Config) Format

func (c *Config) Format() string

Format --

func (*Config) HTTPClient

func (c *Config) HTTPClient() *http.Client

HTTPClient --

func (*Config) IsProcessCredentialsFormat

func (c *Config) IsProcessCredentialsFormat() bool

IsProcessCredentialsFormat is our format process credentials?

func (*Config) KeyID

func (c *Config) KeyID() string

KeyID --

func (*Config) LegacyAWSVariables

func (c *Config) LegacyAWSVariables() bool

LegacyAWSVariables --

func (*Config) OIDCAppID

func (c *Config) OIDCAppID() string

OIDCAppID --

func (*Config) OpenBrowser

func (c *Config) OpenBrowser() bool

OpenBrowser --

func (*Config) OpenBrowserCommand

func (c *Config) OpenBrowserCommand() string

OpenBrowserCommand --

func (*Config) OrgDomain

func (c *Config) OrgDomain() string

OrgDomain --

func (*Config) Password

func (c *Config) Password() string

Password --

func (*Config) PrivateKey

func (c *Config) PrivateKey() string

PrivateKey --

func (*Config) PrivateKeyFile

func (c *Config) PrivateKeyFile() string

PrivateKeyFile --

func (*Config) Profile

func (c *Config) Profile() string

Profile --

func (*Config) QRCode

func (c *Config) QRCode() bool

QRCode --

func (*Config) ReadConfigProfileKeys

func (c *Config) ReadConfigProfileKeys() ([]string, error)

ReadConfigProfileKeys returns the config profile names

func (*Config) RunConfigChecks

func (c *Config) RunConfigChecks() (err error)

RunConfigChecks runs a series of checks on the okta.yaml config file

func (*Config) SetAWSCredentials

func (c *Config) SetAWSCredentials(credentials string) error

SetAWSCredentials --

func (*Config) SetAWSIAMIdP

func (c *Config) SetAWSIAMIdP(idp string) error

SetAWSIAMIdP --

func (*Config) SetAWSIAMRole

func (c *Config) SetAWSIAMRole(role string) error

SetAWSIAMRole --

func (*Config) SetAWSRegion

func (c *Config) SetAWSRegion(region string) error

SetAWSRegion --

func (*Config) SetAWSSTSRoleSessionName

func (c *Config) SetAWSSTSRoleSessionName(name string) error

SetAWSSTSRoleSessionName --

func (*Config) SetAWSSessionDuration

func (c *Config) SetAWSSessionDuration(duration int64) error

SetAWSSessionDuration --

func (*Config) SetAllProfiles

func (c *Config) SetAllProfiles(allProfiles bool) error

SetAllProfiles --

func (*Config) SetAuthzID

func (c *Config) SetAuthzID(authzID string) error

SetAuthzID --

func (*Config) SetCacheAccessToken

func (c *Config) SetCacheAccessToken(cacheAccessToken bool) error

SetCacheAccessToken --

func (*Config) SetClock

func (c *Config) SetClock(clock Clock)

SetClock --

func (*Config) SetCustomScope

func (c *Config) SetCustomScope(customScope string) error

SetCustomScope --

func (*Config) SetDebug

func (c *Config) SetDebug(debug bool) error

SetDebug --

func (*Config) SetDebugAPICalls

func (c *Config) SetDebugAPICalls(debugAPICalls bool) error

SetDebugAPICalls --

func (*Config) SetExec

func (c *Config) SetExec(exec bool) error

SetExec --

func (*Config) SetExpiryAWSVariables

func (c *Config) SetExpiryAWSVariables(expiryAWSVariables bool) error

SetExpiryAWSVariables --

func (*Config) SetFedAppID

func (c *Config) SetFedAppID(appID string) error

SetFedAppID --

func (*Config) SetFormat

func (c *Config) SetFormat(format string) error

SetFormat --

func (*Config) SetHTTPClient

func (c *Config) SetHTTPClient(client *http.Client) error

SetHTTPClient --

func (*Config) SetKeyID

func (c *Config) SetKeyID(keyID string) error

SetKeyID --

func (*Config) SetLegacyAWSVariables

func (c *Config) SetLegacyAWSVariables(legacyAWSVariables bool) error

SetLegacyAWSVariables --

func (*Config) SetOIDCAppID

func (c *Config) SetOIDCAppID(appID string) error

SetOIDCAppID --

func (*Config) SetOpenBrowser

func (c *Config) SetOpenBrowser(openBrowser bool) error

SetOpenBrowser --

func (*Config) SetOpenBrowserCommand

func (c *Config) SetOpenBrowserCommand(openBrowserCommand string) error

SetOpenBrowserCommand --

func (*Config) SetOrgDomain

func (c *Config) SetOrgDomain(domain string) error

SetOrgDomain --

func (*Config) SetPassword

func (c *Config) SetPassword(password string) error

SetPassword --

func (*Config) SetPrivateKey

func (c *Config) SetPrivateKey(privateKey string) error

SetPrivateKey --

func (*Config) SetPrivateKeyFile

func (c *Config) SetPrivateKeyFile(privateKeyFile string) error

SetPrivateKeyFile --

func (*Config) SetProfile

func (c *Config) SetProfile(profile string) error

SetProfile --

func (*Config) SetQRCode

func (c *Config) SetQRCode(qrCode bool) error

SetQRCode --

func (*Config) SetShortUserAgent

func (c *Config) SetShortUserAgent(shortUserAgent bool) error

SetShortUserAgent --

func (*Config) SetUsername

func (c *Config) SetUsername(username string) error

SetUsername --

func (*Config) SetWriteAWSCredentials

func (c *Config) SetWriteAWSCredentials(writeCredentials bool) error

SetWriteAWSCredentials --

func (*Config) ShortUserAgent

func (c *Config) ShortUserAgent() bool

ShortUserAgent --

func (*Config) UserAgent

func (c *Config) UserAgent() string

UserAgent the user agent value

func (*Config) Username

func (c *Config) Username() string

Username --

func (*Config) WriteAWSCredentials

func (c *Config) WriteAWSCredentials() bool

WriteAWSCredentials --

type OktaYamlConfig

type OktaYamlConfig struct {
	AWSCLI struct {
		IDPS     map[string]string                `yaml:"idps"`
		ROLES    map[string]string                `yaml:"roles"`
		PROFILES map[string]OktaYamlConfigProfile `yaml:"profiles"`
	} `yaml:"awscli"`
}

OktaYamlConfig represents config settings from $HOME/.okta/okta.yaml

func NewOktaYamlConfig

func NewOktaYamlConfig() (config *OktaYamlConfig, err error)

NewOktaYamlConfig returns an Okta YAML Config object representation of $HOME/.okta/okta.yaml

type OktaYamlConfigProfile

type OktaYamlConfigProfile struct {
	AllProfiles           string `yaml:"all-profiles"`
	AuthzID               string `yaml:"authz-id"`
	AWSAcctFedAppID       string `yaml:"aws-acct-fed-app-id"`
	AWSCredentials        string `yaml:"aws-credentials"`
	AWSIAMIdP             string `yaml:"aws-iam-idp"`
	AWSIAMRole            string `yaml:"aws-iam-role"`
	AWSRegion             string `yaml:"aws-region"`
	AWSSessionDuration    string `yaml:"aws-session-duration"`
	AWSSTSRoleSessionName string `yaml:"aws-sts-role-session-name"`
	CustomScope           string `yaml:"custom-scope"`
	Debug                 string `yaml:"debug"`
	DebugAPICalls         string `yaml:"debug-api-calls"`
	Exec                  string `yaml:"exec"`
	Format                string `yaml:"format"`
	OIDCClientID          string `yaml:"oidc-client-id"`
	OpenBrowser           string `yaml:"open-browser"`
	OpenBrowserCommand    string `yaml:"open-browser-command"`
	OrgDomain             string `yaml:"org-domain"`
	PrivateKey            string `yaml:"private-key"`
	PrivateKeyFile        string `yaml:"private-key-file"`
	KeyID                 string `yaml:"key-id"`
	Profile               string `yaml:"profile"`
	QRCode                string `yaml:"qr-code"`
	SessionDuration       string `yaml:"session-duration"`
	WriteAWSCredentials   string `yaml:"write-aws-credentials"`
	LegacyAWSVariables    string `yaml:"legacy-aws-variables"`
	ExpiryAWSVariables    string `yaml:"expiry-aws-variables"`
	CacheAccessToken      string `yaml:"cache-access-token"`
	Username              string `yaml:"username"`
	Password              string `yaml:"password"`
}

OktaYamlConfigProfile represents config settings that are indexed by profile name. This is a convenience struct pretty printing profile information from the list profiles command cmd/root/profileslist/profiles-list.go

Jump to

Keyboard shortcuts

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