This repository has been archived by the owner on Aug 10, 2021. It is now read-only.
forked from dgrijalva/jwt-go
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Waterdrips/waterdrips-fix-security-vuln
Waterdrips fix security vuln take 2
- Loading branch information
Showing
6 changed files
with
99 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
bin | ||
.idea/ | ||
|
||
|
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 |
---|---|---|
|
@@ -5,9 +5,8 @@ script: | |
- go test -v ./... | ||
|
||
go: | ||
- 1.3 | ||
- 1.4 | ||
- 1.5 | ||
- 1.6 | ||
- 1.7 | ||
- 1.12 | ||
- 1.13 | ||
- 1.14 | ||
- 1.15 | ||
- tip |
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
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package jwt | ||
|
||
import "testing" | ||
|
||
func Test_mapClaims_list_aud(t *testing.T){ | ||
mapClaims := MapClaims{ | ||
"aud": []string{"foo"}, | ||
} | ||
want := true | ||
got := mapClaims.VerifyAudience("foo", true) | ||
|
||
if want != got { | ||
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) | ||
} | ||
} | ||
func Test_mapClaims_string_aud(t *testing.T){ | ||
mapClaims := MapClaims{ | ||
"aud": "foo", | ||
} | ||
want := true | ||
got := mapClaims.VerifyAudience("foo", true) | ||
|
||
if want != got { | ||
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) | ||
} | ||
} | ||
|
||
func Test_mapClaims_list_aud_no_match(t *testing.T){ | ||
mapClaims := MapClaims{ | ||
"aud": []string{"bar"}, | ||
} | ||
want := false | ||
got := mapClaims.VerifyAudience("foo", true) | ||
|
||
if want != got { | ||
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) | ||
} | ||
} | ||
func Test_mapClaims_string_aud_fail(t *testing.T){ | ||
mapClaims := MapClaims{ | ||
"aud": "bar", | ||
} | ||
want := false | ||
got := mapClaims.VerifyAudience("foo", true) | ||
|
||
if want != got { | ||
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) | ||
} | ||
} | ||
|
||
func Test_mapClaims_string_aud_no_claim(t *testing.T){ | ||
mapClaims := MapClaims{ | ||
} | ||
want := false | ||
got := mapClaims.VerifyAudience("foo", true) | ||
|
||
if want != got { | ||
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) | ||
} | ||
} | ||
|
||
func Test_mapClaims_string_aud_no_claim_not_required(t *testing.T){ | ||
mapClaims := MapClaims{ | ||
} | ||
want := false | ||
got := mapClaims.VerifyAudience("foo", false) | ||
|
||
if want != got { | ||
t.Fatalf("Failed to verify claims, wanted: %v got %v", want, got) | ||
} | ||
} |