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

Adding JWT Audience to support array of audiences #308

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions map_claims.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,19 @@ type MapClaims map[string]interface{}
// Compares the aud claim against cmp.
// If required is false, this method will return true if the value matches or is unset
func (m MapClaims) VerifyAudience(cmp string, req bool) bool {
aud, _ := m["aud"].(string)
return verifyAud(aud, cmp, req)
switch m["aud"].(type) {
case string:
aud := m["aud"].(string)
return verifyAud(aud, cmp, req)
default:
auds := m["aud"].([]interface{})
for _, aud := range auds {
if verifyAud(aud.(string), cmp, req) {
return true
}
}
return false
}
}

// Compares the exp claim against cmp.
Expand Down