Skip to content

Commit

Permalink
Revert "fix: check for no serviceAccountFilePath and no email (#2679)"
Browse files Browse the repository at this point in the history
This reverts commit 4947772.

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
  • Loading branch information
sagikazarmark committed Oct 4, 2022
1 parent e4bceef commit 19b3aab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
11 changes: 4 additions & 7 deletions connector/google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,10 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
scopes = append(scopes, "profile", "email")
}

var srv *admin.Service
if len(c.Groups) > 0 {
srv, err = createDirectoryService(c.ServiceAccountFilePath, c.AdminEmail, logger)
if err != nil {
cancel()
return nil, fmt.Errorf("could not create directory service: %v", err)
}
srv, err := createDirectoryService(c.ServiceAccountFilePath, c.AdminEmail, logger)
if err != nil {
cancel()
return nil, fmt.Errorf("could not create directory service: %v", err)
}

clientID := c.ClientID
Expand Down
14 changes: 0 additions & 14 deletions connector/google/google_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,12 @@ func TestOpen(t *testing.T) {
assert.Nil(t, err)

for name, reference := range map[string]testCase{
"not_requesting_groups": {
config: &Config{
ClientID: "testClient",
ClientSecret: "testSecret",
RedirectURI: ts.URL + "/callback",
Scopes: []string{"openid"},
},
expectedErr: "",
},
"missing_admin_email": {
config: &Config{
ClientID: "testClient",
ClientSecret: "testSecret",
RedirectURI: ts.URL + "/callback",
Scopes: []string{"openid", "groups"},
Groups: []string{"someGroup"},
},
expectedErr: "requires adminEmail",
},
Expand All @@ -99,7 +89,6 @@ func TestOpen(t *testing.T) {
Scopes: []string{"openid", "groups"},
AdminEmail: "foo@bar.com",
ServiceAccountFilePath: "not_found.json",
Groups: []string{"someGroup"},
},
expectedErr: "error reading credentials",
},
Expand All @@ -111,7 +100,6 @@ func TestOpen(t *testing.T) {
Scopes: []string{"openid", "groups"},
AdminEmail: "foo@bar.com",
ServiceAccountFilePath: serviceAccountFilePath,
Groups: []string{"someGroup"},
},
expectedErr: "",
},
Expand All @@ -122,7 +110,6 @@ func TestOpen(t *testing.T) {
RedirectURI: ts.URL + "/callback",
Scopes: []string{"openid", "groups"},
AdminEmail: "foo@bar.com",
Groups: []string{"someGroup"},
},
adc: serviceAccountFilePath,
expectedErr: "",
Expand All @@ -135,7 +122,6 @@ func TestOpen(t *testing.T) {
Scopes: []string{"openid", "groups"},
AdminEmail: "foo@bar.com",
ServiceAccountFilePath: serviceAccountFilePath,
Groups: []string{"someGroup"},
},
adc: "/dev/null",
expectedErr: "",
Expand Down

0 comments on commit 19b3aab

Please sign in to comment.