Skip to content

Commit

Permalink
fix: unmarshalling of audience as array (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
livio-a committed Sep 10, 2020
1 parent abd3b6f commit f645dd3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/oidc/token.go
Expand Up @@ -241,10 +241,16 @@ func timeToJSON(t time.Time) int64 {
return t.Unix()
}

func audienceFromJSON(audience interface{}) []string {
switch aud := audience.(type) {
func audienceFromJSON(i interface{}) []string {
switch aud := i.(type) {
case []string:
return aud
case []interface{}:
audience := make([]string, len(aud))
for i, a := range aud {
audience[i] = a.(string)
}
return audience
case string:
return []string{aud}
}
Expand Down

0 comments on commit f645dd3

Please sign in to comment.