forked from dexidp/dex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dexidp#2895: Add Support for Multiple Admin Emails to Retrieve Group …
…Lists from Different Google Workspaces Signed-off-by: Viacheslav Sychov <[email protected]>
- Loading branch information
Showing
2 changed files
with
85 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,7 @@ func TestOpen(t *testing.T) { | |
ClientSecret: "testSecret", | ||
RedirectURI: ts.URL + "/callback", | ||
Scopes: []string{"openid", "groups"}, | ||
AdminEmail: "[email protected]", | ||
DomainToAdminEmail: map[string]string{"*": "[email protected]"}, | ||
ServiceAccountFilePath: "not_found.json", | ||
}, | ||
expectedErr: "error reading credentials", | ||
|
@@ -121,18 +121,18 @@ func TestOpen(t *testing.T) { | |
ClientSecret: "testSecret", | ||
RedirectURI: ts.URL + "/callback", | ||
Scopes: []string{"openid", "groups"}, | ||
AdminEmail: "[email protected]", | ||
DomainToAdminEmail: map[string]string{"bar.com": "[email protected]"}, | ||
ServiceAccountFilePath: serviceAccountFilePath, | ||
}, | ||
expectedErr: "", | ||
}, | ||
"adc": { | ||
config: &Config{ | ||
ClientID: "testClient", | ||
ClientSecret: "testSecret", | ||
RedirectURI: ts.URL + "/callback", | ||
Scopes: []string{"openid", "groups"}, | ||
AdminEmail: "[email protected]", | ||
ClientID: "testClient", | ||
ClientSecret: "testSecret", | ||
RedirectURI: ts.URL + "/callback", | ||
Scopes: []string{"openid", "groups"}, | ||
DomainToAdminEmail: map[string]string{"*": "[email protected]"}, | ||
}, | ||
adc: serviceAccountFilePath, | ||
expectedErr: "", | ||
|
@@ -143,7 +143,7 @@ func TestOpen(t *testing.T) { | |
ClientSecret: "testSecret", | ||
RedirectURI: ts.URL + "/callback", | ||
Scopes: []string{"openid", "groups"}, | ||
AdminEmail: "[email protected]", | ||
DomainToAdminEmail: map[string]string{"*": "[email protected]"}, | ||
ServiceAccountFilePath: serviceAccountFilePath, | ||
}, | ||
adc: "/dev/null", | ||
|
@@ -176,15 +176,15 @@ func TestGetGroups(t *testing.T) { | |
|
||
os.Setenv("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountFilePath) | ||
conn, err := newConnector(&Config{ | ||
ClientID: "testClient", | ||
ClientSecret: "testSecret", | ||
RedirectURI: ts.URL + "/callback", | ||
Scopes: []string{"openid", "groups"}, | ||
AdminEmail: "[email protected]", | ||
ClientID: "testClient", | ||
ClientSecret: "testSecret", | ||
RedirectURI: ts.URL + "/callback", | ||
Scopes: []string{"openid", "groups"}, | ||
DomainToAdminEmail: map[string]string{"*": "[email protected]"}, | ||
}) | ||
assert.Nil(t, err) | ||
|
||
conn.adminSrv, err = admin.NewService(context.Background(), option.WithoutAuthentication(), option.WithEndpoint(ts.URL)) | ||
conn.adminSrv[wildcardDomainToAdminEmail], err = admin.NewService(context.Background(), option.WithoutAuthentication(), option.WithEndpoint(ts.URL)) | ||
assert.Nil(t, err) | ||
type testCase struct { | ||
userKey string | ||
|