diff --git a/aws_account.go b/aws_account.go index a12abb192..80f49b3b0 100644 --- a/aws_account.go +++ b/aws_account.go @@ -29,6 +29,11 @@ func ParseAWSAccounts(samlAssertion string) ([]*AWSAccount, error) { awsURL = "https://signin.amazonaws.cn/saml" } + if strings.Contains(string(decSamlAssertion), "signin.amazonaws-us-gov.com") { + fmt.Println("trying to login AWS GovCloud") + awsURL = "https://signin.amazonaws-us-gov.com/saml" + } + res, err := http.PostForm(awsURL, url.Values{"SAMLResponse": {samlAssertion}}) if err != nil { return nil, errors.Wrap(err, "error retrieving AWS login form") diff --git a/pkg/provider/okta/okta.go b/pkg/provider/okta/okta.go index a83d035bd..f4bc4971a 100644 --- a/pkg/provider/okta/okta.go +++ b/pkg/provider/okta/okta.go @@ -269,7 +269,17 @@ func docIsFormResume(doc *goquery.Document) bool { } func docIsFormRedirectToAWS(doc *goquery.Document) bool { - return doc.Find("form[action=\"https://signin.aws.amazon.com/saml\"]").Size() == 1 + urls := []string{"form[action=\"https://signin.aws.amazon.com/saml\"]", + "form[action=\"https://signin.amazonaws-us-gov.com/saml\"]", + "form[action=\"https://signin.amazonaws.cn/saml\"]", + }; + + for _, value := range urls { + if (doc.Find(value).Size() > 0) { + return true + } + } + return false } func extractSAMLResponse(doc *goquery.Document) (v string, ok bool) {