okta-aws-cli icon indicating copy to clipboard operation
okta-aws-cli copied to clipboard

session-duration in okta.yaml is not respected

Open rickalm-wapo opened this issue 1 year ago • 3 comments

Other than the definition in the profile struct (SessionDuration) all other references are to AWSSessionDuration

rickalm-wapo avatar Feb 16 '24 19:02 rickalm-wapo

Thanks @rickalm-wapo I'll see about addressing this.

monde avatar Feb 22 '24 17:02 monde

@rickalm-wapo double checking with you, this is feedback on the variable name SessionDuration in config.go ? Is there a flaw or bug you've come up against?

monde avatar Feb 23 '24 20:02 monde

I'm also seeing expiry-aws-variables not respected either.

Why are the boolean values not set correctly in the struct?

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"`
	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"`
}

Not all these values are strings based on the Viper configuration.

attrs := Attributes{
    AllProfiles:         viper.GetBool(getFlagNameFromProfile(awsProfile, AllProfilesFlag)),
    AuthzID:             viper.GetString(getFlagNameFromProfile(awsProfile, AuthzIDFlag)),
    AWSCredentials:      viper.GetString(getFlagNameFromProfile(awsProfile, AWSCredentialsFlag)),
    AWSIAMIdP:           viper.GetString(getFlagNameFromProfile(awsProfile, AWSIAMIdPFlag)),
    AWSIAMRole:          viper.GetString(getFlagNameFromProfile(awsProfile, AWSIAMRoleFlag)),
    AWSRegion:           viper.GetString(getFlagNameFromProfile(awsProfile, AWSRegionFlag)),
    AWSSessionDuration:  viper.GetInt64(getFlagNameFromProfile(awsProfile, SessionDurationFlag)),
    CustomScope:         viper.GetString(getFlagNameFromProfile(awsProfile, CustomScopeFlag)),
    Debug:               viper.GetBool(getFlagNameFromProfile(awsProfile, DebugFlag)),
    DebugAPICalls:       viper.GetBool(getFlagNameFromProfile(awsProfile, DebugAPICallsFlag)),
    Exec:                viper.GetBool(getFlagNameFromProfile(awsProfile, ExecFlag)),
    FedAppID:            viper.GetString(getFlagNameFromProfile(awsProfile, AWSAcctFedAppIDFlag)),
    Format:              viper.GetString(getFlagNameFromProfile(awsProfile, FormatFlag)),
    LegacyAWSVariables:  viper.GetBool(getFlagNameFromProfile(awsProfile, LegacyAWSVariablesFlag)),
    ExpiryAWSVariables:  viper.GetBool(getFlagNameFromProfile(awsProfile, ExpiryAWSVariablesFlag)),
    CacheAccessToken:    viper.GetBool(getFlagNameFromProfile(awsProfile, CacheAccessTokenFlag)),
    OIDCAppID:           viper.GetString(getFlagNameFromProfile(awsProfile, OIDCClientIDFlag)),
    OpenBrowser:         viper.GetBool(getFlagNameFromProfile(awsProfile, OpenBrowserFlag)),
    OpenBrowserCommand:  viper.GetString(getFlagNameFromProfile(awsProfile, OpenBrowserCommandFlag)),
    OrgDomain:           viper.GetString(getFlagNameFromProfile(awsProfile, OrgDomainFlag)),
    PrivateKey:          viper.GetString(getFlagNameFromProfile(awsProfile, PrivateKeyFlag)),
    PrivateKeyFile:      viper.GetString(getFlagNameFromProfile(awsProfile, PrivateKeyFileFlag)),
    KeyID:               viper.GetString(getFlagNameFromProfile(awsProfile, KeyIDFlag)),
    Profile:             awsProfile,
    QRCode:              viper.GetBool(getFlagNameFromProfile(awsProfile, QRCodeFlag)),
    WriteAWSCredentials: viper.GetBool(getFlagNameFromProfile(awsProfile, WriteAWSCredentialsFlag)),
}

This may be part of the problem.

mikelorant avatar Mar 24 '24 23:03 mikelorant