diff --git a/pkg/assume/assume.go b/pkg/assume/assume.go index a30c0b27..177a47a2 100644 --- a/pkg/assume/assume.go +++ b/pkg/assume/assume.go @@ -97,6 +97,7 @@ func processArgsAndExecFlag(c *cli.Context, assumeFlags *cfflags.Flags) (string, } func AssumeCommand(c *cli.Context) error { + // assumeFlags allows flags to be passed on either side of the role argument. // to access flags in this command, use assumeFlags.String("region") etc instead of c.String("region") assumeFlags, err := cfflags.New("assumeFlags", GlobalFlags(), c) @@ -429,8 +430,8 @@ func AssumeCommand(c *cli.Context) error { var l Launcher switch cfg.DefaultBrowser { - case browser.ChromeKey, browser.BraveKey, browser.EdgeKey, browser.ChromiumKey, browser.VivaldiKey: - l = launcher.ChromeProfile{ + case browser.ChromeKey, browser.BraveKey, browser.EdgeKey, browser.ChromiumKey: + l = launcher.Chrome{ BrowserType: cfg.DefaultBrowser, ExecutablePath: browserPath, } @@ -471,6 +472,9 @@ func AssumeCommand(c *cli.Context) error { return fmt.Errorf("error building browser launch command: %w", err) } + // add browser extra flags here to avoid modifying all interface methods (current and future ones) + args = append(args, cfg.CustomBrowserExtraFlags...) + var startErr error if l.UseForkProcess() { clio.Debugf("running command using forkprocess: %s", args) diff --git a/pkg/cfaws/assumer_aws_sso.go b/pkg/cfaws/assumer_aws_sso.go index fb6d5a29..007dadd7 100644 --- a/pkg/cfaws/assumer_aws_sso.go +++ b/pkg/cfaws/assumer_aws_sso.go @@ -216,7 +216,6 @@ func (c *Profile) SSOLogin(ctx context.Context, configOpts ConfigOpts) (aws.Cred cfg := aws.NewConfig() cfg.Region = c.SSORegion() - return c.SSOLoginWithToken(ctx, cfg, accessToken, secureSSOTokenStorage, configOpts) } diff --git a/pkg/config/config.go b/pkg/config/config.go index f905a110..97e7aca4 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -34,8 +34,9 @@ type BrowserLaunchTemplate struct { type Config struct { DefaultBrowser string // used to override the builtin filepaths for custom installation locations - CustomBrowserPath string - CustomSSOBrowserPath string + CustomBrowserPath string + CustomSSOBrowserPath string + CustomBrowserExtraFlags []string // AWSConsoleBrowserLaunchTemplate is an optional launch template to use // for opening the AWS console. If specified it overrides the DefaultBrowser diff --git a/pkg/granted/console.go b/pkg/granted/console.go index b3f0fa50..0ccab0ea 100644 --- a/pkg/granted/console.go +++ b/pkg/granted/console.go @@ -74,23 +74,23 @@ var ConsoleCommand = cli.Command{ } else { switch cfg.DefaultBrowser { case browser.ChromeKey: - l = launcher.ChromeProfile{ + l = launcher.Chrome{ ExecutablePath: cfg.CustomBrowserPath, } case browser.BraveKey: - l = launcher.ChromeProfile{ + l = launcher.Chrome{ ExecutablePath: cfg.CustomBrowserPath, } case browser.EdgeKey: - l = launcher.ChromeProfile{ + l = launcher.Chrome{ ExecutablePath: cfg.CustomBrowserPath, } case browser.ChromiumKey: - l = launcher.ChromeProfile{ + l = launcher.Chrome{ ExecutablePath: cfg.CustomBrowserPath, } case browser.VivaldiKey: - l = launcher.ChromeProfile{ + l = launcher.Chrome{ ExecutablePath: cfg.CustomBrowserPath, } case browser.FirefoxKey: diff --git a/pkg/launcher/chrome_profile.go b/pkg/launcher/chrome_profile.go index 11117109..64531865 100644 --- a/pkg/launcher/chrome_profile.go +++ b/pkg/launcher/chrome_profile.go @@ -12,14 +12,14 @@ import ( "github.com/common-fate/granted/pkg/browser" ) -type ChromeProfile struct { +type Chrome struct { // ExecutablePath is the path to the Chrome binary on the system. ExecutablePath string BrowserType string } -func (l ChromeProfile) LaunchCommand(url string, profile string) ([]string, error) { +func (l Chrome) LaunchCommand(url string, profile string) ([]string, error) { // Chrome profiles can't contain slashes profileName := strings.ReplaceAll(profile, "/", "-") profileDir := findBrowserProfile(profileName, l.BrowserType) @@ -249,4 +249,4 @@ func getLocalStatePath(browserType string) (stateFile string, err error) { return stateFile, nil } -func (l ChromeProfile) UseForkProcess() bool { return true } +func (l Chrome) UseForkProcess() bool { return true }