-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multiple port support #108
Changes from 6 commits
69585ad
fe7dfcf
7bf7c07
7555b79
6000b9d
23d2af4
c2c1e90
0a2e8e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,11 +39,13 @@ func init() { | |
getCmd.Flags().String(FlagRoleSessionName, "KeyConjurer-AssumeRole", "the name of the role session name that will show up in CloudTrail logs") | ||
getCmd.Flags().StringP(FlagOutputType, "o", outputTypeEnvironmentVariable, "Format to save new credentials in. Supported outputs: env, awscli,tencentcli") | ||
getCmd.Flags().String(FlagShellType, shellTypeInfer, "If output type is env, determines which format to output credentials in - by default, the format is inferred based on the execution environment. WSL users may wish to overwrite this to `bash`") | ||
getCmd.Flags().String(FlagAWSCLIPath, "~/.aws/", "Path for directory used by the aws-cli tool. Default is \"~/.aws\".") | ||
getCmd.Flags().String(FlagTencentCLIPath, "~/.tencent/", "Path for directory used by the tencent-cli tool. Default is \"~/.tencent\".") | ||
getCmd.Flags().String(FlagCloudType, "aws", "Choose a cloud vendor. Default is aws. Can choose aws or tencent") | ||
getCmd.Flags().Bool(FlagBypassCache, false, "Do not check the cache for accounts and send the application ID as-is to Okta. This is useful if you have an ID you know is an Okta application ID and it is not stored in your local account cache.") | ||
getCmd.Flags().Bool(FlagLogin, false, "Login to Okta before running the command") | ||
getCmd.Flags().String(FlagAWSCLIPath, "~/.aws/", "Path for directory used by the aws CLI") | ||
getCmd.Flags().BoolP(FlagURLOnly, "u", false, "Print only the URL to visit rather than a user-friendly message") | ||
getCmd.Flags().BoolP(FlagNoBrowser, "b", false, "Do not open a browser window, printing the URL instead") | ||
Comment on lines
+47
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would be the use cases for these options? Is it supposed to be used by users or dev for debugging purposes? Can you give a few examples? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These options are mirroring the options in The main use-case for these is that if you specify the
|
||
} | ||
|
||
func isMemberOfSlice(slice []string, val string) bool { | ||
|
@@ -74,16 +76,22 @@ A role must be specified when using this command through the --role flag. You ma | |
ctx := cmd.Context() | ||
oidcDomain, _ := cmd.Flags().GetString(FlagOIDCDomain) | ||
clientID, _ := cmd.Flags().GetString(FlagClientID) | ||
|
||
if HasTokenExpired(config.Tokens) { | ||
if ok, _ := cmd.Flags().GetBool(FlagLogin); ok { | ||
token, err := Login(ctx, oidcDomain, clientID, LoginOutputModeBrowser{}) | ||
if err != nil { | ||
return err | ||
urlOnly, _ := cmd.Flags().GetBool(FlagURLOnly) | ||
noBrowser, _ := cmd.Flags().GetBool(FlagNoBrowser) | ||
login := LoginCommand{ | ||
Config: config, | ||
OIDCDomain: oidcDomain, | ||
ClientID: clientID, | ||
MachineOutput: ShouldUseMachineOutput(cmd.Flags()) || urlOnly, | ||
NoBrowser: noBrowser, | ||
} | ||
if err := config.SaveOAuthToken(token); err != nil { | ||
|
||
if err := login.Execute(cmd.Context()); err != nil { | ||
return err | ||
} | ||
|
||
} else { | ||
return ErrTokensExpiredOrAbsent | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know how many ports Okta allows? I am wondering if we can add more if that makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but I want to try to increase this to 16 ports that are non-contiguous from the 40 to 50k range