@@ -20,7 +20,7 @@ func main() {
2020 log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
2121 flagSet := flag.NewFlagSet("oauth2_proxy", flag.ExitOnError)
2222
23− googleAppsDomains := StringArray{}
23+ emailDomains := StringArray{}
2424 upstreams := StringArray{}
2525 skipAuthRegex := StringArray{}
2626
@@ -35,7 +35,7 @@ func main() {
3535 flagSet.Bool("pass-host-header", true, "pass the request Host Header to upstream")
3636 flagSet.Var(&skipAuthRegex, "skip-auth-regex", "bypass authentication for requests path's that match (may be given multiple times)")
3737
38− flagSet.Var(&googleAppsDomains, "google-apps-domain", "authenticate against the given Google apps domain (may be given multiple times)")
38+ flagSet.Var(&emailDomains, "email-domain", "authenticate emails with the specified domain (may be given multiple times). Use * to authenticate any email")
3939 flagSet.String("github-org", "", "restrict logins to members of this organisation")
4040 flagSet.String("github-team", "", "restrict logins to members of this team")
4141 flagSet.String("client-id", "", "the OAuth Client ID: ie: \"123456.apps.googleusercontent.com\"")
@@ -89,14 +89,14 @@ func main() {
8989 os.Exit(1)
9090 }
9191
92− validator := NewValidator(opts.GoogleAppsDomains, opts.AuthenticatedEmailsFile)
92+ validator := NewValidator(opts.EmailDomains, opts.AuthenticatedEmailsFile)
9393 oauthproxy := NewOauthProxy(opts, validator)
9494
95− if len(opts.GoogleAppsDomains) != 0 && opts.AuthenticatedEmailsFile == "" {
96− if len(opts.GoogleAppsDomains) > 1 {
97− oauthproxy.SignInMessage = fmt.Sprintf("Authenticate using one of the following domains: %v", strings.Join(opts.GoogleAppsDomains, ", "))
98− } else {
99− oauthproxy.SignInMessage = fmt.Sprintf("Authenticate using %v", opts.GoogleAppsDomains[0])
95+ if len(opts.EmailDomains) != 0 && opts.AuthenticatedEmailsFile == "" {
96+ if len(opts.EmailDomains) > 1 {
97+ oauthproxy.SignInMessage = fmt.Sprintf("Authenticate using one of the following domains: %v", strings.Join(opts.EmailDomains, ", "))
98+ } else if opts.EmailDomains[0] != "*" {
99+ oauthproxy.SignInMessage = fmt.Sprintf("Authenticate using %v", opts.EmailDomains[0])
100100 }
101101 }
102102