Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/saml2alibabacloud/commands/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func resolveLoginDetails(account *cfg.IDPAccount, loginFlags *flags.LoginExecFla

// log.Printf("loginFlags %+v", loginFlags)

loginDetails := &creds.LoginDetails{URL: account.URL, Username: account.Username, MFAToken: loginFlags.CommonFlags.MFAToken, DuoMFAOption: loginFlags.DuoMFAOption}
loginDetails := &creds.LoginDetails{URL: account.URL, Username: account.Username, MFAToken: loginFlags.CommonFlags.MFAToken, DuoMFAOption: loginFlags.DuoMFAOption, Provider: account.Provider}

log.Printf("Using IDP Account %s to access %s %s", loginFlags.CommonFlags.IdpAccount, account.Provider, account.URL)

Expand Down Expand Up @@ -162,6 +162,12 @@ func resolveLoginDetails(account *cfg.IDPAccount, loginFlags *flags.LoginExecFla
loginDetails.ClientSecret = loginFlags.CommonFlags.ClientSecret
}

if loginFlags.DownloadBrowser {
loginDetails.DownloadBrowser = loginFlags.DownloadBrowser
} else if account.DownloadBrowser {
loginDetails.DownloadBrowser = account.DownloadBrowser
}

// log.Printf("loginDetails %+v", loginDetails)

// if skip prompt was passed just pass back the flag values
Expand Down
8 changes: 6 additions & 2 deletions cmd/saml2alibabacloud/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var (
// Version app version
Version = "0.0.7"
Version = "0.0.8"
)

// The `cmdLineList` type is used to make a `[]string` meet the requirements
Expand Down Expand Up @@ -60,7 +60,7 @@ func main() {

// Settings not related to commands
verbose := app.Flag("verbose", "Enable verbose logging").Bool()
provider := app.Flag("provider", "This flag is obsolete. See: https://github.com/aliyun/saml2alibabacloud#configuring-idp-accounts").Short('i').Enum("Akamai", "AzureAD", "ADFS", "ADFS2", "Ping", "JumpCloud", "Okta", "OneLogin", "PSU", "KeyCloak")
provider := app.Flag("provider", "This flag is obsolete. See: https://github.com/aliyun/saml2alibabacloud#configuring-idp-accounts").Short('i').Enum("Akamai", "AzureAD", "ADFS", "ADFS2", "Ping", "JumpCloud", "Okta", "OneLogin", "PSU", "KeyCloak", "Browser")

// Common (to all commands) settings
commonFlags := new(flags.CommonFlags)
Expand All @@ -79,6 +79,9 @@ func main() {
app.Flag("session-duration", "The duration of your AlibabaCloud Session. (env: SAML2ALIBABACLOUD_SESSION_DURATION)").Envar("SAML2ALIBABACLOUD_SESSION_DURATION").IntVar(&commonFlags.SessionDuration)
app.Flag("disable-keychain", "Do not use keychain at all.").Envar("SAML2ALIBABACLOUD_DISABLE_KEYCHAIN").BoolVar(&commonFlags.DisableKeychain)
app.Flag("region", "AlibabaCloud region to use for API requests, e.g. cn-hangzhou, ap-southeast-1 (env: SAML2ALIBABACLOUD_REGION)").Envar("SAML2ALIBABACLOUD_REGION").Short('r').StringVar(&commonFlags.Region)
app.Flag("browser-type", "The configured browser type when the IDP provider is set to Browser. if not set 'chromium' will be used. (env: SAML2ALIBABACLOUD_BROWSER_TYPE)").Envar("SAML2ALIBABACLOUD_BROWSER_TYPE").EnumVar(&commonFlags.BrowserType, "chromium", "firefox", "webkit", "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", "msedge-canary")
app.Flag("browser-executable-path", "The configured browser full path when the IDP provider is set to Browser. If set, no browser download will be performed and the executable path will be used instead. (env: SAML2ALIBABACLOUD_BROWSER_EXECUTABLE_PATH)").Envar("SAML2ALIBABACLOUD_BROWSER_EXECUTABLE_PATH").StringVar(&commonFlags.BrowserExecutablePath)
app.Flag("browser-autofill", "Configures browser to autofill the username and password. (env: SAML2ALIBABACLOUD_BROWSER_AUTOFILL)").Envar("SAML2ALIBABACLOUD_BROWSER_AUTOFILL").BoolVar(&commonFlags.BrowserAutoFill)

// `configure` command and settings
cmdConfigure := app.Command("configure", "Configure a new IDP account.")
Expand All @@ -99,6 +102,7 @@ func main() {
cmdLogin.Flag("client-id", "OneLogin client id, used to generate API access token. (env: ONELOGIN_CLIENT_ID)").Envar("ONELOGIN_CLIENT_ID").StringVar(&commonFlags.ClientID)
cmdLogin.Flag("client-secret", "OneLogin client secret, used to generate API access token. (env: ONELOGIN_CLIENT_SECRET)").Envar("ONELOGIN_CLIENT_SECRET").StringVar(&commonFlags.ClientSecret)
cmdLogin.Flag("force", "Refresh credentials even if not expired.").BoolVar(&loginFlags.Force)
cmdLogin.Flag("download-browser-driver", "Automatically download browsers for Browser IDP. (env: SAML2ALIBABACLOUD_AUTO_BROWSER_DOWNLOAD)").Envar("SAML2ALIBABACLOUD_AUTO_BROWSER_DOWNLOAD").BoolVar(&loginFlags.DownloadBrowser)

// `exec` command and settings
cmdExec := app.Command("exec", "Exec the supplied command with env vars from STS token.")
Expand Down
24 changes: 17 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/aliyun/saml2alibabacloud

go 1.21.0
go 1.22

toolchain go1.22.3
toolchain go1.24.0

require (
github.com/99designs/keyring v1.2.2
Expand All @@ -19,23 +19,29 @@ require (
github.com/marshallbrekka/go-u2fhost v0.0.0-20200107013215-ad5fdc1986ac
github.com/mitchellh/go-homedir v1.0.0
github.com/pkg/errors v0.9.1
github.com/playwright-community/playwright-go v0.5001.0
github.com/sirupsen/logrus v1.9.3
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.1.1
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.17.0
golang.org/x/net v0.24.0
gopkg.in/ini.v1 v1.57.0
)

require (
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/alecthomas/gometalinter v3.0.0+incompatible // indirect
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
github.com/alecthomas/units v0.0.0-20190910110746-680d30ca3117 // indirect
github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/creack/pty v1.1.20 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/godbus/dbus v4.1.0+incompatible // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.5 // indirect
Expand All @@ -48,17 +54,21 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
github.com/mtibben/percent v0.2.1 // indirect
github.com/nicksnyder/go-i18n v1.10.3 // indirect
github.com/onsi/ginkgo v1.14.2 // indirect
github.com/onsi/gomega v1.10.3 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tidwall/match v1.0.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20191105091915-95d230a53780 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading