@@ -23,12 +23,13 @@ var (
2323 htpasswdFile = flag.String("htpasswd-file", "", "additionally authenticate against a htpasswd file. Entries must be created with \"htpasswd -s\" for SHA encryption")
2424 cookieSecret = flag.String("cookie-secret", "", "the seed string for secure cookies")
2525 cookieDomain = flag.String("cookie-domain", "", "an optional cookie domain to force cookies to")
26− googleAppsDomain = flag.String("google-apps-domain", "", "authenticate against the given google apps domain")
2726 authenticatedEmailsFile = flag.String("authenticated-emails-file", "", "authenticate against emails via file (one per line)")
27+ googleAppsDomains = StringArray{}
2828 upstreams = StringArray{}
2929)
3030
3131func init() {
32+ flag.Var(&googleAppsDomains, "google-apps-domain", "authenticate against the given google apps domain (may be given multiple times)")
3233 flag.Var(&upstreams, "upstream", "the http url(s) of the upstream endpoint. If multiple, routing is based on path")
3334}
3435
@@ -78,11 +79,11 @@ func main() {
7879 log.Fatalf("error parsing --redirect-url %s", err.Error())
7980 }
8081
81− validator := NewValidator(*googleAppsDomain, *authenticatedEmailsFile)
82+ validator := NewValidator(googleAppsDomains, *authenticatedEmailsFile)
8283 oauthproxy := NewOauthProxy(upstreamUrls, *clientID, *clientSecret, validator)
8384 oauthproxy.SetRedirectUrl(redirectUrl)
84− if *googleAppsDomain != "" && *authenticatedEmailsFile == "" {
85− oauthproxy.SignInMessage = fmt.Sprintf("using a %s email address", *googleAppsDomain)
85+ if len(googleAppsDomains) != 0 && *authenticatedEmailsFile == "" {
86+ oauthproxy.SignInMessage = fmt.Sprintf("using a email address from the following domains: %v", strings.Join(googleAppsDomains, ", "))
8687 }
8788 if *htpasswdFile != "" {
8889 oauthproxy.HtpasswdFile, err = NewHtpasswdFromFile(*htpasswdFile)