aboutsummaryrefslogtreecommitdiff
path: root/server/auth/google/google.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/auth/google/google.go')
-rw-r--r--server/auth/google/google.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/auth/google/google.go b/server/auth/google/google.go
index cf780f3..0328d42 100644
--- a/server/auth/google/google.go
+++ b/server/auth/google/google.go
@@ -1,6 +1,7 @@
package google
import (
+ "errors"
"fmt"
"net/http"
"strings"
@@ -26,7 +27,11 @@ type Config struct {
}
// New creates a new Google provider from a configuration.
-func New(c *config.Auth) auth.Provider {
+func New(c *config.Auth) (auth.Provider, error) {
+ if c.ProviderOpts["domain"] == "" {
+ return nil, errors.New("google_opts domain must not be empty")
+ }
+
return &Config{
config: &oauth2.Config{
ClientID: c.OauthClientID,
@@ -36,7 +41,7 @@ func New(c *config.Auth) auth.Provider {
Scopes: []string{googleapi.UserinfoEmailScope, googleapi.UserinfoProfileScope},
},
domain: c.ProviderOpts["domain"],
- }
+ }, nil
}
// A new oauth2 http client.