Skip to content
This repository was archived by the owner on May 21, 2022. It is now read-only.

Commit 4ea2e3f

Browse files
committed
Update logix based on pr comment to check on error
Signed-off-by: Alistair Hey <[email protected]>
1 parent aa51f48 commit 4ea2e3f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

map_claims.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ type MapClaims map[string]interface{}
1313
// Compares the aud claim against cmp.
1414
// If required is false, this method will return true if the value matches or is unset
1515
func (m MapClaims) VerifyAudience(cmp string, req bool) bool {
16-
aud, _ := m["aud"].([]string)
17-
18-
// special case where aud is a single string not list of strings
19-
if aud == nil {
20-
strAud, _ := m["aud"].(string)
16+
aud, ok := m["aud"].([]string)
17+
if !ok {
18+
strAud, ok := m["aud"].(string)
2119
aud = append(aud, strAud)
20+
if !ok {
21+
return false
22+
}
2223
}
2324

2425
return verifyAud(aud, cmp, req)

0 commit comments

Comments
 (0)