Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/proxy/providers/sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ func (p *SSOProvider) ValidateGroup(email string, allowedGroups []string, access

logger.WithUser(email).WithAllowedGroups(allowedGroups).Info("validating groups")
inGroups := []string{}
if len(allowedGroups) == 0 {
return inGroups, true, nil
}

userGroups, err := p.UserGroups(email, allowedGroups, accessToken)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions internal/proxy/providers/sso_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ func TestSSOProviderGroups(t *testing.T) {
ProfileStatus int
}{
{
Name: "invalid when no group id set",
Name: "valid when no group id set",
Email: "michael.bland@gsa.gov",
Groups: []string{},
ProxyGroupIds: []string{},
ExpectedValid: false,
ExpectedValid: true,
ExpectedInGroups: []string{},
ExpectError: nil,
},
Expand Down Expand Up @@ -311,15 +311,15 @@ func TestSSOProviderValidateSessionState(t *testing.T) {
ExpectedValid bool
}{
{
Name: "invalid when no group id set",
Name: "valid when no group id set",
SessionState: &sessions.SessionState{
AccessToken: "abc",
Email: "michael.bland@gsa.gov",
},
ProviderResponse: http.StatusOK,
Groups: []string{},
ProxyGroupIds: []string{},
ExpectedValid: false,
ExpectedValid: true,
},
{
Name: "invalid when response is is not 200",
Expand Down