Skip to content

Commit f1c5576

Browse files
committed
Formatting
1 parent ab835f5 commit f1c5576

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

map_claims_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ func TestVerifyAuds(t *testing.T) {
8080
type test struct {
8181
Name string
8282
MapClaims MapClaims // MapClaims to validate
83-
Expected bool // Whether the validation is expected to pass
84-
Comparison []string // Cmp audience values
83+
Expected bool // Whether the validation is expected to pass
84+
Comparison []string // Cmp audience values
8585

86-
AllAudMatching bool // Whether to require all auds matching all cmps
87-
Required bool // Whether the aud claim is required
86+
AllAudMatching bool // Whether to require all auds matching all cmps
87+
Required bool // Whether the aud claim is required
8888
}
8989

9090
tests := []test{
@@ -97,14 +97,14 @@ func TestVerifyAuds(t *testing.T) {
9797
{Name: "[]String aud with any expected cmps required and match not required, single expected aud ", MapClaims: MapClaims{"aud": []string{"example.com", "example.example.com"}}, Expected: true, Required: true, Comparison: []string{"example.com"}, AllAudMatching: false},
9898

9999
// Non-matching auds and cmps
100-
// Required = true
100+
// Required = true
101101
{Name: "[]String aud with all expected cmps required and match not required, single claim aud", MapClaims: MapClaims{"aud": []string{"example.com"}}, Expected: false, Required: true, Comparison: []string{"example.com", "example.example.com"}, AllAudMatching: true},
102102
{Name: "[]String aud with all expected cmps required and match not required, single expected aud ", MapClaims: MapClaims{"aud": []string{"example.com", "example.example.com"}}, Expected: false, Required: true, Comparison: []string{"example.com"}, AllAudMatching: true},
103103
{Name: "[]String aud with all expected cmps required and match not required, different auds", MapClaims: MapClaims{"aud": []string{"example.example.com"}}, Expected: false, Required: true, Comparison: []string{"example.com"}, AllAudMatching: true},
104104

105105
{Name: "[]String aud with any expected cmps required and match not required, different auds", MapClaims: MapClaims{"aud": []string{"example.example.com"}}, Expected: false, Required: true, Comparison: []string{"example.com"}, AllAudMatching: false},
106106

107-
// Required = false
107+
// Required = false
108108
{Name: "[]String aud with all expected cmps required and match not required, single claim aud", MapClaims: MapClaims{"aud": []string{"example.com"}}, Expected: true, Required: false, Comparison: []string{"example.com", "example.example.com"}, AllAudMatching: true},
109109
{Name: "[]String aud with all expected cmps required and match not required, single expected aud ", MapClaims: MapClaims{"aud": []string{"example.com", "example.example.com"}}, Expected: true, Required: false, Comparison: []string{"example.com"}, AllAudMatching: true},
110110
{Name: "[]String aud with all expected cmps required and match not required, different auds", MapClaims: MapClaims{"aud": []string{"example.example.com"}}, Expected: true, Required: false, Comparison: []string{"example.com"}, AllAudMatching: true},

validator.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ func (v *Validator) Validate(claims Claims) error {
135135

136136
// If we have expected audiences, we also require the audiences claim
137137
if len(v.expectedAuds) != 0 {
138-
if err := v.verifyAudiences(claims, v.expectedAuds, true, v.expectedAudsMatchAll); err != nil {
139-
errs = append(errs, err)
140-
}
138+
if err := v.verifyAudiences(claims, v.expectedAuds, true, v.expectedAudsMatchAll); err != nil {
139+
errs = append(errs, err)
140+
}
141141
}
142142

143143
// If we have an expected issuer, we also require the issuer claim
@@ -331,7 +331,7 @@ func (v *Validator) verifyAudiences(claims Claims, cmps []string, required bool,
331331

332332
matchFound := false
333333

334-
// Label to break out of both loops if a match is found
334+
// Label to break out of both loops if a match is found
335335
outer:
336336

337337
// Check all aud values

0 commit comments

Comments
 (0)