Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert pull request #10 (multiple audiences) #24

Merged
merged 1 commit into from Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions jwt/validation.go
Expand Up @@ -89,16 +89,11 @@ func (c Claims) ValidateWithLeeway(e Expected, leeway time.Duration) error {
}

if len(e.Audience) != 0 {
flag := false
for _, v := range e.Audience {
if c.Audience.Contains(v) {
flag = true
break
if !c.Audience.Contains(v) {
return ErrInvalidAudience
}
}
if !flag {
return ErrInvalidAudience
}
}

// validate using the e.Time, or time.Now if not provided
Expand Down
11 changes: 0 additions & 11 deletions jwt/validation_test.go
Expand Up @@ -44,17 +44,6 @@ func TestFieldsMatch(t *testing.T) {
assert.NoError(t, c.Validate(v))
}

claimsWithSingleAudience := Claims{
Issuer: "issuer",
Subject: "subject",
Audience: []string{"a1"},
ID: "42",
}

for _, v := range valid {
assert.NoError(t, claimsWithSingleAudience.Validate(v))
}

invalid := []struct {
Expected Expected
Error error
Expand Down