From 4ea2e3f2079a8f285d88895a91d6a12a4c46b04d Mon Sep 17 00:00:00 2001 From: Alistair Hey Date: Mon, 14 Sep 2020 14:06:56 +0100 Subject: [PATCH] Update logix based on pr comment to check on error Signed-off-by: Alistair Hey --- map_claims.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/map_claims.go b/map_claims.go index eef76823..86fce50b 100644 --- a/map_claims.go +++ b/map_claims.go @@ -13,12 +13,13 @@ 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) - - // special case where aud is a single string not list of strings - if aud == nil { - strAud, _ := m["aud"].(string) + aud, ok := m["aud"].([]string) + if !ok { + strAud, ok := m["aud"].(string) aud = append(aud, strAud) + if !ok { + return false + } } return verifyAud(aud, cmp, req)