@@ -23,12 +23,13 @@ var (
23 htpasswdFile = flag.String("htpasswd-file", "", "additionally authenticate against a htpasswd file. Entries must be created with \"htpasswd -s\" for SHA encryption")
23 htpasswdFile = flag.String("htpasswd-file", "", "additionally authenticate against a htpasswd file. Entries must be created with \"htpasswd -s\" for SHA encryption")
24 cookieSecret = flag.String("cookie-secret", "", "the seed string for secure cookies")
24 cookieSecret = flag.String("cookie-secret", "", "the seed string for secure cookies")
25 cookieDomain = flag.String("cookie-domain", "", "an optional cookie domain to force cookies to")
25 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")
27 authenticatedEmailsFile = flag.String("authenticated-emails-file", "", "authenticate against emails via file (one per line)")
26 authenticatedEmailsFile = flag.String("authenticated-emails-file", "", "authenticate against emails via file (one per line)")
27+ googleAppsDomains = StringArray{}
28 upstreams = StringArray{}
28 upstreams = StringArray{}
31func init() {
31func init() {
32+ flag.Var(&googleAppsDomains, "google-apps-domain", "authenticate against the given google apps domain (may be given multiple times)")
32 flag.Var(&upstreams, "upstream", "the http url(s) of the upstream endpoint. If multiple, routing is based on path")
33 flag.Var(&upstreams, "upstream", "the http url(s) of the upstream endpoint. If multiple, routing is based on path")
@@ -78,11 +79,11 @@ func main() {
78 log.Fatalf("error parsing --redirect-url %s", err.Error())
79 log.Fatalf("error parsing --redirect-url %s", err.Error())
81− validator := NewValidator(*googleAppsDomain, *authenticatedEmailsFile)
82+ validator := NewValidator(googleAppsDomains, *authenticatedEmailsFile)
82 oauthproxy := NewOauthProxy(upstreamUrls, *clientID, *clientSecret, validator)
83 oauthproxy := NewOauthProxy(upstreamUrls, *clientID, *clientSecret, validator)
83 oauthproxy.SetRedirectUrl(redirectUrl)
84 oauthproxy.SetRedirectUrl(redirectUrl)
84− if *googleAppsDomain != "" && *authenticatedEmailsFile == "" {
85+ if len(googleAppsDomains) != 0 && *authenticatedEmailsFile == "" {
85− oauthproxy.SignInMessage = fmt.Sprintf("using a %s email address", *googleAppsDomain)
86+ oauthproxy.SignInMessage = fmt.Sprintf("using a email address from the following domains: %v", strings.Join(googleAppsDomains, ", "))
87 if *htpasswdFile != "" {
88 if *htpasswdFile != "" {
88 oauthproxy.HtpasswdFile, err = NewHtpasswdFromFile(*htpasswdFile)
89 oauthproxy.HtpasswdFile, err = NewHtpasswdFromFile(*htpasswdFile)