Skip to content

Commit 0d80834

Browse files
committed
update for wildcard
1 parent fcc32f7 commit 0d80834

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

internal/proxy/providers/sso.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (p *SSOProvider) ValidateGroup(email string, allowedGroups []string, access
181181

182182
logger.WithUser(email).WithAllowedGroups(allowedGroups).Info("validating groups")
183183
inGroups := []string{}
184-
if len(allowedGroups) == 0 {
184+
if len(allowedGroups) == 0 || len(allowedGroups) == 1 && allowedGroups[0] == "*" {
185185
return inGroups, true, nil
186186
}
187187

internal/proxy/providers/sso_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,15 @@ func TestSSOProviderGroups(t *testing.T) {
152152
ExpectedInGroups: []string{},
153153
ExpectError: nil,
154154
},
155+
{
156+
Name: "valid group list consists of a single wildcard",
157+
Email: "michael.bland@gsa.gov",
158+
Groups: []string{},
159+
ProxyGroupIds: []string{"*"},
160+
ExpectedValid: true,
161+
ExpectedInGroups: []string{},
162+
ExpectError: nil,
163+
},
155164
{
156165
Name: "valid when the group id exists",
157166
Email: "michael.bland@gsa.gov",
@@ -321,6 +330,17 @@ func TestSSOProviderValidateSessionState(t *testing.T) {
321330
ProxyGroupIds: []string{},
322331
ExpectedValid: true,
323332
},
333+
{
334+
Name: "valid when group list consists of single wildcard",
335+
SessionState: &sessions.SessionState{
336+
AccessToken: "abc",
337+
Email: "michael.bland@gsa.gov",
338+
},
339+
ProviderResponse: http.StatusOK,
340+
Groups: []string{},
341+
ProxyGroupIds: []string{"*"},
342+
ExpectedValid: true,
343+
},
324344
{
325345
Name: "invalid when response is is not 200",
326346
SessionState: &sessions.SessionState{

0 commit comments

Comments
 (0)