bugfix: fix arvados-node-manager package build
[arvados.git] / lib / controller / localdb / login_google.go
index 61bbaf01b12f73949dd4965afddf20f83a4aaede..144b04c46d7ee6ab865eff24a7acc06db08f5dd9 100644 (file)
@@ -12,6 +12,7 @@ import (
        "encoding/base64"
        "errors"
        "fmt"
+       "net/http"
        "net/url"
        "strings"
        "sync"
@@ -22,6 +23,7 @@ import (
        "git.arvados.org/arvados.git/sdk/go/arvados"
        "git.arvados.org/arvados.git/sdk/go/auth"
        "git.arvados.org/arvados.git/sdk/go/ctxlog"
+       "git.arvados.org/arvados.git/sdk/go/httpserver"
        "github.com/coreos/go-oidc"
        "golang.org/x/oauth2"
        "google.golang.org/api/option"
@@ -69,8 +71,8 @@ func (ctrl *googleLoginController) Login(ctx context.Context, opts arvados.Login
                return loginError(fmt.Errorf("error making redirect URL: %s", err))
        }
        conf := &oauth2.Config{
-               ClientID:     ctrl.Cluster.Login.GoogleClientID,
-               ClientSecret: ctrl.Cluster.Login.GoogleClientSecret,
+               ClientID:     ctrl.Cluster.Login.Google.ClientID,
+               ClientSecret: ctrl.Cluster.Login.Google.ClientSecret,
                Endpoint:     provider.Endpoint(),
                Scopes:       []string{oidc.ScopeOpenID, "profile", "email"},
                RedirectURL:  redirURL.String(),
@@ -129,6 +131,10 @@ func (ctrl *googleLoginController) Login(ctx context.Context, opts arvados.Login
        }
 }
 
+func (ctrl *googleLoginController) UserAuthenticate(ctx context.Context, opts arvados.UserAuthenticateOptions) (arvados.APIClientAuthorization, error) {
+       return arvados.APIClientAuthorization{}, httpserver.ErrorWithStatus(errors.New("username/password authentication is not available"), http.StatusBadRequest)
+}
+
 // Use a person's token to get all of their email addresses, with the
 // primary address at index 0. The provided defaultAddr is always
 // included in the returned slice, and is used as the primary if the
@@ -156,7 +162,7 @@ func (ctrl *googleLoginController) getAuthInfo(ctx context.Context, cluster *arv
                ret.Email = claims.Email
        }
 
-       if !ctrl.Cluster.Login.GoogleAlternateEmailAddresses {
+       if !ctrl.Cluster.Login.Google.AlternateEmailAddresses {
                if ret.Email == "" {
                        return nil, fmt.Errorf("cannot log in with unverified email address %q", claims.Email)
                }